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.

Formations

Now that I have groups, I could finally add the whole formation system for them. The ships fly and stay in their formations and they reorganize in the formation as needed. This happens when formation is changed, a move command is given or ships leave or join the group. There are found kinds of formations now, but that could change. The idea is that there should be formations for different situations, so how they work in real combat have to be tested.

Carriers

Of course there has to be carriers, so I added them now. The ships form queues to dock to the hangars and precisely float in. Once they are in, any number can be undocked. Undocked ships then follow the carrier in formation, so that they are not left behind.

Advanced map generation

I refined the map generation process and isolated some parameters to be chosen freely when making a new game. The first one is naturally the number of civilizations in the game, called “player count” in the video. The next one is the number of star systems in the game. It can be chosen freely but in the end I will probably make it a discrete scale with tiny, small, medium, etc options pointing to some number of stars. Then there is a parameter called “edges leaving a star”, which means how many edges on average there should be connecting to one star. A number of 2 there means that the whole map could in theory be just one line or a chain of stars. The parameter “location balance” means how balanced the starting locations are. A value of zero there means that they are totally random, and one civilization could start in a dead end star system with another civilization blocking it. A value of 1 means that each civilization has almost the same amount of free star systems around them. Finally there is a looseness parameter, which means how big the diameter of the map can be.

Map generation

It is quite messy and complicated if ships can move from every star system to any other star system freely. Even if there is some kind of maximum jump range, I feel there are too many possible ways to move around and to attack to make playing it fun. This is why I want to have some kind of paths between star systems to which the movement is restricted to. With higher technology it would still be possible to travel even without these paths, but that would have some drawbacks too. I’m not sure what is the backstory or scientific reason for these paths, but I have some ideas.

    In the video I test the map generation system. It creates the stars and the paths between them. First I used an algorithm to make Delaunay triangulation to create the paths between the stars and then removed some of the paths. But then decided to make a custom algorithm which can be tuned in different ways and also works in 3d. It would be fun if there was some kind of 3d element in the strategic view also, we are in space after all. I might leave it up to the player to choose between flat, spherical, cylindrical etc maps, but have to see how they play out.

Manual flight in combat

A video where I take manual control of individual ships during combat. As you can see, the AI is much better at this. I’m planning to add parameters on how good or bad the ship is at flying. With this I can then do an experience system or a battle computer system etc. Bad pilots or ships with bad computers would then make mistakes and miss more often while experienced pilots with good tech would have this kind of almost perfect performance.

Flight model

In the first posts in the blog I talked about the space flight model and controls. Now that I have a nice way to take manual control of the ships I can show it a bit more. Essentially it uses real physics but has some restrictions to prevent some unwanted things. For example, there is a common upper limit for all velocities. If that velocity is exceeded, the object is slowed down gradually to the upper limit. There also is a max speed limit for each ship depending on the ship’s mass and drives etc. These speed limits are of course unrealistic. Mass and drives should only affect acceleration and not set any max speed limits, every ship should be able to accelerate to any speed they want (well, at least up to the speed of light). However, having no max speed leads to too complicated and unwanted situations in the game so this is why these restrictions exist. Angular velocities work in a similar manner.

Other than that, space flight works as expected. The ships are controlled by linear thrusters accelerating the ship along three axes: up-down, left-right and forward-backward. The most powerful of these thrusters is the forward thruster, others are only for fine tuning the velocity. Then there are angular thrusters to apply torque to the ship. These thrusters provide angular velocity around roll, yaw and pitch axes. Mass of the ship naturally makes all of these accelerations smaller. The physical size of the ship (height, width, depth) affects the rotational accelerations.

The result is that big ships and small ships have quite similar linear accelerations and max speed, but big ships are much slower to turn.

Action camera

It is nice to see everything from the perspective of individual ships, so I made an action camera feature for that purpose. I made the camera follow the ship smoothly so the velocities can be sensed from the camera lag. I’m planning to add an option to toggle manual flight on when in action camera mode.