So, Ologon was suppose to be a cell-based war game in space. But what does that meant in terms of gameplay, at least from the point of view of a programmer? That was the question I kept asking myself since this was my first time trying to build a 3D strategy game.
First, it meant that there would be some sort of combat units in the game. Lost of them. We have a 1x1 war, with at least a couple of planets, where I could expect each one to hold something between 20 to 100 ships. That's not a lot of ships, but once the number of planets start to grow this escalates quickly. And the larger this war gets the cooler it's for the player to witness.
Second, the units were suppose to be self-driven. In other words the players would sent commands from one planet to attack another, the ships would departure and everything that happened between one planet and the other would be based on the ship's IA, the player would have no control over any single ship. If a ship found an enemy ship in range it should stop and engage or run, same with combat satellites and so on.
At first the second issue sounded simple as this wasn't my first rodeo with Unity. There are a couple of ways you can do a fast and simple algorithm for detecting nearby enemies and aim at them, if the object's enemy is the player or any other IA it doesn't really matter. But the thing is... most of those solution relies on physics. Be it for entering a collider or just casting a ray, it was just too much to handle a huge number of units trying to do it at the same time, all the time. And as you can imagine using physics or even some sort of path finding system would be too consuming and would greatly limit the number of ships in game.
But how to solve this? Well.. turns out basic math operations worked faster than collision/trigger/ray detection. Yes, the number of ships I was aiming was high from a gameplay point of view, but to a simple data structure, it wasn't that much. So I decided to keep a more complete track of all my ships and created some sort of universal targeting system for them, simply based on ships distances. Since I didn't had to worry about object occlusion in this situation everything was much simpler this way. This kind of "targeting system" by itself allowed me to place 10 times more ships in the scene.
But that was just the first of my problems. I would still have to go through defining pilots personalities, planets defenses, satellite controls and more.
Pedro Dalcin, Programmer and Game Designer @ Young Mind Studios