* refactor(config): replace singleton with dependency injection
* refactor(client_player): return ChunkPosSet by value in non-const getter
Copy the internal set under the mutex lock to avoid exposing a mutable reference that could be used unsafely after the lock is released. This fixes a potential data race when the caller holds the returned reference beyond the critical section. Also update the caller in `client_world` to remove the now-unnecessary `std::move`.
* fix(gameplay): prevent use-after-free in pending delete queues during destruction
* refactor(config): separate game and server configuration with explicit paths
* refactor(render): move render files to subdirectory, add RAII vertex buffer/array classes
* refactor(render): encapsulate OpenGL textures into Texture class
* refactor(texture): encapsulate textures with unique_ptr and bind methods
Replace raw GLuint framebuffer textures with std::unique_ptr<Texture>. Update TextureManager to return const Texture* instead of GLuint. Use Texture::bind() for active texture binding. Add RGBA16F and RGB formats. Add texture parameter methods. Update destructors accordingly.
* refactor(render): use Texture, VertexBuffer, VertexArray classes
* feat(render): add FrameBuffer class to encapsulate framebuffer operations
* refactor(render): extract world rendering into WorldRenderer class
* refactor(render): rename projection and model matrix members for clarity
* chore(render): remove unused matrix members
* fix(texture-manager): correct delet_texture typo and add null checks for textures
* build: add OpenAL dependency
* feat(deps): add dr_libs audio library
* feat(audio): integrate OpenAL audio engine with WAV/MP3/FLAC support
* feat: add bgm001
* feat(audio): add audio fade in/out and fix delta time naming
* fix(audio-source): improve state, volume, and const correctness
* feat(audio): add 3D audio playback with source pool and auto-loading
* feat: add ogg loader
* feat(audio): add footstep sounds and fix audio listener orientation
* feat(sound): add block place and break sounds
* feat(audio): add per-channel volume control and config reload
* fix(audio): set distance model, reduce max distance, fix sound pos
- Set OpenAL distance model to AL_INVERSE_DISTANCE_CLAMPED in engine.
- Reduced AL_MAX_DISTANCE from 100 to 48 for better falloff.
- Fixed block sound position to use world coordinates instead of local block coordinates.
* refactor(game_time): introduce Timer for time-based updates and rename existing to TickTimer
Add a new `Timer` class that operates in seconds (using `TimeType`) alongside the existing `TickTimer` which uses `TickType`. Rename the original `Timer` to `TickTimer` throughout the codebase. Update `ClientWorld` to maintain separate maps for tick-based and time-based timers, and replace the hardcoded footstep timer in `ClientPlayer` with a time-based callback timer. Also add `play_2d` to `AudioEngine` and load an ambient bird sound to demonstrate the new timer functionality.
* feat(gameplay): add ocean wave ambient sounds with random selection
Add four ocean wave FLAC sound files and play one randomly when player is within 10 blocks of sea level and in an ocean biome. Include a Random member initialized from ChunkGenerator seed for consistent randomization.
* feat(gameplay): detect underwater state and play transition/bubble sounds
- Add is_underwater() and set_underwater() to ClientPlayer.
- Change get_world() to return non-const reference for audio access.
- Update Camera::update_move_camera() to detect water block changes and trigger transition sound.
- Add repeating timer in ClientWorld to play random bubble ambient sounds while underwater.
- Include new ambient sound assets for water transitions and bubbles.
- Also add sand walk sound asset (unused in this commit).
* feat(assets): add and update block break/place/walk sounds
Add sounds for dirt, grass_block, leaf, log, sand, snowy_grass_block, stone.
Update existing leaf/walk, sand/place, sand/walk, and stone/place sounds.
* feat(gameplay): add walking sound for players and adjust underwater bubble interval
- Move walk/run sound interval constants from anonymous namespace to ClientPlayer header
- Add moving_time field to PlayerInfo to track continuous movement
- Implement play_walk_sound callback triggered by WALK and RUN gaits
- Increase underwater bubble timer from 1.0s to 1.5s
* feat(asset): add grass block break and place sound effects
* feat(renderer): add --no-debug flag to disable OpenGL debug output
* feat(audio): add day/night-based BGM switching
* feat(audio): add underwater low-pass filter effect
* feat(audio): add pitch control to audio sources
Implement set_pitch method that clamps pitch between 0.0 and 1.0 and applies it via AL_PITCH. Includes minor whitespace cleanup in audio_engine.cpp.
* feat(audio): implement reverb effect and integrate into underwater system
* asset(sound): update dirt and grass block break/place sounds
* feat(network): synchronize player water sound
* fix: include <numbers>
* fix(audio): play ambient water bubble sound in 3D at player position
* refactor(player): extract player rendering into PlayerRenderer class
Move player rendering code from Renderer to new PlayerRenderer class.
Add normal and tangent vertex attributes for improved per-pixel lighting.
* feat(player-renderer): add shadow rendering and include local player data
* feat(gameplay): add player yaw/pitch synchronization and rendering
* refactor(player_renderer): split rendering into per-body-part VAOs and VBOs
Move `PlayerVertex` struct to header and replace single VAO/VBO with arrays of 6 parts. Implement head pitch rotation in `render()` and `shadow_render()` by applying a separate model matrix for the head (index 0). Remove old `vao()` and `sum()` accessors. Adjust model translation for consistency.
* feat(player): add texture mapping to player model using skin
* fix(player-renderer): correct player rendering rotation and texture coordinates
* feat(gameplay): add player gait system with limb animation
* fix(player): update leg UVs and remove yaw wrap
Update left and right leg UV coordinates to align with updated player texture. Remove yaw modulo operation to allow unrestricted yaw rotation beyond 360 degrees.
* feat(camera): add third-person perspective and walk animation
- Introduce Perspective enum (FIRST_PERSON, THIRD_PERSON_BACK, THIRD_PERSON_FRONT) and m_front member for camera direction.
- Handle F5 key to cycle perspectives.
- Add angle and walk_time to ClientPlayer for walking animation.
- Update player rendering to skip local player only in first person and fix rotation sign.
- Remove redundant player info reporting; update player data with animation angle.
* fix(camera): replace magic number with constant and fix missing break
* fix(client-player): stop sprinting on forward key release
* feat: add camera collision and sphere collision for world
* fix(skin): update player001 texture
* refactor(gameplay): improve thread safety and remove debug logging
* refactor(shaders): extract shadow and normal logic into include files and add lighting to player shaders
* chore(shader): remove unused uniforms cameraPos and specularStrength
* fix: inlcude <array> header
* ci(release): use local vcpkg bootstrap and custom release triplet
* refactor(triplets): set arch and linkage explicitly in x64-windows-release
* ci(release-build): remove unused vcpkg overlay triplets
* ci(release-build): add VCPKG_BUILD_TYPE and disable testing
* build: add asio library
* feat(dev_panel): add Asio to about table
* refactor(gameplay): split Chunk into server/client variants and add networking
* feat(gameplay): add Session class and UUID generation utility
* feat(network): integrate protobuf for player sync and session management
Add Protobuf dependency, define proto messages for player requests, positions, and chunk data. Refactor Session to use strand and async write. Implement player join/exit and position sync in ServerWorld.
* refactor(proto): restructure protobuf definitions and update build system
* feat(protocol): add packet serialization and login handling
Introduce packet header and ID mapping for protobuf messages.
Refactor session and server_world to use new packet wrapper.
Fix missing semicolons in proto files.
* refactor(packet): serialize directly into packet buffer with ByteSizeLong
* feat(world): add player-based chunk loading and UUID support
Restructure world generation to trigger chunk loading based on player
movement. Replace player name with UUID for identification. Implement
chunk request/response protocol. Improve thread management for gen
thread.
* feat(server): add block change packet handling and increase reserved threads
* refactor(server): enhance thread safety and session management
* fix(session): catch std::exception in read_loop and log error
* fix(network-server): stop accept loop on shutdown flag
* fix(gameplay): correct unknown error log condition and missing chunk pos update
* feat(client): add client-side chunk, player, world and network classes
* feat(client-chunk): add greedy meshing, receive_chunk, and biome field
* feat(client_player): add name constructor param, remove chunk transition
* feat(gameplay): integrate network client and thread-safe player pos
* feat(gameplay): add block change sync and coordinate utils
* refactor(server): replace Chunk with ServerChunk
* refactor(gameplay): split world into client and server
Remove monolithic World, Player, Chunk classes. Introduce ClientWorld, ServerWorld, ClientPlayer, and related networked components. Add Abseil dependency for logging and checks. Rename old files to pre_remove_* and update all includes and references accordingly.
* feat(gameplay): add time sync and network improvements
* fix: correct neighbor block indexing and add time update support
* feat(gameplay): optimize chunk request with player chunk tracking
Add `update_player_chunk()` method to `ClientPlayer` that triggers a chunk request when the player moves more than 2 chunks away from the last recorded chunk. Introduce an atomic `m_requesting_chunk` flag in `ClientWorld` to prevent concurrent requests. Rename `m_player_chunk_pos` to `m_last_chunk_pos` for clarity.
* refactor(client_world): split pending queue into data and upload queues
* feat(client): add center-based chunk loading priority
* feat(app): add client/server CLI arguments and init guards
* feat(multiplayer): add rendering of other players as colored cubes
* feat(gameplay): add thread pool for asynchronous chunk data processing
* feat(gameplay): add player logout and disconnect handling
* fix(dev_panel): add protobuf to about table libraries
* build: add ZLIB dependency
* refactor(packet): replace zlib with zstd compression and restructure header
Increase header length to 12 bytes, add CompressType and PacketHeader struct, and implement decode_packet_header. Update CMake to find zstd and link against it, adding Findzstd module.
* refactor(network): extract packet header decoding into function
* feat(packet): implement zstd compression and refactor packet decoding
* perf(gameplay): optimize protobuf message allocation with Arena and limit thread pool size
Switch to Arena allocation for protobuf messages to reduce heap allocations. Pass ChunkDataRsp by value to enable move semantics. Cap thread pool size to hardware concurrency with max 4 threads.
* refactor(gameplay): use steady clock and sleep_until for tick loop timing
* refactor(gameplay): rename remote player types and add interpolation
* refactor(server_world): use thread pool for chunk request handling
* refactor(packet): replace if-constexpr chain with explicit template specializations
Refactor `get_packet_id()` by removing the if-constexpr chain and instead
providing explicit specializations for each packet type. This simplifies the
primary template (which now only contains a static assertion) and improves
compile-time dispatch clarity. The `always_false` helper is no longer needed
in the primary template.
* feat(gameplay): add packet to clear all chunks on server rebuild
Add new packet S2C_ClearAllChunks (ID 3005) to notify clients when the server rebuilds its world. Clients respond by clearing their chunk cache and requesting fresh chunks. Shift UPDATE_TIME packet ID to 3006 to accommodate.
* feat(dev_panel): split world tab; add chunk request logging and fix flag reset
* feat(tools): add RecentQueue to replace std::deque in server_world
* feat(gameplay): add task ID to chunk requests to discard stale responses
* refactor(block): move block source to gameplay directory
* feat(toml): add shared TOML utilities and handle ip.toml
* feat: add player name configuration and rename config file
- Add --player command-line argument and 'player' field in Arguments struct
- Rename ip.toml to server.toml and corresponding internal variable to 'server'
- Fix block.cpp source path in CMakeLists.txt
* build(cmake): modularize build configuration
* fix: build fail on windows
* refactor(renderer): rename Logger level enum value DEBUG to L_DEBUG
* refactor(world): rework chunk state machine and player chunk tracking
Introduce ChunkState enum and ChunkEntity struct to manage chunk lifecycle. Store chunks as shared_ptr to avoid move operations during generation. Add clear_unused_chunks to remove chunks not referenced by any player. Implement deferred chunk request queue for safe processing after generation completes. Update player chunk set during required chunk computation. Improve thread safety with mutexes on chunk and player maps. Fix m_gening flag not reset after generation and add assertions for correctness. Change need_gen to require a player UUID, removing std::optional. Add chunk_size query method for debugging.
* fix(server): ensure chunk is ready before sending or setting block
* refactor(server_world): separate gen and net thread pools
Introduce a second thread pool for network operations and a `ThreadPoolKind` enum to distinguish between gen and net pools. Rename `pool_threads()` to `gen_pool_threads()`, add `change_pool_threads()` overload that accepts the pool kind, and update the dev panel to use the gen pool. Adjust logging and initialization to handle both pools.
* feat(client_world): implement server exit acknowledgment with timeout
* feat(gameplay): implement server stop and client exit handling
Add server_stop flag to LogoutRsp protocol. Modify client_world to check for server stop or own logout to set exit flag. Add ServerWorld::stop() to broadcast stop and cleanly shut down. Refactor chunk ownership to unique_ptr. Remove name parameter from get_look_block_pos.
* fix(app): correct port validation and remove redundant TOML helper
* fix: address unused parameter warnings and missing port assignment
* refactor(gameplay): remove old pre_remove chunk, player, and world files
* refactor(server): replace chunk set with flat_hash_set and add ref count
- Replace std::unordered_set with absl::flat_hash_set for chunk position sets.
- Add ref_count field to ChunkEntity and implement update_ref_count().
- Remove clear_unused_chunks() and use ref counting for chunk lifetime.
- Add get_chunk_pos_set() accessors to ServerPlayer.
* fix(client-world): delay chunk request to wait for server central chunk generation
* refactor(gameplay): migrate chunk storage to tbb::concurrent_hash_map
* refactor(server_world): replace future-based chunk generation with queue
Remove `std::future` per-chunk tracking and poll_finished_chunks().
Instead, generation tasks push completed chunks to a concurrent queue
consumed during update. This eliminates wait_all_chunk_tasks() and
simplifies synchronization.
* refactor(client_world): use concurrent data structures for chunk management
Replace std::shared_mutex and std::unordered_set with tbb::concurrent_hash_map for chunk storage, tbb::concurrent_queue for pending uploads, and absl::flat_hash_set for player chunk positions. This improves thread safety and reduces locking overhead. Refactor receive_chunk and request_chunk to work with the new concurrent model.
* build(windows): add Nvidia and AMD GPU high performance exports
* fix(ci): update header file pattern in clang-format check
* style(clang-format): comment out AlignPPAndNotPP option
* chore: enable AlignPPAndNotPP in clang-format and pin clang version in CI
* ci(workflow): update format check to use LLVM 22
* ci(format-check): install clang-format-22
* perf(world): cull distant players from updates and rendering
Add distance2 utility function. On client, skip rendering other players if distance squared exceeds rendering distance. On server, only send player position and block change updates to players in relevant chunks.
* refactor(math_tools): convert free functions to inline in header
* refactor(dev_panel): remove seed editing and server rebuild world, move client rebuild
- Remove text editing for perlin seed and filter function
- Remove ServerWorld::rebuild_world() method and its atomic flag
- Move 'Rebuild World' button to client world tab
- Remove unused perlin_noise_input_buffer
* fix(server_world): floor block position coordinates in handle_block_change
* refactor(gameplay): pass new_chunks vector as parameter instead of member variable
* perf(client): improve chunk rendering performance with snapshots and threaded generation
* feat(tools): add PriorityThreadPool with priority scheduling
Implement PriorityThreadPool supporting task priorities and FIFO ordering for same priority.
Update ClientWorld to use the new pool with explicit priority for chunk operations.
Fix ThreadPool stop logic with atomic exchange and remove unnecessary lambda capture.
* feat(networking): add priority and sequence ordering to packet send queues
* feat(server-world): use priority thread pool for chunk generation
Introduce PriorityThreadPool to process chunk generation tasks with priorities based on their distance from the player. Closer chunks receive higher priority, improving responsiveness.
* refactor(client): extract AABB creation and add collision check on block place
Make ClientPlayer::get_aabb and ClientWorld::get_block_aabb static.
Change player size to static constexpr M_SIZE.
Use shared_mutex for concurrent reads of other players.
Check for collision with other players before placing a block.
* feat(build): add build-time version system via CMake configure_file
* ci(release): add release build workflow for windows
* refactor(gameplay): remove unused includes and members, clear vertex data after upload
* feat(shader-tools): add recursive #include support for shader sources
* refactor(shaders): extract noise and sky color functions into shared GLSL includes
* feat(gameplay): implement greedy meshing for chunk generation
Replace the per-face vertex generation with a greedy meshing algorithm that merges adjacent faces of the same block type into larger quads. Introduce `FaceKey` struct and helper functions (`axis_dir_to_face`, `get_block_safe`, `is_face_culled`, `choose_buf`) to support the new algorithm. Comment out the old `gen_vertices` implementation.
In texture management, rename `m_pbr_texture_array` to `m_normal_texture_array` to reflect its actual usage, and set texture wrap mode to `GL_REPEAT` for both the block and normal texture arrays.
* fix(primitive_data): correct back face texture coordinates and tangents
* fix(texture-manager): correct texture deletion and refactor reload
Make hot_reload private and add public need_reload method. Update UI to call need_reload instead of hot_reload. Fix incorrect use of glDeleteBuffers for normal texture array by using glDeleteTextures.
* refactor(chunk): add ChunkInfo and switch to shared_mutex for chunk access
Introduced ChunkInfo struct to expose chunk metadata (position, seed, biome). Replaced std::mutex with std::shared_mutex for chunk map to allow concurrent read access. Added World::get_chunk_info() method. Temporarily disabled cave/river cleanup and debug biome reporting.
* refactor(cave,river,chunk): use ChunkPos as key for paths and track cave existence
* refactor(gameplay): use deterministic origin-based cave and river generation
Compute cave and river paths on-the-fly per chunk from a deterministic origin instead of storing them globally. Remove concurrent hash map storage, shared mutexes, and related cleanup methods. This simplifies concurrency and reduces memory overhead.
* refactor(world): remove unused chunk generation progress tracking
* feat(renderer): add fog effect based on render distance
* refactor(gameplay): remove dead code and simplify chunk neighbor context
Remove the large commented-out `init_chunks()` function, and eliminate the `affected_neighbor` tracking in `gen_chunks_internal()`. This simplifies the neighbor context building and removes unused vertex data regeneration for affected neighbors.
* refactor(gameplay): move chunk generation phases into gen_chunk method
Consolidate multiple phase generation calls into a single gen_chunk() method on Chunk, which handles neighbor generation and ensures thread safety. Simplify World::gen_chunks_internal by using gen_chunk() instead of manual phase orchestration.
* fix(gameplay): use gen_phase_one to get seed
* feat(world): integrate thread pool and async chunk generation
* fix(renderer): correct shader uniform name and remove unused uniform
* feat(gameplay): add temporary chunk flag to prevent path clearing
* fix: add thread safety for cave and river path mutexes
* refactor: remove unused uniforms and set cameraPos uniform outside lambda
* feat(world): add dynamic thread pool resizing
* feat(world): add thread pool size management and UI controls
* feat(world): add ChunkLoadStyle enum and rename chunk_pos to get_chunk_pos
* feat(player): add configurable fly Y speed
* refactor(world): add thread pool start/stop and auto-detect threads
Extract thread pool starting and stopping into dedicated methods. Set default pool threads to 0 to enable automatic detection of available cores, and ensure thread pool is properly managed during world rebuild.
* fix: include shared_mutex header
* fix(gameplay): simplify set_chunk_load_style switch and fix fallthrough bug
* fix(world): add missing include for <utility>
* feat(shaders): add lighting to block accumulation OIT shaders
* feat(renderer): add water rendering with OIT and new shaders
* feat(water): implement screen-space reflection and refraction for water with depth fade and perturbation
* refactor(shader): replace glUniform calls with generic set_loc and remove cached locations
* feat(water): add noise-based caustics and configurable fog density
* fix(water shader): update depth fade and remove underwater check
- Increase DEPTH_FADE_DISTANCE from 8 to 10
- Remove conditional so depth fade always applies
- Darken deepColor from (0, 0.08, 0.15) to (0, 0.015, 0.045)
* feat(underwater): add volume scattering and shadow mapping for light shafts
* feat(rendering): add basic diffuse and ambient lighting to block rendering
* feat(world): add day/night cycle with server tick system
* feat(renderer): make ambient strength adjustable via dev panel
* fix(game_time): use unsigned tick type and enforce positive tick speed
* feat(renderer): add shadow mapping with PCF soft shadows
Introduce shadow mapping using a dedicated depth framebuffer and shader. The block fragment shader now performs percentage-closer filtering (PCF) with Poisson disk sampling and random rotation for soft shadows. The vertex shader outputs light-space coordinates. A new depth shader pair handles rendering from the light's perspective, discarding transparent fragments. The renderer sets up the light projection based on the camera position and sun direction, and applies the shadow factor to diffuse lighting. Day/night cycle can now be toggled off in the world server thread.
* perf(shadow): increase depth map resolution and refine PCF sampling
* feat(dev-panel): add tick freeze toggle and fix TickType sign
Add checkbox to freeze tick advancement in dev panel.
Change TickType from unsigned long long to signed long long to prevent underflow.
* chore(world): add missing <numbers> include
* feat(renderer): add runtime shader and shadow mode controls
Introduce user-controllable shader on/off, shadow mode (rotated Poisson disk, 3x3 grid, or off), light cull face, and discard transparent in depth pass. Expose all settings in new dev panel "shader" tab. Move ambient strength slider to the new tab.
* fix(texture): set texture wrap mode to clamp to edge
* feat(renderer): smooth shadow sun direction transitions using quantized directions and slerp
* feat(renderer): add PCSS shadow mode with configurable samples and softness
Implement Percentage Closer Soft Shadows (PCSS) as shadow mode 3.
Add a FindBlocker function and three Poisson disk arrays (8, 16, 32 samples).
Expose new uniforms (lightSizeUV, minRadius, maxRadius, samples) and provide
slider/combo controls in the dev panel for sample count, light size, and penumbra radius limits.
* feat(renderer): add roughness-based specular lighting to blocks
* feat(renderer): compute ambient and sunlight colors based on sun height
* feat(renderer): add moonlight and smooth day/night light blending
* refactor(renderer): extract day/night calculation and add billboard shaders
Add a new ParallelLight struct to encapsulate lighting parameters.
Move day-night cycle computation from render_world() to a new
day_night_calculation() method. Update sky shaders to use procedural
colors based on sun position. Add separate billboard shaders for sun/moon.
* feat(sky): add animated clouds to sky shader with speed control
* feat(renderer): add configurable cloud thresholds and white mix
* refactor: use TBB for concurrent hash maps and parallelize chunk processing
* fix: tbb link fail
* refactor(chunk): remove biome check for caves in rivers and oceans
* refactor(random): replace std distributions with custom implementations
Avoid overhead and platform-dependent behavior of `<random>` distributions by using direct engine operations and integer arithmetic. This ensures deterministic, cross-platform results and improves performance.
* refactor(generation): use chunk seed for cave and river paths
- Use per-chunk seed instead of global path_id for cave and river generation.
- Remove unused m_sum variables and m_path_id members.
- Clamp river yaw within 10 degrees of initial direction.
- Fix river radius interpolation (use t instead of 1-t).
- Lower sea level from 64 to 63.
* feat(gameplay): add Ocean biome with water generation and heightmap adjustments
- Introduce Ocean biome enum, builder, and detection logic.
- Add ocean water building to all existing biomes and modify heightmap thresholds for low mountainous areas.
- Skip cave and river generation in Ocean (and River) biomes; avoid carving water blocks.
- Comment out border blending call and update block fill logic.
* fix(gameplay): re-enable border blending and protect water in cave gen
* refactor(generation): move ocean water build to later phase
* feat(block): add is_transitional property and refine border blending
* fix(block): set stone block as transitional
* fix(world): generate temporary chunks for surface blend neighbor data
* fix(gameplay): simplify block fill logic in blend_surface_blocks_borders
* refactor(tree): remove debug logging and unused include
* refactor(renderer): centralize VAO setup and rename init_underwater
* refactor(gameplay): replace VBO with VAO for vertex data
* fix(renderer): move depth test enable to world rendering
The `glEnable(GL_DEPTH_TEST)` call was incorrectly placed in the general `render()` function, affecting UI and text rendering. Moved it to the start of the world rendering loop to ensure depth testing is only active during 3D world pass.
* refactor: update water texture
* feat(gameplay): implement transparent block rendering with depth sorting
* fix(world): use camera pos for distance calculations, make water passable
* refactor(player): use ivec3 for block pass check
* feat(camera): add underwater detection
* feat(renderer): add underwater effect with framebuffer post-processing
* feat(block): add gas property and refactor solid block check
* fix(assets): set leaf block transparency to false
* fix(block): set leaf as transparent
* feat: add grass texture and update grass_block texture
* feat: add block data
* feat: add blocks_tool
* feat: add sync info and change function in blocks_tools
* feat: add check and new function
* refactor: make block texture loading data-driven
* feat: add rendering for grass
* feat: passable grass
* feat: random grass place
* fix: memory leak in TextureManager::load_cross_plane_texture