Skip to content

Room instances #363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 3, 2025
Merged

Room instances #363

merged 5 commits into from
May 3, 2025

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.

1 participant