Skip to content

Refactoring of game logic - #11

Merged
vimpop merged 24 commits into
mainfrom
refactor_game_logic
Aug 16, 2026
Merged

Refactoring of game logic#11
vimpop merged 24 commits into
mainfrom
refactor_game_logic

Conversation

@vimpop

@vimpop vimpop commented May 8, 2026

Copy link
Copy Markdown
Owner

Currently, the source code is a mess and the feature set is quite minimal.
But since socket IO is proven to be relatively stable, the following feature set can now be implemented with the following milestones:

  • Update to 26.1.2
  • Packet compression using zlib
    • Outbound packet compression. Inbound decompression is not implemented.
  • Socketio improvements in terms of packet creation
    • Ability to send prefixed arrays
    • Packet queue for slower connections
  • Reduce RAM footprints (mbedtls)
  • Refactor CMake integration
  • Server side time handling
  • Inventory management
  • Crafting
  • Block interactions
    • Basic block actions
    • [ TBD] Furnaces
    • [ TBD] Chests
  • Procedural world generation
    • Infinite chunk generation
    • Terrain generation
    • Cave generation
  • Update README that reflects this major refactor

- Existing game logic has been removed and chunk generation is placed inside game.c
- This change add the ability to  send prefixed buffers (length sent as a varint)
- Procedural terrain generation is still missing in this commit but will be used as a starting point
- close the https connection when the data is received
- only get the auth ip once during the lifetime of the application
- Surface layer is added
- Cave layer is added
- Maximum of 3 sections are sent depending on the Y value {this is currently garbage }
- Perlin noise library is intoduced
@vimpop
vimpop marked this pull request as draft May 8, 2026 17:08
@vimpop
vimpop force-pushed the refactor_game_logic branch 2 times, most recently from 187de44 to 573c61f Compare May 8, 2026 17:26
vimpop added 9 commits May 8, 2026 19:43
- socketio now sends compressed packets
NOTE: Inbound packets are not decompressed yet!
- moved chunk section to 3 to 7
- change spawn point to 0,26,0
- removed 2d hashing world seed function
- utils are removed because they are very outdated and no longer serve any purpose
- The file is refactored so it can obtain the palette through a helper function instead of hardcoding it.
- Removed local definitions of the heightmaps and just put them on the bss for simplicity
- worldGetBlock function is introduced which returns the block from the terrain with the given coordinates.
NOTE: This is not cached yet and will regen the heightmap per call
@vimpop
vimpop force-pushed the refactor_game_logic branch from 573c61f to 8c3fbcc Compare May 8, 2026 17:45
vimpop added 4 commits May 14, 2026 23:53
- socketio is also fixed for the values returning incorrectly
- Inventory storage mechanism is introduced and item enums are added.
- Core logic inside game.c is also updated for both Block interactions and inventory mangement
- inventory crafting
- crafting table implementation
- recipes added
- socketio: introduce formatted strings
- Tick time is set to 9000 (was lower) to prevent disconnections
- mojangs api does not return content length anymore so \r\n\r\n  is used to check the end of data
@vimpop
vimpop force-pushed the refactor_game_logic branch 2 times, most recently from d7855b3 to 9f6b81e Compare July 28, 2026 00:08
@vimpop
vimpop force-pushed the refactor_game_logic branch from cc34c35 to a3c2ec3 Compare August 16, 2026 01:03
@vimpop
vimpop marked this pull request as ready for review August 16, 2026 01:06
@vimpop
vimpop merged commit cd8d5df into main Aug 16, 2026
4 checks passed
@vimpop
vimpop deleted the refactor_game_logic branch August 17, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant