I had previously coded up a bunch of library code for my roguelike game engine. My first idea was to hold all items in a big array. When the items were picked up and them wielded, the item state would change. Then I had a bunch of custom code that switched on the state.
The problem was that most items get removed and regenerated during change of dungeon level. I did not want my players inventory and equipment to disappear when the dungeon level changed. So I needed a refactoring. I decided to create separate containers for the player inventory and the player equipment. Today I refactored all the code to use this new design.
I was pleased to see that much code was simplified. Many functions were no longer even needed. The code was getting really clean. This must mean the redesign was a move in the positive direction. This shall also allow easy changes of inventory/equipment rules in the future.
Not sure what I am going to do next. I am still riding a high of a good code refactoring. It is probably time to implement some more functionality in the dungeon.
Mysterious Double Instance Hampering Performance - I study the existing code base. Confer with a colleague. Then I determine the optimal plan to change the functionality to load only a slice of all the dat...
4 days ago