First “playthrough”

As the game can now technically be played from start to finish, let’s do that. Of course there are a lot of features missing but let’s not mind that. I’m quite happy to be at this point now. I started about a year ago and one goal has been to get the game into this state before the end of this year. So now I can just relax for the rest of the year, right?

Warmongering AI civilizations

Finally I can show some results of the work I have done in the last weeks with the enemy AI in the star map view. The AI now positions its fleets to defend against enemies and launches attacks in suitable situations. There also is an automatic combat resolver which approximates the result of a combat and the combats between AI civilizations are resolved using that. It is still a very crude approximation and has to be improved later. There is no peace or any other diplomacy yet, so the AIs are in constant war with each other. The results of this are quite violent but funny to watch.

Food, growth and expanding AI

I decided to explain a bit how the food and growth system on the planets work. This includes the food transporting system which was done already many months ago but I haven’t explained it yet. Also in the end of the video you can see how the AI expands in the map. It tries to take the best planets first, depending on the situation.

In short, each planet has multipliers on how much food, minerals and research the planet  produces. Each unit of population also eats one unit of food each turn. Planets can also transport food to other planets. It would be a laborious task for the player to set these food transport routes manually and check if they are profitable, so that is done automatically. The player just has to set what is the desired food amount on each planet and the rest is optimized automatically.

Strategy AI and choke points

I finally started working with the strategy map AI. I want the AI to be smart so it can match the human player on harder difficulty levels. So I think it is important that the AI can for example use the surroundings to its advantage. So I made an algorithm which detects these choke points on the map. This knowledge can be used when the AI decides which star systems to colonize so that it can then defend its area effectively by building static defences and focusing its ships on the choke points. Also, because the process looks cool it makes a nice video. 🙂

Message log

As the combat side is ready enough to play out simple battles against the AI, I moved on to the strategy scene. One big thing to do here is the strategy AI. It can already expand quite nicely but it assumes there is no one else in the game. While I was planning how to do the whole AI opponent I decided to improve on some small things in the Star Map scene which make it a bit smoother to play.

The object that is currently pointed is now highlighted and the fleets on the star map now go into nice circular formations around the planet they are at. But the biggest thing I implemented was a message system which logs important things that happen and lists them for the player on the right hand side of the screen. These things include discovering new planets and tech and informing that a colony ship could colonize a planet etc. Clicking on the messages changes focus to any corresponding location or panel.

Here you can see a short gameplay video showing these new features. You can also see some other things which I haven’t  shown or explained yet like the AI expanding, different planet types, the planet panel which you use to set what the planet does. At some point I’m going to do videos about these and explain how the production, research, food and population growth mechanics work.

Start of better combat AI

It took some time to design the combat AI so that it can do something else than just to attack enemy ships one by one. Now it, well… attacks enemy ship clusters one by one. While that is already better than the last AI, the more important thing is that now the AI system can be extended to do a lot of other things too. It basically has two state machine layers: the strategy layer and the tactic layer. The strategy layer keeps track of what it would like to achieve (attack, defend, flee) depending on the situation  and how well it is going. The tactic layer then does the commanding of the ships according to the current strategy. Now I can add as many strategies and tactics as I want. I hope this is enough to make a challenging AI for the game. The goal is to make the AI challenging by making it do smart choices and not just by giving it bonuses in resources etc. The strategy layer of the combat AI can also transmit goals from the galaxy map to a single combat. I don’t know if this is done a lot in strategy games but I think it should be an important part of these. This means that the AI should know its goal for the combat – is it a last stand and it should not flee, was it a result of a bluff attack and it should just flee, should it flee to join another army and defend/attack with that, should it try to disable enemy carriers in this combat and then flee or anything like that.

Cluster tracking

More nice looking technical stuff. Here you can see the movement of different clusters and how they are assigned together every step. This is how the AI will keep track of how the enemy moves and if the clusters split up or merge. Currently this does not depend on how the player has set the groups. I didn’t want that to affect the behaviour of the AI because it could have some unwanted effects, like the player having to think how the groups should be set so that the AI reacts poorly. But that info is not going to be hidden from the opponent, I think. I might use it to visualize the enemy army for the human player.

Group aggressive attack

Until now I have had attack commands only for individual ships. But as I now have ships doing everything in groups I had to add logic for group attacking also. Here I demonstrate aggressive attack which means that the ships try to get close and match the velocity of the target group and then just shoot at it and stay in formation without evading or anything like that. The other option will be evasive attack, in which the ships will try to stay in motion and probably break formation more. In evasive mode the ships will have a chance to evade incoming shots but they won’t have so much time to concentrate on shooting at the enemy. How well the evasion works depends on the accuracy of the shooter and the speed of the incoming projectile.