.O.
..O Deniz's personal pages
OOO
/home /about

Epic4x: Devlog #3

February 26, 2017

What’s a planet surface without any buildings? A vast empty space. Buildings will allow the settlers on a planet to produce different resources on tiles. Buildings come in various forms: farms, research centers, power plants, etc. Each tile can have a building of any type that will produce the according resource. A building on a tile without a population will not produce anything and a building will suppress any non matching resources. So if you have a tile with food resource and decide to build a research center on it, then say good bye to the food. Building cost minerals to build and energy to maintain. The output and cost and maintanence cost of building depends on its level.

With these requirements in mind I set of to implement these features. Each buildings cost, maintenance, and building time are kept in source code as a map of type → value. Holding these in the DB or configuration file didn’t seem worth the trouble as these parameters will be fixed and not change for different games. The costs will increase with each level for the building but this will be calculated on the fly so I’m just storing the level 1 costs. Maintenance cost and time to complete the building are stored in the database for each instance of a building as they will change as the game progresses.

As I was working on the building features I realized that the only consumption on a planet is food and energy. I had written the methods that calculate consumption in a generic way to support querying any type of resource consumption so I simplified that to only food and energy. I also realized that I had skipped increasing the player resources by the income amount so I added that too. I would be bad if you saw +3 energy income but you were’nt able to accumulate it. The relations between entities are slowly getting upto a point where it’s beginning to get confusing and changes are beginning to affect a few places at once. I might start writing down stories and use cases first instead of just tracking them mentally which will have a negative impact on speed. I’m also trying to keep good test coverage going as these types of changes are very likely to bring up regressive errors.

Tags: #gamedev #epic4x #devlog