Combat modes and engagement modes

I’m working on getting the combat to a state that it can be played a bit more easily. By this I mean that the player should see what’s going on and he should also be able to get the ships to do what he wants. To this end I added the combat modes and engagement modes for squadrons. I also added squadron cards so the player sees what squadrons he has, how much they have suffered losses and how much they are currently receiving or dealing damage.

The combat mode has two states: stationary and evasive. So far there has been only stationary mode, in which the ships maximize their damage output on the target. In evasive mode they move around and hopefully evading some of the incoming shots. I have experimented with these before but now they are implemented a bit better.

The engagement mode is a totally new thing. It has three options: hold fire, fire at will and engage at will. In hold fire mode the ships in the squadron will attack only the targets that the player explicitly commanded for the squadron. In fire at will mode, any “idle” ships will also shoot any targets that they encounter. Ships are idle if they don’t have any flying tasks at the moment. This means that if ships are on the correct flight path, they can rotate and shoot any ships that they pass by while floating through space. In engage at will mode, the squadron will “lock on” to any enemy ships they encounter. So they will actively chase them and continue with the original command once the enemies are destroyed. They also give up if the enemies can escape outside their range.

The squadron cards on the bottom of the screen will have information about the squadrons. They can also be used as a way to point your squadrons, if you want to select or target them with some command for example. Currently the card shows the current ship amount and original ship amount. The original ship amount is reset if ships leave or join a squadron. The card also shows the current action of the squadron by showing a corresponding icon. The background of the icon indicates how much damage the squadron is receiving – the redder it gets, the more damage the squadron is receiving. Similarly the color of the icon indicates how much damage the squadron is dealing – light blue means they are dealing some damage, but an intense shade of blue means they are delivering their full potential on some enemy ships.

New projectile and hit effects

While working on the whole weapon and damage system I have “relaxed” by doing visual improvements at the same time to replace placeholder visuals. I’ll talk about the damage system later, instead of that you can see some shooting actions by fighters. There are bars for hull (health points) and shields above the ships, but the player can see what is hit by the visual effects also. Hitting shields makes a clear shield effect, but I’m also planning to make distinct effects for hitting armor and hull. In the video you can see what it looks like to hit shields and armor of a ship.

Updated combat visuals and music

I have worked on making things a bit more prettier. Previously there has been mostly only placeholder effects but now I began planning on what the visual effects and such should look like. I learned to use GIMP to make my own textures, Blender to make some basic meshes and started using Amplify Shader Editor to quickly make some custom shaders. Some of the results can be seen in the following video in the form of beams, projectiles and shield hit effects. (I have also been working on shields, armor, hull, weapon types and damage system but I’ll have to make a post about that later.) I also looked at things like draw calls in Unity to check what optimizations to do and made sure that GPU instancing is used on projectiles, which wasn’t the case before. That was mainly to just familiarize myself with how Unity handles those things, I’m not focusing on optimizing things yet, just making the basic mechanics work. When I started with the game I decided not to start using Unity’s Data-Oriented Tech Stack (DOTS), because it seems a lot easier to prototype things the old way. If it begins to look like that I will have to use it, I will make the change. But I don’t know if that is even going to be the case. I haven’t even done the most basic optimizations like object pooling – all projectiles and effects are instantiated and destroyed as needed and things still work ok.

Anyway, here you can see a video of four battleships attacking a single battleship with huge weapons. Then fighters and some corvettes join the fight to attack the battleships. Even though (or because) the battleships have the biggest weapons there is, they are no match against a big amount of small ships. The battleships would need many smaller turrets to efficiently match that amount of fighters. The video also has music from a composer I’m now working with.

Multi turn travel

Previously the fleets have travelled from star system to star system in one turn. This was simpler to do and was meant to be only temporary. So I now improved the system so that the fleets can spend multiple turns travelling from star system to star system. Seems like a small change in the video but actually affected many things in the logic and code.

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.