Small Gods – Resource Storage

This wasn’t as hard to implement as I was expecting it to be, to tell the truth.

Basically, all I’ve done is set it up so that the AI produce goods while working and if they fill their inventory with said goods they’ll go to the nearest storage depot with space and dump their goods there. The actual implementation of it is sort spaghettified and I’m sure that there’s a better way of doing it, but it works!

I’m not sure how I’ll end up implementing the whole resource system in the final version of the game, however. Right now it’s taking a similar form to that of the resource and storage system in Black and White where storehouses have a cap on the number of each type of resource they can store and so when a storehouse is full you need to build a new one. however, I may change it to be more akin to a traditional RTS resource system where collected resources are transported to a location that teleports it into a magical place where it’s accessible to all-comers.

Both methods have plusses and minuses. In the case of the Black and White-style system, I’ll need to do some fancier programming just to stop null returns from happening but it’s more realistic as people will walk to their nearest storehouse for food and building materials, and makes city-planning that much more important to the player as you’ll need lots of storehouses in locations that AI can reach in a timely manner.

For the RTS style system, it’s easier for me to implement, means that players don’t have to be constantly aware of their available resources, means that AI don’t need to waste time walking to storehouses to get food and materials, and can still have a decent effect on city-planning depending on how I implement it.

I’ll need to think more about what I want later but for now, I’ll continue working with the Black and White-system as it works fine, operates somewhat realistic, and Black and White is an inspiration of mine anyway (though I don’t want to copy it too closely).

In any case, like the methods to find homes and workplaces the method to find the nearest storage site is still bugged wherein failure to find a suitable location to store materials results in null values being returned. So I’ll need to fix it…… later. Programming is fun like that.

 

Advertisements

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