Skip to content

0.5.0

Choose a tag to compare

@Placerr Placerr released this 04 Jun 02:42
· 9 commits to main since this release
b8eb35a

Plasocket 0.5.0 - The World Persistence Update

This release introduces significant enhancements to world management, including persistent world saving, block modification settings, and a more robust server architecture.

New Features

  • Persistent World Saving & Loading:
    • The server now automatically saves the world grid to worlds/world.pw at a configurable interval (world_save_interval_s in server.conf).
    • World data is loaded from worlds/world.pw on startup. If the file doesn't exist, a default world (grass, dirt, stone layers) is automatically generated.
    • World data is saved using an RLE (Run-Length Encoding) JSON format, making the world files more efficient.
    • A final world save is performed gracefully when the server is shut down (e.g., via Ctrl+C).
  • Configurable Block Modification (Read-Only Mode):
    • A new block_modification option in server.conf (defaulting to false) allows administrators to control whether clients can modify the world.
    • When block_modification is false (read-only mode), client-side PLACE and ERASE actions are immediately reverted by the server, providing a read-only experience.
  • Enhanced World Data Handling:
    • The server now maintains an in-memory WORLD_GRID to represent the game world, allowing for efficient block updates and persistent storage.
    • RLE encoding/decoding functions (rle_encode, rle_decode) have been implemented for efficient world data transmission and storage.
  • Improved Dependency Management:
    • The check_and_install_dependencies function is now called at the very beginning of main to ensure all necessary modules (like websockets and configparser) are available before the server attempts to use them.
    • The dependency check now forces a server restart if packages are installed, ensuring they are loaded correctly.
  • Refined Configuration Handling:
    • The server.conf file now automatically includes any missing default configuration options when loaded, ensuring the configuration is always up-to-date with new server features without requiring manual edits.
    • More robust error handling for reading the server.conf file.
  • Internal API & Code Improvements:
    • The ServerAPI class passed to plugins now includes a reference to the websockets module itself, allowing plugins more flexibility.
    • Refactored main function to separate setup and asyncio.run more cleanly.
    • Improved logging for block modifications and read-only mode actions.
    • Centralized global variables for better state management.
    • The server version is now exposed as SERVER_VERSION = "0.5.0".