Ok, that’s a pretty severe title, but all will make sense as you read on. 🙂
Firstly I’d like to thank Bil over at http://battledrill.blogspot.co.uk/2015/04/ancient-armies-game-development-blog.html for linking to this site 🙂
The first part of this week was dedicated to bug fixing only. I have a zero tolerance policy toward bugs.
The reason for this approach during the development phase, is that with only one person on the team (me!), there is a very real possibility that I could easily become overwhelmed with having to continuously fix things.
I’m sure you all know those game releases that were so full of bugs that they became practically impossible to maintain. As a consequence these games either never get fixed, or they end up going through a ‘fix’ cycle that ends up introducing new bugs due to the number of existing inherent issues. As a result they end up going through ‘fix’ cycles ad-infinitum!
I don’t want to have one of those games on my conscience – hence my zero tolerance policy.
One of the more interesting bugs I fixed this week is shown below:
What made this bug so interesting is that the map always rendered properly when viewed in the map editor. It was only when viewed in the main game and scenario editors that the issue showed itself. This in itself wasn’t interesting, it was the fact that all three applications were using the same code from the same library!
After the bug fixing phase, I put my mind on to the task of getting my units to be able to turn, or in military parlance to be able to wheel about.
Most wargames cheat when it comes to wheeling units. They always have their units unrealistically turn on their centre points. This is unrealistic, because in real-life such a turning manoeuvre would be almost impossible to carry out!
Instead, Ancient Armies looks at the formation shape and then looks at the direction of the requested turn. It then picks a realistic rotation point that a real-life unit would actually employ.
For example consider to the two screenshots below:
Here the same unit is being ordered to wheel about, firstly to its left and then to its right. Note that in both cases the pivot point has moved to the opposite corner of the unit – just like it would in real life!
The system also limits the rotation speed based on the unit size. This ensures that the rotation speeds remain realistic.
Some other games I have seen have a fixed rotation speed, which is fine. But if you look at some of their larger units rotating, the chaps at the extreme edges of the formation must be on some kind of motorised transport due to the speed they are travelling at!
When it comes to wheeling units Ancient Armies takes the realistic approach. Putting in the ‘realistic approach’ was not a trivial job. It ended up requiring a lot of work!
For example, the orders system had to be modified so that follow-on orders can take into account previous unit direction changes. In the end I really liked this modification as it gave me the opportunity to refactor that part of the orders system. It is now at the point where it is efficient, simple and elegant!
The other complexity that I have had to overcome with regard to orders are the graphics – or in this specific case the curved arrows that can dynamically resize as one moves the mouse.
The difficulty lies in the fact that all modern graphics cards can only deal with triangles – and only triangles!
This means that everything you see in Ancient Armies is composed of triangles – regardless of its outward appearance. Even the ‘curved’ hills!
In this rare-never-seen-before-screenshot below I switch off the graphics engine’s triangle fills so as to reveal the underlying triangles that make up everything:
In the above screenshot you can see all of the triangles that make up the curved arrow used for a wheeling unit. All of these triangles have to be calculated by the code on the fly. The curvature for each curve is also based on the size and shape of the unit…
Hopefully the above screenshot will give you an insight into the rather complicated triangular world that I have to inhabit when I work on this game!
Before I go, I will leave you with a video showing the curved arrows in action. Note that the graphics representing a wheeling unit are not yet finished…. 😉