Infinite world, LuaJIT mod API, WorldEdit port, skins and music

- Infinite world: streamed chunk cache, multi-region storage (old chunks.dat
  still loads), per-chunk entity/tile entity persistence, client chunk
  streaming, protocol version 10, view-distance server property
- LuaJIT mod host (mods/, lua/prelude.lua) with events, commands, world and
  player API; WorldEdit command set ported to it (mods/worldedit)
- /skin command, SetSkinPacket and bundled skins
- OGG music player (data/music is ignored, tools/convert-music.ps1)
- package-windows.ps1 builds client and dedicated server for Windows

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kirill Sokolov 2026-10-20 21:08:09 +03:00
parent db9f6c9f32
commit 110cb2a896
68 changed files with 5064 additions and 844 deletions

View file

@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_POLICY_VERSION_MINIMUM 3.10)
include(cmake/EnumOption.cmake)
include(cmake/LuaJIT.cmake)
if(EMSCRIPTEN)
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
@ -99,6 +100,16 @@ else()
)
endif()
if(NOT ${PLATFORM} MATCHES "Web")
# single file OGG Vorbis decoder used by the music player
CPMAddPackage(
NAME "stb"
GIT_REPOSITORY "https://github.com/nothings/stb.git"
GIT_TAG "a7d4c2175630e1ea5b6f8dd00ab96fed0b97b96d"
DOWNLOAD_ONLY YES
)
endif()
CPMAddPackage(
NAME "openal"
GIT_REPOSITORY "https://github.com/kcat/openal-soft.git"
@ -196,6 +207,7 @@ file(GLOB SERVER_SOURCES
"src/world/level/biome/Biome.cpp"
"src/world/level/biome/BiomeSource.cpp"
"src/world/level/chunk/ChunkCache.cpp"
"src/world/level/chunk/LevelChunk.cpp"
"src/world/level/dimension/Dimension.cpp"
@ -217,6 +229,7 @@ file(GLOB SERVER_SOURCES
"src/world/phys/HitResult.cpp"
"src/commands/*.cpp"
"src/lua/*.cpp"
)
file(GLOB CLIENT_SOURCES
@ -302,10 +315,11 @@ file(GLOB CLIENT_SOURCES
"src/main.cpp"
"src/commands/*.cpp"
"src/lua/*.cpp"
)
if (${PLATFORM} STREQUAL "Desktop")
list(APPEND CLIENT_SOURCES glad/src/glad.c)
list(APPEND CLIENT_SOURCES glad/src/glad.c "${stb_SOURCE_DIR}/stb_vorbis.c")
endif()
# Server
@ -318,7 +332,13 @@ target_include_directories("${PROJECT_NAME}-server" PUBLIC
"project/lib_projects/raknet/jni/RaknetSources"
)
target_link_libraries("${PROJECT_NAME}-server" ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBS})
target_link_libraries("${PROJECT_NAME}-server" ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBS} luajit)
# Lua API (prelude) and bundled mods are shipped next to the executables
add_custom_command(TARGET "${PROJECT_NAME}-server" POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/lua" "$<TARGET_FILE_DIR:${PROJECT_NAME}-server>/lua"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/mods" "$<TARGET_FILE_DIR:${PROJECT_NAME}-server>/mods"
)
add_executable(${PROJECT_NAME} ${CLIENT_SOURCES})
@ -333,6 +353,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
"${CMAKE_SOURCE_DIR}/src"
"${openal_SOURCE_DIR}/include"
"${glfw_SOURCE_DIR}/include"
"${stb_SOURCE_DIR}"
"lib/include"
)
@ -381,7 +402,7 @@ endif()
# Client
target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" ${PLATFORM})
target_link_libraries(${PROJECT_NAME} zlib ${PNG_LIB} OpenAL::OpenAL glfw ${EXTRA_LIBS})
target_link_libraries(${PROJECT_NAME} zlib ${PNG_LIB} OpenAL::OpenAL glfw ${EXTRA_LIBS} luajit)
if (OpenSSL_FOUND)
target_link_libraries(${PROJECT_NAME} OpenSSL::SSL OpenSSL::Crypto)
@ -402,6 +423,8 @@ if(NOT ${PLATFORM} MATCHES "Web")
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/data" $<TARGET_FILE_DIR:${PROJECT_NAME}>/data
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/lua" $<TARGET_FILE_DIR:${PROJECT_NAME}>/lua
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/mods" $<TARGET_FILE_DIR:${PROJECT_NAME}>/mods
)
else()
add_custom_command(