Unit groups

Giving commands one by one to huge numbers of ships is not very handy, not to mention all other problems like small ships getting lost in some corners of space. So I added some group controls to the combat UI. Now ships can form groups, like in many RTS-games, and there is also a button to choose all remaining ships. Groups can be selected by pushing the corresponding numeric button or by clicking near the midpoint of the group. I still keep the option of choosing ships freely, but I might change it later so that the groups are fixed like in Total War -games. That might be a much easier way to command the armies and probably wouldn’t restrict the combat too much. But will have to test and see if that is needed.

Also added a button which shows the command queue of all ship groups.

Scene transitions and basic combat AI

Worked on initializing the combat and star map scenes with correct starting information. Now if fleets meet at a star system, a combat scene is started and corresponding data is transferred to the combat scene. After the combat the star map is loaded and casualties are removed from the fleets. It is still handy to be able to test any scene you want by starting straight from that scene, and not having to navigate to that state of the game from the start. So each scene can also be started directly in which case it uses a test state for initialization which can be set from the Unity editor.

Also made a basic AI to control enemy ships in combat. Now they just queue to attack every opponent ship (player ships) one by one. I have done a coroutine based state machine for the individual ships and the same state machine could be used for the AI controlling the whole army. The state machine is very flexible and I feel that it will be enough for anything I need.

Gimbals

There will be four different mounting options for each weapon. Normal and right angle mounts are fixed to the direction they are pointing at. Then there are gimbal and turret mounts. Turrets are able to aim at targets in a semi sphere area. Turrets are more expensive, require more power, more space and they do suffer from a gimbal lock around the zenith, that is, they have some problems if the target is exactly above them. Gimbal mounts are like normal mounts, except they can rotate a bit left and right and up and down around the starting direction. They do not require a bigger mounting spot like turrets do but are more expensive than fixed mounts. They can only be mounted on forward mounts however, right angle mounts are always fixed to the direction they are pointing!

Gimbal mounts help less maneuverable ships to target faster ships and they also provide nice automatic gun harmonisation (https://en.wikipedia.org/wiki/Gun_harmonisation) with adapting convergence point, which is needed against small targets. In the video the first corvette has beams with fixed mounts. The second corvette has gimbal mounts and it hits the small fighters much better.

Updated tracking

Updated all physics based direction tracking to be a bit smarter. Now they take all movements into account and still try to guide the turret/ship/gimbal to the correct direction the fastest way without overshooting. The following videos demonstrate the effects. The turrets try to optimally match the speed of the target, taking into account its own acceleration (and deceleration) and the movement of whatever it is mounted on. If the target comes to a sudden stop while the turret is correctly tracking, the turret will overshoot a bit. Similarly, if the ship the turret is mounted on rotates, and then comes to a sudden stop, the turret will overshoot. The result is satisfyingly realistic and accurate turrets.

Relative movement

Added possibility to give movement commands relative to some other ship. Should be useful when maneuvering bigger armies and ships of different speeds. In practice it means that the move commands can be set to follow another ship. In the fist video I have an overly complicated chain of ships following one another and in the second video lots of fighters following a destroyer.

Star map view

Finally starting the star map scene. Currently there are randomly distributed stars and fleets of different colors moving around. Changing the turn makes them do the set movement. There are lots of options on the rules of how to allow the movement between stars and how to restrict it. If ships are able to jump long distances it is hard to try to defend from attacks. It might be nice to have some kind of allowed paths between stars to have at least some kind of choke points. There also might be different kinds of propulsion systems which would enable different ways of moving around. I have some ideas but I have to test them a bit to see how they would work in reality.

Attack modes

Weapons, hit points and armor are not the only things that affect the outcome of combat. Here you can see what happens when fighters try to attack a frigate with turrets. The first fighter group uses aggressive attack mode while the other one uses evasive attack mode. In defence of the underachieving frigate, it does not yet have a proper AI to deal with many fighters, instead it tries to shoot them one by one and turn to face the current target. That makes it rotate wildly, which does not help targeting.

Aggressive attack mode

New weapons and models in action. Here some fighter class ships attack three frigate class ships. They do an “aggressive attack”, meaning that they only maximize their damage on the enemy. First they attain the same velocity as their target, when that is achieved they continue to shoot at the enemy. The frigates just move here until they are ordered to attack the ships. There are no enemy AI yet to give commands to the ships.