Bytesize Adventures
Crafting bite-sized digital worlds

Weekly Update #2 – Inventory

Another week has passed so its time for the second of my weekly development updates.

This week the vast majority of my time has been spent getting a basic inventory system up and running and interacting correctly with the game world and level parsing. Visually its the ugliest thing ever but that’s because I’ve made the conscious decision to focus on the core programming first.

Anyway, as part of my promise to share an image in each of these updates, you too can share in it’s ugliness. It’s always difficult to know whether to share this sort of stuff because you don’t want to put people off. Anyway, I expect most of my readers are programmers anyway.

This is literally week 2 of development so you’re seeing stuff in its totally raw form.

The work on the inventory system has mostly been methods for adding and removing items and for returning current quantities.

-(void)addTilesToInventory:(NSDictionary *)tileDictionary;
-(void)addTileToInventory:(NSString *)tileToAdd withQuantity:(NSNumber *)quantity;
-(void)removeTilesFromInventory:(NSDictionary *)tileDictionary;
-(void)removeTileFromInventory:(NSString *)tileToRemove withQuantity:(NSNumber *)quantity;

The methods above are for adding and removing items from the Inventory. In their basic form they take an NSDictionary as input, containing item type -> quantity to add. I also have convenience methods for adding/removing a single item (without the need for an NSDictionary).

To highlight some situations where I’d use one over the other. When the player finds loot, I’ll often want to give them multiple items. Likewise, i’ll do the same when parsing initial data from the level.

When using an item from the inventory, you’ll only use a single item.

Sounds simple but in reality its actually pretty tricky to get right.

Elsewhere, my level data is taking shape. I can now parse a plist to generate a level, select the tileset, and populate the inventory (where required). This is important because its serves as the output for my level editing tools.

The game itself is rather basic at this stage. I still have lots of game design decisions to make. The core mechanic works but really needs some more thought and I only have vague ideas about how I’m going to stitch in the RPG elements. I think that I really need the ability to build levels quickly and test them during this phase of figuring things out. That’s why I’m focussing on level data and tools so early on.

This is the stage in development where theres heaps to do and success comes easy. Work is fairly erratic because I can flit between various tasks and challenges. Later on things will really slow down but equally it will look more like a game.

Next week I’ll begin working on a first pass at some of the graphics as well as hopefully dipping into creating my level editor (which will be built in HTML5 and Javascript).

See you next week.