Slow, But Steady!

Spot any changes?

Spot any changes?

Before we start, those who prefer to watch a video rather than reading, should scroll down to the end of this post and watch the video there. For those that prefer to read, carry on, but I still highly recommend that you watch the video too!

The last month or so has seen a lot of work put into Ancient Armies. Alas, most of that work will not be visible to the user. :/

Adding column movement was proceeding rather smoothly, right up until the point where I had to add a unit’s text to the column model.

I discovered that there was no easy way to copy text from an original unit’s model to the column model. The reason for this was due to the fact that a unit’s text was not encapsulated and involved many calculations.

Calculations?

Yes!

For those that don’t know, Ancient Armies units are dynamic. They are sized based on the underlying data. This means that the text that appears on them has to be able to scale properly and fit within the constraints of the user designed unit.

This is no simple task. Every formation shape had a lot of arcane code to calculate the text sizes and positions for a variety of unit shapes and sizes.

Alas, this code was scattered all around the formations models system which makes it very difficult to copy text to the column model.

To get around this I would need to create a specific class to encapsulate the concept of unit based text. This seemed kind of simple until I discovered that the Ancient Armies graphical model system does not support this very well.

The upshot of all these observations was that I had to refactor the entire model graphics subsystem to enable me to create a text model. This was the task that sank most of my time.

Was it worth it?

Yes! (in my opinion)  😎

I now have a much simpler code base, though paradoxically, one that is also a lot more powerful.

A lot of duplicate code got removed and much of the technical debt that I had accumulated over the years got fixed as a result of this refactor. I was going to address this technical debt, but at some point in the future. However, the text issue forced my hand on the matter.

With the new system I can now easily copy text. But I also gain other advantages too. Text scaling now works properly:

Text now works with all sizes of unit!

Text now works with all sizes of unit – regardless of size!

Direct-X’s implementation of text has a flaw where if you change the font size, it makes no difference whatsoever! The older code had a particular approach to get around this limitation, but it wasn’t robust across a wide range of unit sizes – as seen in the upper unit above.

The new text class has custom code in it that addresses the scaling issue in a totally different and neater way. As a bonus, it now allows for the accurate positioning of text, as well as performing scaling in a robust manner across a myriad of unit sizes.

The new text code also incorporates a lot of additional functionality such as text clipping (needed by column movement). But the best thing of all is that this powerful code is now located in one place, neatly encapsulated within one class.

Thanks to the new text system we can now do this:

A unit in the process of stripping down to move into column.

A unit in the process of stripping down to move into column. (The window top left is the replay window)

Here a cavalry unit is in the process of stripping down to move into column (the column itself is not shown as that is still being developed). Notice how the text is perfectly clipped?

Without the new system there would be no clipping, and indeed, as far as the column model was concerned, no text at all!

Unit stripping and reassembly are one of the crucial parts of column movement. The implementation was non-trivial but we are now around 80% there. Once this part is done, I’ll be able to work on the actual columns themselves.

The column system is very flexible and allows a unit to be specified with multiple column formations:

Multiple column support

Multiple column support

In all I’m happy with the progress so far, despite the massively expanded scope of the column release:

Ouch! An explosion of work!

70 Issues – Ouch!

I am starting to win the fight on this release with only 20 more issues to crack. Had the architectural issues not reared their heads, I would have been a lot further along with column movement. But it is what it is.

At least I am now winning the fixes vs new issues battle! :

A month of swimming against the current!

A month of swimming against the current!

In addition to the start on column movement, I have also given the Ancient Armies fatigue system a few changes. Units now have their fatigue capped at 100%. They now slow down as they get near that figure, until eventually, they stop.

One of the things that grated me with the fatigue system, is that unlike cohesion, there was no visual feedback to the player. This has now changed:

We can now see fatigue!

We can now see fatigue!

The unit on the top left is heavily fatigued. This is now visualised by a unit’s colour getting paler as its fatigue increases. This provides instant visual recognition and works pretty well with the cohesion system’s visualisations too.

Other fixes also managed to be snuck in…

Rhomboids had an issue with their size calculations – this was only discovered whilst testing the column stripping functionality:

Rhomboids fixed!

Rhomboids fixed!

The fixed version is on the bottom. Although not as aesthetically pleasing, it is accurate and also reflects some of the ancient descriptions of these formations being described as lozenge shaped.

Below are some of my original notes that I used to meticulously check the calculated results:

Some of the original notes that I used to test the rhomboid formation calculations.

Funky rhomboid notes!

Another fix was the unit flags. These never used to scale at all. This resulted in them being very tiny on large units. Now they scale to the size of the parent unit to make them more visible.

This is can be seen by comparing the old and new rhomboid units above.

Another important fix was an issue with Chronos – the replay and time system.

I discovered that it wasn’t being used to playback a turn! It was only being used when the replay system was activated. This meant that the turn replays tended to slow down or speed up unpredictably. It also caused a number of bugs when using the game at high time compressions.

This has now been fixed and Chronos is now used for everything. We now have super-accurate timings regardless of the computer specifications running the game. Plus, as an added bonus a lot of redundant code got removed as Chronos took on the burden of animating the player’s turn.

That’s it for this post. I wasn’t originally going to put anything up, but then decided that a progress report would be good. After all, you folks need to know that the game is being actively worked on.

Below is a You-Tube video showcasing all of the new improvements. It’s worth watching as I cover a fair bit of ground not covered here! Best viewed in HD-4K 😎

Laters

RobP

6 thoughts on “Slow, But Steady!

  1. Pretty impressive Rob. Might I make a suggestion? I think using all that text on each unit formation graphic will be hard for most people to follow and deal with.. zooming in to each to read the specifics will get tiring. I would recommend that instead you use graphic symbology for the important data, for example unit type and formation, maybe even fatigue, morale state and general strength status. Probably don’t need much more than that most of the time, and you could limit some of this information to the player depending on fog of war settings, etc.

    Then perhaps have a right-click menu that will bring up all the other specific detailed data for a selected unit… this can be presented either in a floating window, a flag pointing to the unit, or a side window.

    But then again, maybe the text on each formation like you currently have it would be fine.. nobody will know really except you until the game starts to get to other testers.

    Regarding the unit with heavy fatigue changing color.. that is a really good solution and very visually obvious.. I also would argue that such a fatigued unit would lose cohesion and start to spread out and become less dense as soldiers start become less and less able to stay in formation… especially if on the march, a formation could stretch very thin as stragglers start to drop back as fatigue rises.

    Excellent update!

    Bil

    • Lots of excellent suggestions there!
      Once full command and control is in, much of the text will be hidden – even the unit names of the opponents – at least until they can be identified.

      My intent is to show a zoomed in unit graphic top left of the display, every time the mouse cursor pops over a unit. Additional info on the units is already available via a right click and then selecting properties at the bottom of the speed menu.

      I agree about the loss of cohesion due to fatigue and I think that’s something I need to put in. Right now the two subsystems are completely independent – but it does make sense for increased fatigue to cause cohesion issues.

      As for modelling the spreading out of troops, that one could prove to be a little tricky – though I will bear it in mind.

      Stragglers are a weird one. I had never thought about them because they aren’t mentioned in many Ancient Battle accounts. However, I recently did some reading up of the Seven Years of War and was surprised at how large the losses were due to stragglers! So it is something that I’m looking at! πŸ™‚

    • It is – but alas, I have too many things on the go! Add to this a demanding β€˜real-life’ software development job and the results are a glacial home development. πŸ™‚

Leave a comment