Hey everyone. Its time for an update. For my excuse, we are very busy right now to get the main game mechanics done. Yes, you read right, I hired one of the former programmers of Endciv again and he will help me for at least half a year from now on.
Also he is a good programmer and not the reason why everything was so broken last time.
For task management I moved over to HacknPlan, I recommend that for other developers. It has all the basics of Jira while not being so complex.
We implemented a few basics like the save game system, player configuration and the inventory system. The latter one took some more time but will never annoy us again, it works great. In fact it is very similar to the previous one but all the pitfalls were removed.
Production System
The current goal is to get the whole production loop in place, today we implemented the basic system. But in order to get that far I spend a lot of hours simply on writing that system down. It might sound straight forward but there are many tiny details that have to be covered.
One of those things is logistics. I wanted a system that is not too simple because that can lead to inefficiency and illogical behavior. On the other hand, a too complex system takes more time and planning and is prone to issues. The system I came up with I think is a great foundation.
One uniqueness of Endciv compared to most other games might be that we have multiple production facilities which can produce a number of different goods. Also one facility will be able to produce more than one of those at once e.g. by having space for one or more workers. I call that production lines.
The player will now mainly tell on a global level how many resources should be produced at any time. So you can define that 20 tools should be in stock all the time, if that is not the case then it will be produced. In addition, you can always add specific tasks like produce 10 mechanical parts and prioritize all tasks and resources.
One critical point was how to actually manage that.
First point was how to tell which resources to produce. I believe that if you have 60/70 of product A but 2/40 of product B then B should be prioritized. I came up with a formula that does that, but of course it requires some balancing. But here it is:
Comparing priority = priority * (batchesLeft / MaxAmount)^activeLines
What it basically does is that if no facility is producing a resource then base priority is taken for comparison. Then the more facilities produce that same resource the less likely it is to be taken by another facility.
Another issue connected to that was how to manage logistics to provide the right amount of resources. A production facility ideally runs all the time and gets provided with resources. On the other hand, one facility should not take all the resources that would then not be available for another facility. To solve that we divide those tasks in batches which will be increased before the facility runs out of resources. That way two facilities can easily produce either the same resource or different ones at once.
About Programming
The whole coding rebuild turns out to be great. The Entity-Component pattern is a great relief. It never was that easy to implement independent modules like debug and cheat codes so easily.
Without going too much into detail (let me know if I should) having a System that uses static methods for all the major game logic makes it very easy to implement modules like this.
From each space in code I can simply call InventorySystem.AddResources(inventory, resources) for example. Before you protest, this is not a Singleton pattern. All those methods simply perform logic based on the parameters. The alternative might be calling inventory.AddResources(resources) but that would include logic in the model classes. Some of those methods do require an initialized system but we make sure that there is no Entity before there is the according system.
Again, if you are interested in those kind of things, let me know and I will focus on those things more often.
[ 2018-04-05 22:25:44 CET ] [ Original post ]