Exploring avoxelgame: A 3D Voxel Engine Written in APL

Exploring avoxelgame: A 3D Voxel Engine Written in APL

avoxelgame 專案是一個實驗性的 3D 體素遊戲引擎,旨在測試 APL 的陣列導向表示法是否能為實作基於體素的遊戲邏輯與世界生成提供更有效率的方式。該專案使用 Dyalog APL 20.0 與 SDL3 建構,其定位是技術概念驗證,而非正式發行的遊戲。

Technical Architecture and Dependencies

該引擎採用混合方法,將 APL 的高階陣列處理能力與 SDL3 的低階圖形功能相結合。系統需要現代圖形後端——Vulkan、DirectX12 或 Metal——才能運作。

Core Requirements

  • Language Runtime: Dyalog APL 20.0
  • Graphics Library: SDL3, 包括 sdl3_ttfsdl3_image
  • C-Interop: 需要 C 編譯器與 CMake 來建構 LSE (Language System Extension) 組件。
  • Hardware Acceleration: 支援 Vulkan、DirectX12 或 Metal。

Platform-Specific Implementation

  • macOS and Linux: 引擎透過 main.apls 中的 shebang 進行部署,並需要使用 CMake 手動編譯與安裝 libLSE.dylib (macOS) 或 libLSE.so (Linux)。
  • Windows: 引擎透過 Dyalog 會話使用 ]link.createstate.Play 指令來執行。Windows 使用者必須使用 SDL3 開發函式庫與 ./libs 目錄中提供的 .dll 檔案。

Shader Pipeline and Rendering

該專案使用 GLSL 進行著色器開發。原始著色器位於 ./shaders/glsl,必須透過 ./compile_shaders.sh 腳本使用 DirectX Shader Compiler、glslcspirv-cross 編譯成各種格式。

Current Limitations and Known Issues

開發者承認該專案具有高度實驗性,且包含若干穩定性問題:

  • Performance: Windows 平台上存在顯著的效能退化。
  • Backend Support: 目前 Windows 上的 DirectX12 後端尚不受支援。
  • Windows Stability: 在單一會話中嘗試多次執行時,引擎容易出現 syserror 999,這顯示可能存在記憶體洩漏問題。

Community Perspectives

關於該專案的討論強調了 APL 的陣列中心特性與體素數據結構之間的獨特契合度。

A voxel world is a pretty good sales pitch for APL: the weird-looking part is the notation, not the model.

其他觀察者注意到專案文件中如此誠實的罕見性,讚揚作者明確地將該作品標記為「充滿錯誤的熱情專案」(buggy passion project),而非誇大其功能。

Sources