I am building a library to help with the development of a roguelike game. Got the maze generation down pat. Next I added items such as weapon and armor to the maze. I implemented these items in a big array. The items knew where they started out in the dungeon.
As the player picks up and wields the items, the items change their location. This was working like a champ. Then I realized the items were tied to the dungeon. The dungeon gets regenerated on each level as the player walks up and down the stairs. Ooops.
I don't want the players to lose the items in their inventory or on their body when they navigate the dunegon levels. What I should have done is to separately manage the dungeon objects and the player inventory/equipment. Then I could move the items from each of these containers as the player picks up or discards the items.
This design change will require some refactoring. While I am at it, I might as well change the containers from arrays to lists. That will make the adding and removing a whole lot easier.
Reproducing a Race Condition
-
We have a job at work that runs every Wednesday night. All of a sudden, it
aborted the last 2 weeks. This caused some critical data to be late. The
main ...
2 years ago