Brandling Safari: LAN safari-zone creature catching on the HD-2D engine
- Authoritative 30 Hz server (ENet, SQLite): accounts, characters, wild AI, tall grass / water / wandering spawns, fishing, captures, follower chains, clock + weather, LAN beacon - Client: title / join / character creator / play screens, prediction + reconciliation, interpolated players and parties, HD-2D UI (dialogue with Professor Henry, HUD, collection) - Shared deterministic zone generator, movement, protocol, roster, appearance - Paper-doll character art pipeline (PixelLab base walk + per-item animation edits) - Brandling roster from the company list (logo colors, jev types), Blender safari props - Headless test bot
This commit is contained in:
93
CMakeLists.txt
Normal file
93
CMakeLists.txt
Normal file
@@ -0,0 +1,93 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(brandling_safari LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
option(BS_BUILD_CLIENT "Build the game client (needs OpenGL + the HD-2D engine)" ON)
|
||||
option(BS_BUILD_SERVER "Build the dedicated server" ON)
|
||||
set(HD2D_ENGINE_DIR "${CMAKE_SOURCE_DIR}/../Vibe-HD-2D" CACHE PATH "Path to the Vibe-HD-2D engine checkout")
|
||||
set(HD2D_ENGINE_GIT "ssh://git@git.gabjimmy.com:30009/Gabe/Vibe-HD-2D.git" CACHE STRING "Engine repo used when HD2D_ENGINE_DIR is missing")
|
||||
|
||||
include(FetchContent)
|
||||
# Old third-party CMakeLists (ENet) still declare cmake_minimum_required < 3.5.
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
||||
|
||||
# --- Dependencies -------------------------------------------------------------
|
||||
find_package(glm QUIET)
|
||||
if(NOT TARGET glm::glm)
|
||||
FetchContent_Declare(glm GIT_REPOSITORY https://github.com/g-truc/glm.git GIT_TAG 1.0.1)
|
||||
FetchContent_MakeAvailable(glm)
|
||||
endif()
|
||||
|
||||
find_package(nlohmann_json 3 QUIET)
|
||||
if(NOT TARGET nlohmann_json::nlohmann_json)
|
||||
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
|
||||
FetchContent_MakeAvailable(json)
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(enet GIT_REPOSITORY https://github.com/lsalzman/enet.git GIT_TAG v1.3.18)
|
||||
FetchContent_MakeAvailable(enet)
|
||||
target_include_directories(enet PUBLIC ${enet_SOURCE_DIR}/include)
|
||||
|
||||
# --- Shared game core (no graphics) ---------------------------------------------
|
||||
add_library(bs_shared STATIC
|
||||
shared/Appearance.cpp shared/Net.cpp shared/Protocol.cpp shared/Roster.cpp shared/Zone.cpp)
|
||||
target_include_directories(bs_shared PUBLIC shared)
|
||||
target_link_libraries(bs_shared PUBLIC glm::glm nlohmann_json::nlohmann_json enet)
|
||||
target_compile_definitions(bs_shared PUBLIC GLM_FORCE_RADIANS GLM_ENABLE_EXPERIMENTAL
|
||||
BS_ASSET_DIR="${CMAKE_SOURCE_DIR}/assets")
|
||||
if(MSVC)
|
||||
target_compile_options(bs_shared PRIVATE /W4)
|
||||
target_link_libraries(bs_shared PUBLIC ws2_32 winmm)
|
||||
else()
|
||||
target_compile_options(bs_shared PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
||||
endif()
|
||||
|
||||
# --- Server -------------------------------------------------------------------
|
||||
if(BS_BUILD_SERVER)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
file(GLOB BS_SERVER_SOURCES CONFIGURE_DEPENDS server/*.cpp)
|
||||
add_executable(safari_server ${BS_SERVER_SOURCES})
|
||||
target_link_libraries(safari_server PRIVATE bs_shared SQLite::SQLite3 Threads::Threads)
|
||||
if(NOT MSVC)
|
||||
target_compile_options(safari_server PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- Headless test bot (no graphics) ------------------------------------------
|
||||
add_executable(safari_bot bot/main.cpp)
|
||||
target_link_libraries(safari_bot PRIVATE bs_shared)
|
||||
if(NOT MSVC)
|
||||
target_compile_options(safari_bot PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
||||
endif()
|
||||
|
||||
# --- Client -------------------------------------------------------------------
|
||||
if(BS_BUILD_CLIENT)
|
||||
if(NOT EXISTS "${HD2D_ENGINE_DIR}/CMakeLists.txt")
|
||||
FetchContent_Declare(hd2d_engine GIT_REPOSITORY ${HD2D_ENGINE_GIT} GIT_TAG main)
|
||||
FetchContent_GetProperties(hd2d_engine)
|
||||
if(NOT hd2d_engine_POPULATED)
|
||||
FetchContent_Populate(hd2d_engine)
|
||||
endif()
|
||||
set(HD2D_ENGINE_DIR ${hd2d_engine_SOURCE_DIR})
|
||||
endif()
|
||||
set(HD2D_BUILD_DEMO OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(${HD2D_ENGINE_DIR} hd2d)
|
||||
|
||||
file(GLOB BS_CLIENT_SOURCES CONFIGURE_DEPENDS client/*.cpp)
|
||||
add_executable(safari_client ${BS_CLIENT_SOURCES})
|
||||
target_link_libraries(safari_client PRIVATE bs_shared hd2d)
|
||||
if(NOT MSVC)
|
||||
target_compile_options(safari_client PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
||||
endif()
|
||||
# The client launches the dedicated server for "Host game" from its own folder.
|
||||
if(BS_BUILD_SERVER)
|
||||
add_dependencies(safari_client safari_server)
|
||||
endif()
|
||||
endif()
|
||||
Reference in New Issue
Block a user