Still Alive Saturday #26: Spelunkin’

Hey everyone!

It’s going to be a bit of a short update this week, not because we didn’t get much done but because there isn’t a whole lot to show just yet.

Both Justin and Avash are away on vacation presently, leaving little ol’ me all by myself to work. I made some good progress on cave generation, mostly in terms of item placement, chunk sizing and enemy locating.

More exciting than that, in my opinion, is the revised item/enemy hierarchy I implemented this week. We discovered this particular design from a game design blog that I’ll link at the end of this post. It’s very interesting, and I’ll explain it briefly so that you understand how I plan to use it.

 

The hierarchical system for both enemies and items works in a very similar manner, but I’ll use items to explain for the time being. The item hierarchy allows us to specify, with as little or as much specificity as desired, what item to give to the player in a certain situation. For example, when opening a chest in a certain type of cave, we may decide that players should only get a weapon, but we don’t want to specify precisely what weapon we want to give them because we want it to be a surprise, even to us. Alternatively, perhaps we’re generating items for a shop and want to pick from all available character equips. This system allows for both of these scenarios and more.

The way the hierarchy works, in brief, is this:

1. We begin with a root node. The children to this root node are the widest possible categories for items that we want. In this situation, my categories are “Equips”, “Ship Equips”, “Consumables” and “Miscellaneous”. I can add more later if  I want, but those are my categories at the moment.

2. We add sub-categories under each category based on how we want to structure our hierarchy. For this example, under Equips I have “Head”, “Body”, “Trinket” and “Weapon”.

3. Under each of these sub-categories, I add a list of items that exist under that category. These are keyed by item name, so for example: “IronHelmet”.

 

When I want to retrieve an item from the hierarchy, I can specify any node that I like. I could specify “IronHelmet” and it would only ever retrieve that specific item. Alternatively, I could specify “Equips” and it would give me anything that exists under that node, at random.

There are a couple additional aspects of this design that help add to the variety and usefulness. The first of these is the ability to backtrack up the hierarchy, if desired. For example, if I want my cave chest to give weapons 90% of the time, but give an equip at random 10% of the time, I can specify that the hierarchy should be able to backtrack. The hierarchy may then step up one node to “Equips” and then choose randomly from there.

The second special thing is to be able to assign a rarity value to each item node. When calling for an item to be generated, we can specify a rarity, and only items below that rarity level will be generated. This allows us to be sure that we aren’t giving the player something too powerful too early in the game.

If you’re interested, here’s the link to the blog that we stole the design from http://journal.stuffwithstuff.com/2014/07/05/dropping-loot/

 

That’s all I’ve got to share this week! Hopefully the slightly more technical/design-heavy update was interesting for you all. See you next Saturday.

Chris

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s