Skip to content

Conversation

@Volte6
Copy link
Member

@Volte6 Volte6 commented May 3, 2025

Description

The goal of this PR is to split Room data files into two save forms:

  1. The "Template", saved in _datafiles/world/{worldname}/rooms/ which is just the normal, empty state room definition. This is how the room should be loaded into the memory the first time it is ever encountered. Items shouldn't be on the floor (unless it is desired to start with an item on the floor), gold, containers, etc. are all in their initial state.
  2. The "Instance", saved in _datafiles/world/{worldname}/rooms.instances/ which is everything (or most things) that have changed about the room and are worth saving in case the room gets unloaded from memory.

Changes

  • Updated room "Template" data files to remove random objects that were saved and committed into rooms in the past.
  • Instance loading/saving and Template loading/saving are distinct operations with different purposes, and code functions etc. have been created to handle them.
    • Developers should generally not have to interface with these, they are for precise modification to specific data when needed, such as in admin commands. The rooms.LoadRoom() function remains the primary way to load room data.
  • Fixed some inefficiencies with room filenames, should have been caching but wasn't.
  • Added a makefile target to delete all instance data for purposes of testing.
  • Added an event and handler to rebuild mapper data.
  • Fixed a lot of messy/poorly named functions and variables to try and make clearer
  • Added lots of code comments for whatever poor soul must revisit this process.
  • Moved room save/load functions to own file in package folder.
  • Updated admin build command to modify template data.
  • Updated admin room command to modify template data.

@Volte6 Volte6 merged commit 12930d4 into master May 3, 2025
2 checks passed
@Volte6 Volte6 deleted the room-instances branch May 3, 2025 03:33
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.

2 participants