Skip to content

ImGui, multi-threaded chunk generation, and code cleanup.

Latest
Compare
Choose a tag to compare
@serg06 serg06 released this 02 Jul 01:26
· 16 commits to master since this release

New features:

  • There's a main menu.
  • There's an ESC menu (press ESC in game.)
  • Chunk generation happens on a separate thread so the game should feel a lot smoother.

Controls:

  • F11 fullscreen
  • R toggle mouse raw input
  • T toggle t-junction fixing
  • Mouse look around
  • WASD move around
  • Shift/space move up/down
  • ESC open main menu
  • N toggle noclip
  • P cycle polygon mode
  • [+ or numpad+] (press once or hold) increase render distance
  • [- or numpad-] (press once or hold) decrease render distance (without unloading existing chunks)
  • C toggle face culling
  • Left-click destroy block
  • Right-click place flowing water
  • F3 enable debug overlay
  • Scroll change block type (active block type visible in debug menu)

Technical details:

  • Used ImGui for my GUI.
  • Replaced my custom text-rendering shaders with ImGui.
  • All zmq messages are now sent across a single message bus.
    • Pros:
      • Much simpler code. Every class gets a single BusNode object that they send/receives all messages through.
    • Cons:
      • If a thread can't keep up and their incoming message queue overflows, they'll lose some messages.
      • Have to manually make sure any pointers I send are received, dereferenced, and deleted by exactly one thread.
      • Takes up a lot of RAM - I had to give all sockets huge incoming/outgoing message queues so that they don't miss any messages.
  • Ton of code cleanup
    • Moved all .h code into .cpp
    • Split complex classes into multiple ones
      • Focused on splitting away the rendering from the world data
    • Replaced a ton of C-style pointers with std::shared_ptr

What's next:

  • Perlin worms for cave generation
  • Separating the code more (I'd like to handle all GUI-related rendering in a separate class)
  • Pause world when in ESC menu
  • Importing and parsing Minecraft's model/texture files so that I can render all their assets without much repetitive manual work.