Day 21: Inventory screen.
Posted by Plaidman on April 28th, 2010
Nothing super interesting to write about last week.
Mostly just a lot of moving around data to support adding new screens into the game. Specifically a screen for inventory management and a screen to view Red’s status. The data storage needed to be relocated because opening a new screen requires that the game drawing thread be terminated, and since the game state data is stored in the game drawing thread, that would be terminated along with it.
To prevent this, I needed to decide whether to write all game state data into the save file, like you were quitting the game, or remove the data from the game drawing thread, then fix everything that breaks as a result. Saving the data to a file takes too much time and resources when we want to seamlessly switch to a new screen, so I went for the latter option.
Some other updates include:
- Projectile weapon charge tracking for the three types of projectile weapons mentioned in the post for Day 16.
- Player menu is dynamic based on whether or not you’re on stairs (to ascend and descend) or if you have a projectile availabile.
- Saved game versioning, so when I make an update the game doesn’t crash when I try to load an old version of the save file.
- Added inventory items into the save and load game routines.
Today and this weekend I’ll be writing up a random dungeon generator. Perhaps I’ll even have a full day to work on it between now and when I finish. I think I’m going to cut out some extra-curricular activities next week so I can put some solid blocks of time into the game. Chipping away at my todo list for only an hour every day isn’t cutting it anymore.
Current demo:
Red can change gear, drink potions, and read scrolls. Gear includes weapon slots for projectile and melee weapons, an armor slot that reduces damage, and two ring slots which can give various effects.