Category Archives: Game Engine

Fixing a Major Mistake

This screen shot is an example of the design flaw that has now been corrected. Units don’t instantly change from line to column formation. Note that the red infantry unit is first in line formation (facing northwest), it receives orders from the HQ to switch to column formation advance to a position, switch to line formation, travel in line formation, then switch to column formation and travel in that formation. If you observe closely, the unit one instant is in column formation and the next it is in line formation occupying a different portion of the terrain.

The first lecture I would give at the beginning of every semester started: “The greatest asset you can have as a programmer – or as a human being – is the ability to admit that ‘I screwed1)Full disclosure: I wouldn’t say ‘screwed up’. If you want to get an undergraduate’s attention use the ‘f word’. up’ fifty times a day if necessary. Because, until you admit you made a mistake, you can’t find you mistake. And until you find you mistake you can’t fix your mistake. The first step to fixing a mistake is to first admit you made it.”

In the above screen shot there is a glaring error and I didn’t see it for years. In my defense, nobody else saw it, either. The screen shot, below, shows the correct movement and unit formations:

In this screen shot you can see that the unit is switching formations correctly. Note how the unit first changes from line to column formation by ‘a left face’ command, then moves in column formation, avoiding the artillery battery, moving on to the road and advancing to the assigned location where the unit stops, changes into line formation via another ‘left face’, advances in line formation as ordered until it reaches its destination, stops, forms column by another ‘left face’ and then advances to its destination.

Without getting into details, this was a pretty complicated fix. Looking for help with this, and some MonoGame2)MonoGame is a community supported version of Microsoft’s XNA which was created specifically for making cross-platform games. Microsoft stopped all support for XNA in April 2014. Previously, I had used XNA for some work that I had done for the US Army and the Department of Defense and thought it had great potential for creating computer wargames and simulations. specific problems, I encountered Matthew T. from the MonoGame forum who very kindly volunteered to help. Not only did Matthew fix the line / column formation problems but he identified and fixed a bug with the typography for the game, too:

These two screen shots show the difference in the clarity and spacing (called kerning) of the letters. In the left screen shot notice the lowercase ‘g’ in Debug and the spacing of the letters in the word ‘positions’. In the right screen capture, after applying Matthew’s typographical fixes, the letters are clear and properly spaced.

Matthew is also cleaning up the codebase. I have a tendency to write code ‘fast and furious’ and then hope to go back and optimize and clean it up later. Matthew has already begun cleaning it up and has reduced the codebase by something like 7,000 lines of code! Furthermore, Matthew has also sped up the load time and the time between game turns from about a minute to about 10 seconds (obviously, time varies based on scenario).

Steam Update

Darin Jones has been working on the Steam side. He created the Installer and is working on setting up Player versus Player (PvP) leveraging Steam’s built-in features. While this has been a steep learning curve, Darin has made some significant progress:

Screen shot of Steam Player vs. Player invitation for General Staff: Black Powder. This is not a Play by Email (PBEM) system, rather it uses Steam’s internal messaging system

Darin is also setting up a ‘Workshop’ area where you can upload scenarios, armies and maps that you create and want to use in a PvP game.

What’s Next

Our goal remains to get General Staff: Black Powder into beta-testing (that’s you guys playing with it) as soon as possible. We want to use the Steam PvP method, above, as the vehicle for testing. I’m grateful for the emails that I’ve received that are encouraging me to not rush General Staff: Black Powder out before it’s ready and to deliver a solid game (see also, Gabe Newall on why game delays are OK: ‘Late is just for a little while. Suck is forever.’).

As always, please feel free to contact me directly at Ezra[at]RiverviewAI.com.

 

References

References
1 Full disclosure: I wouldn’t say ‘screwed up’. If you want to get an undergraduate’s attention use the ‘f word’.
2 MonoGame is a community supported version of Microsoft’s XNA which was created specifically for making cross-platform games. Microsoft stopped all support for XNA in April 2014. Previously, I had used XNA for some work that I had done for the US Army and the Department of Defense and thought it had great potential for creating computer wargames and simulations.

The Friction of War

The delay in the transmittal of orders from headquarters and staff is one example of the Friction of War. Note the calculated time for couriers to arrive displayed in the Subordinate Orders list on the left of the screen. The red lines are the routes that couriers from General HQ to Corps HQ to individual units will take. General Staff: Black Powder screen shot. Click to enlarge.

Carl von Clausewitz, in has seminal work, On War, (Book 1, Chapter 7) originated the phrase, “Friction of War”:

Carl von Clausewitz painted by Karl Wilhelm Wach. Credit Wikipedia.

“Friction is the only conception which, in a general way, corresponds to that which distinguishes real war from war on paper. The military machine, the army and all belonging to it, is in fact simple; and appears, on this account, easy to manage. But let us reflect that no part of it is in one piece, that it is composed entirely of individuals, each of which keeps up its own friction in all directions.”

I knew that if General Staff: Black Powder were to be an accurate simulation, and not just ‘war on paper’, that the friction of war would have to be calculated into the command / orders chain. One part of this – the distance the couriers will travel from one headquarters to the next to deliver their orders and the time it takes to travel this distance – can be calculated with reasonable certainty (I’m using the rate of 10.5 kilometers per hour for a horseman, I’m not an expert but this seemed reasonable, and it’s easy to change if somebody has a more accurate value).

Another example of friction of war is factored into the delaying of the arrival of orders is Leadership Value:

In this example, the Imperial couriers will travel over 4.3 kilometers, taking 24 minutes, to deliver their orders. Also, note the cost of the combined Leadership Values. Because Napoleon and Vandamme have very high Leadership Values little additional delay is added. General Staff: Black Powder screen shot. Click to enlarge.

You can specify at what time the order is to be executed (in this case 6:15), however you can not set a time earlier than when the couriers would arrive. This allows for coordination of attacks across units. General Staff: Black Powder screen shot. Click to enlarge.

The other value – and it is arbitrarily set – is the cost of ineptitude, incompetence, lack of motivation, and sloppy staff work. In the above scenario (Ligny) Napoleon’s Leadership is set at 93%:

The slider adjusts Napoleon’s Leadership Value which effects the delay in issuing orders. General Staff: Black Powder Army Editor screen shot. Click to enlarge.

I understand that Napoleon may have been feeling a bit under the weather during the Hundred Days Campaign. You can set his Leadership Value to anything you want in the Army Editor (above).

Major General George B. McClellan’s Leadership Value can be changed in the Army Editor. Click to enlarge.

Did I set McClellan’s Leadership Value too low? He was amazingly incompetent. Note below:

The combination of McClellan’s and Burnside’s extremely low Leadership Values adds an additional 29 minutes to the transmittal of orders. The blue lines trace the route that couriers would travel from McClellan’s headquarters to Burnside’s headquarters and then to each division and battery. General Staff: Black Powder screen shot. Click to enlarge.

The combination of McClellan’s and Ambrose Burnside’s Leadership Values results in almost a half hour delay in transmittal of the orders (remember after receipt of the orders, Burnside has to send couriers to his divisional and battery commanders, too and their Leadership Values effects the delay before their unit executes the order). After factoring the time it would take for a horseman to travel the distance between McClellan’s headquarters to Burnside’s headquarters (14 minutes) the earliest that a unit could be expected to respond to the original order from General Headquarters would be forty-one minutes later (and, in reality, a bit after that because of that unit’s Leadership Value).

The path of the couriers from McClellan’s headquarters, to Burnside’s Headquarters and then out to the divisions and batteries. General Staff: Black Powder screen shot. Click to enlarge.

I have spent some time at Antietam and studied it at length and this delay of about three-quarters of an hour between the time McClellan wanted to issue an order and the men of Burnside’s IX Corps moved out seems if anything, too optimistic of a timetable. In fact, as I write this, I think I need to increase the penalty for poor Leadership Value. McClellan and Burnside couldn’t possibly have got units moving in less than an hour.

As I have begun playtesting General Staff: Black Powder I found the delay between issuing orders and wanting to see something move now was a bit disconcerting. It shouldn’t have been. I’ve read enough military history to know that battlefield orders were often transmitted the night before and moving units around during the battle could be a risky proposition. Some armies, however, were less afflicted with these problems than others, and that I would attribute to ‘leadership value’ which also encompasses the army’s general staff.

If you don’t want to use General Staff: Black Powder as a simulation that inserts a calculated delay between orders and execution, and would rather just move units instantly, there is ‘Game Mode’:

The Select Mode screen in General Staff: Black Powder. The user chooses between ‘game’ and ‘simulation’ with differences in rules and unit icons. Click to enlarge.

Game Mode has the same maps but uses simpler icons and rules. I originally envisioned Game Mode as a way of introducing wargaming to a new generation (I wanted to write it for the XBox). Anyway, it’s included with General Staff: Black Powder.

Lastly, I know everybody is waiting for news about when can I get my hands on the game?!!?!!  My friend, Damien, wasn’t able to work on  finishing it using Unity so I’m finishing it up using MonoGame. As you can see I’m pretty far along and I think I will be playing the first ‘actual game’ (that is a simulation from start to finish) within the next couple of weeks; maybe sooner. After that, probably at least another month of fixing bugs, but then I’m hoping to set up a Beta download for all the early backers via Steam. We have a space on Steam but I haven’t even begun to build it out. Obviously, I’m just one guy, I’m working as fast as I can, but I think this is all good news. Also, I’m working on a video to show everything off.

As always, if you have any questions or comments, please feel free to contact me directly.

 

General Staff will Ship in 2022

A few of Grant’s unsuccessful attempts to take Vicksburg. Map from West Point Atlas of American Wars. Library of Congress. Click to enlarge.

Grant took Vicksburg on his sixth attempt. He first tried a direct movement, east of the Mississippi, against the city but was forced to turn back after Confederate General Van Dorn’s raid destroyed his supply base. Sherman next attempted a direct assault and failed at Champion’s Bluff. Grant then tried to cut Vicksburg off from the Mississippi by digging a great canal across the neck of a giant oxbow. Unusually low water levels in the river that year caused another failure. Grant also tried more canal digging and river clearing at Lake Providence and the Yazoo Pass without luck.

Col. Theodore Lyman, a staff officer of the Army of the Potomac, wrote of Grant, “He habitually wears an expression as if he had determined to drive his head through a brick wall, and was about to do it. I have much confidence in him.”

Grant finally succeeded with his brilliant amphibious landing south of Vicksburg followed by a series of ‘must win’ battles that concluded with besieging the city on May 22, 1863. Confederate General Pemberton surrendered Vicksburg on July 4, 1863.

The General Staff: Black Powder Wargaming System is comprised of four separate programs: the Army Editor, Map Editor, Scenario Editor and the actual Game Engine, itself. The first three have been done for some time (it’s what I use to produce scenarios for testing the AI). They were written in C# using Microsoft’s Windows Presentation Foundation (WPF) which is often used for creating desktop business applications. This decision made sense because the Army, Map and Scenario Editors function not unlike a suite of business applications that create and share data with a common look and feel. However, while WPF was a good development decision for the Editor programs it turned out not to be a great tool for creating the Game Engine.

A flow chart of the General Staff: Black Powder Wargaming System. Files created in the Army Editor and the Map Editor are combined in the Scenario Editor to create a scenario or simulation. Click to enlarge.

What the Game Engine does is it takes data created in the three Editor programs, displays them in a visually exciting way, enables the user to make input (orders), and simulates those orders (as well as the AI’s orders) and the resulting combat to the highest degree of accuracy possible. That sounds like a lot, but it really isn’t. And the heavy lifting that the Game Engine is being asked to do is all visual: making everything look good on the screen.

Recently, I’ve been looking at Grand Tactician: Civil War which is an immersive voyage into 19th century American typography, cartography, tactics and grand strategy. I eagerly look forward to having the time to do more than gaze upon it in amazement 1)Full disclosure, the developers were kind enough to give me a review copy of Grand Tactician and, damn, it looks fantastic.. I reached out to Ilja on their development team and he convinced me that we should complete the General Staff Game Engine in Unity (which is what they used for Grand Tactician). What they accomplished visually with Grand Tactician was precisely the look and feel that I wanted for General Staff 2)I’m talking about the typography and the UI, not thousands of tiny 3D soldiers on the battlefield; which look really great, but, General Staff is not that kind of a wargame..

Consequently, we are officially announcing that we are abandoning writing the General Staff: Black Powder Game Engine in WPF and, instead, will be creating it using the Unity engine. We believe that this will produce a far superior visual experience 3)Please note: we will not being using Unity to create a 3D simulation with tiny soldiers. I like playing those kind of games, but that’s not what General Staff is..

Because Unity is designed to facilitate the creation of computer games, this move will greatly accelerate the completion of the General Staff Game Engine and will allow us to ship General Staff: Black Powder this year.

I am certainly not U. S. Grant, though I like to think I have some of that bulldog determination. Like Grant before Vicksburg, I’ve had to acknowledge that our first attempt will not succeed and we’re moving on to another plan. I am sorry for the delay in the release of General Staff and am confident that, with Unity, we will soon be reporting some good news.

I am also very excited to announce that my good friend, Damien, will be joining the team to specifically work in Unity completing the General Staff Game Engine. Damien lives in Ireland and has been a devout wargamer since playing Arnhem on the ZX Spectrum. When not enjoying a Guinness or a Jamesons, he’ll be playing tabletop or computer games, whether that means pushing cardboard counters across hex boards, drawing LOS between badly painted miniatures on the tabletop, or day-long sessions in front of a computer – where he particularly enjoys playing against a challenging, non-cheating AI. Damien is a 28 year veteran of the IT industry, having worked on everything from telecoms, healthcare and financial systems, across Mainframes, Linux, Unix and Windows, and co-inventor of two messaging system patents. He has a particular passion for language processing and domain specific languages, originating from his interest in the elegance of recursive descent compiler construction.

References

References
1 Full disclosure, the developers were kind enough to give me a review copy of Grand Tactician and, damn, it looks fantastic.
2 I’m talking about the typography and the UI, not thousands of tiny 3D soldiers on the battlefield; which look really great, but, General Staff is not that kind of a wargame.
3 Please note: we will not being using Unity to create a 3D simulation with tiny soldiers. I like playing those kind of games, but that’s not what General Staff is.