relee: Picture of Relee Starbreeze, Wizard (Default)
Relee Squirrel ([personal profile] relee) wrote2021-05-16 06:33 pm

Work Post

6:34pm - Well I've spent quite a bit of spare time the last few days trying to figure out a bit more of how the GoRogue library works 'under the hood' and I think I've figured out the key difference to it, as well as figuring out that it can actually modify terrain mid-game.

The key difference from what I've been doing and what GoRogue does is that I was keeping a list of entities like actors and items, while GoRogue uses something called a SpatialList.

7:05pm - Bleh. Got bigtime distracted in the middle of what I was writing.

So, a SpatialList is primarily based on two dictionaries, called _itemMapping and _positionMapping. _itemMapping is a dictionary where the item is the key, and the position of that item is the data. _positionMapping is a dictionary where the position is the key, and the item, or a list of items (depending on the type of spatialmap) is the data. So, you can find out what's at a location using the _positionMapping, or you can find out where an item is using the _itemMapping.

This seems like a good method to track the location of objects in the world, compared to a flat list.

Anyways I just wanted to get that recorded somewhere. I don't think I feel like working more tonight.