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

Epic4x: Devlog #9

March 8, 2017

Posted on March 8, 2017 by dendiz Populations on planets have emotions you know, there are not robots. You can’t expect them to work with 100% efficiency! That’s what the happiness factor in populations are for. I already put what affects happiness how in the wiki but I got to actually implementing them. So the happiness is a value from 0 to 1.0 that is a multiplier for the resources on the a tile. It stars out at 0.5, so if a new popuation is on a tile with 2 energy output and happiness is 0.5 they will produce 1 energy per turn. The happiness may increase depending on circumstance but it will never exceed the habitability multiplier of the planet.

In other news, I started working on ship and fleet management. I need a good ship command system design that is flexible as there are many command with different parameters. I’m thinking of linking the components on a ship with commands that make sense for that component, e.g an engine component is linked to a move command that takes from planet and to planet as parameters. I need to come up with a good interface for supporting different types of parameters though, like an FTL command would take stars as parameters and not planets. An attack command may take a target ship etc. There are also some “meta-command” like survey system would actually create N sub-commands of move to planet X then survey planet X then move to planey Y… you get the idea. Also maybe a counter on these commands would be required that is pre-calculated and has the duration of this command. If surveying a planet takes 5 turn, then that command will be on the top of the command queue for 5 turns then the next command will start processing. Maybe a looping of a commad series could be useful too, for example if you wish to patrol between a few star system you could create a command queue like FTL to system A, FTL to B, FTL to C and start over. I recall Aurora 4x had a similar command interface.

While thinking about this stuff I realized that the ships had an engine component which was for travelling between planets, but planets didn’t have coordinates therefore the distance between them is not known. I added coordinate generation for planet in a system using a simple polar coordinate generation with the simple formula of:

Average distance = galaxy density / number of planets in the system

For every new planet the distance is:

avg distance + # of planets created * avg distance +/- avg distance / 3

A random angle alfa Then calculate planet x,y using simlpe trigonometry. After plotting the planets on a map it occured to me that there were systems with a single planet which looks weird so I changed the planet distribution settings. This of course meant that the tests were screwed up again so I had to relax the assertions on some tests. After getting this out of the way I will concentrate again on the ship command systems.

Tags: #gamedev #epic4x #devlog