用 APL 编写的 3D 体素游戏引擎
A 3D voxel game engine written in APL

原始链接: https://github.com/namgyaaal/avoxelgame

这款实验性体素游戏基于 Dyalog APL 20.0 构建,旨在测试该编程语言在游戏开发中的可行性。游戏具备标准的 WASD 控制、方块选择和摄像机移动功能,但目前仍处于开发初期,存在许多已知的问题,包括内存泄漏和性能瓶颈。 该项目需要 Dyalog APL、C 编译器、CMake 和 SDL3 库。安装过程涉及构建 `libLSE` 库;在 Linux/macOS 上,可通过执行 `main.apls` 运行。Windows 环境下的设置较为复杂,需要通过 CMake 手动配置 SDL3 库。目前,该游戏不支持单次会话内的多次游玩,且 Windows 上的 DirectX12 后端尚未实现。着色器(Shaders)以 GLSL 提供,并附有可将其编译为不同图形 API 的脚本。 尽管存在上述限制,该项目仍是 APL 在图形密集型应用中进行概念验证的一个有趣尝试。材质资源由 Madeline Vergani 提供。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 用 APL 编写的 3D 体素游戏引擎 (github.com/namgyaaal) 16 点,由 sph 在 24 分钟前发布 | 隐藏 | 过往 | 收藏 | 讨论 | 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Cover

This started off as a bet with myself that APL notation would provide an easier way to make a voxel game.

This is highly experimental and buggy.

  • W-A-S-D to move
  • Space to jump
  • Mouse to move the camera
  • Q to quit
  • I to toggle render information
  • F for fast noclip mode
  • L to lock and unlock the mouse while in-game
  • 1-5 to select different blocks to place
  • Dyalog APL 20.0
  • A C Compiler
  • CMake
  • Vulkan, DirectX12 or Metal graphics are required. For more information, check here
  • sdl3, sdl3_ttf and sdl3_image (MacOS with brew)

Running on MacOS or Linux

After installing dependencies and cloning, make sure you build and install LSE. e.g.,

cd lse 
mkdir build
cd build
cmake ..
make 
make install

This should install libLSE.dylib on macOS and libLSE.so on Linux in ./libs/ alongside the relevant SDL3 library files.

After that you should be able to run with ./main.apls

Some Linux users may have dyalogscript located in a different directory. If that's the case, the shebang in main.apls should be replaced with the path specified by which dyalogscript

Compiling everything on Windows is a bit more tricky and is best done with finding the SDL3 dev libraries provided on libsdl3 releases with cmake-gui.

.dlls are provided as a release here which can be placed in a folder ./libs on the directory this repository.

Afterwards, the game can be played through a Dyalog session like so:

]cd <ROOT DIRECTORY>
]link.create # ./avg
Run
state.Play

Source code that gets compiled to different shader formats is in ./shaders/glsl

Shaders come bundled with this repo. However, if you want to modify them, edit the glsl shaders and run ./compile_shaders.sh

Note that this requires the DirectX Shader Compiler, glslc and spirv-cross.

  • There are significant performance regressions on Windows being worked on.
  • DirectX12 backend is currently not supported on Windows.
  • You currently can't play multiple times in the same session.
    • Known to syserror 999 !
    • There's probably memory leaks somewhere !

Textures by Madeline Vergani (@RubenVerg)

联系我们 contact @ memedata.com