Age of Empires Game Screenshot

The History of the Game Engine: Part 6 – From Pawn to Cho Ku Nu

Strategy games have been around for so long that their origins are history. This alone makes for an article or two in itself. Chess, undoubtedly the most famous of all strategy games, dates back to the 7th Century. It is fair to say that strategy and wargaming has been about a lot longer than computer games.

With a huge number of enthusiasts, and an obvious crossover between the type of people who enjoy strategy gaming and those who have a flair for programming, some of the very first games that were developed for computers were strategy games. Versions of chess on computers date back to the 1950s, and card game lovers have tried developing versions of traditional card games for almost as long.

It’s a history that’s over half a century long.

The Quest for Chess Supremacy

Chess devotees long desired to create computer code that would enable a machine to play a decent game. From the very early days of programming, it seemed obvious that given the right level of technology, a computer could solve chess–that is to say that it could play flawlessly, beating every opponent.

Of course, for that technology to be available seemed a long way away back in the 1960s and 1970s. Despite the programmers having the will to develop some sort of structure to a chess game, the calculations involved were utterly ridiculous.

The topic of chess computers is vast, so we won’t delve too deep. But there are more moves in chess than there are atoms in the universe. At one point, it was calculated that even if the software could even compute a million potential moves per second, it would still take it years to process through to the endgame and make a decision. Not exactly a fast-paced game—and at the time, the idea of a computer managing that million-move analysis in a single second was still out of grasp.

This led to a number of important developments centred around the idea that not every move is equal. Evaluating what moves can be simply brushed aside as irrelevant would cut down the number that needed to be followed through. So a point system was developed, whereby software could do more than simply crunch the number–it could also give priority to moves with a better tactical advantage.

This still wasn’t enough, but from there came a second understanding—what if the game were calculated backwards, and the right moves were permanently stored in a database? That way, the computer doesn’t have to scan and calculate the best move, it simply has to look up the answer in a table.

Early Chess Computer

Only, the storage required for such a thing is phenomenal.

Getting a computer to play chess to a master level required aspects of all of these things: brute force logical calculation, evaluation, and a database of known solutions–each working in tandem with the fastest technology available.

It was in 1997 when this was first achieved. Today, more than two decades later, you can squeeze all that impressive technology onto your phone.

The Chess Engine

Developing a system that could play chess would be impossible without the work of everyone who had come before. As we discussed last time, were you to sit down today and try to develop a viable chess program, that level of reinventing the wheel would feel infinitely impossible.

Chess games today rely entirely on one of a number of chess engines–game engines developed with one core task—to play a good game of chess.

It was the willingness to share ideas, code, and databases of painstakingly curated information that makes chess engines possible. Today, a developer doesn’t need to study the decades-worth of work to develop that level of artificial intelligence. To make a working chess game, a developer can use an existing engine to run calculations in the background, designing the look and feel of the interface for a unique player experience.

Left untethered, modern chess engines are ironically too good. After all, if these things can beat grandmasters, they’ll have little problem outsmarting your average (or even expert Xbox) players. Part of the customisable engine code, therefore, exists for you to handicap the game engine, bringing the level of chess it plays down to a more human level. This provides a challenging opponent, without simply demolishing you without a chance.

How nice of it!

One such chess engine is called Fritz, currently at version 17. Fritz has been in constant development since its inception in 1991 when German company ChessBase brought in Dutch programmer Frans Morsch to merge their chess database solutions with his impressive logic code. In 1995, Fritz Version 3 won the World Computer Chess Championship. This was the first time a consumer-level computer defeated the room-sized mainframe computers that had, until then, retained the crown.

Showing that the development of a game engine never rests, Fritz has been through a number of iterations where the core logic engine has been completely replaced. Version 14 (2013) ditched the original Frans Morsch engine to be replaced by Pandix, written by Gyula Horváth, and version 15 (2015) dropped Pandix to be superseded by Rybka, coded by Vasik Rajlich.

Today’s Fritz 17, released in November 2019, has yet another core engine—Ginkgo, by developer Frans Schneider.

Stretching Beyond the Board

One of the beautiful things about modern computer games is how imagination is the only limitation. For 1,500 years, chess stood at the top of the strategy game tower because everything that competed against it had to follow a similar structure—physical pieces tied to a board, cards, or similar. Even model-and-dice-based wargaming, popularised with games like Warhammer 40,000 has a limitation on how deep it can go before the weight of the rules outshine the enjoyment of the game.

Not true when a computer sits in the background, chunking through the calculations as it simultaneously presents the results in a friendly visual fashion.

With a strong strategy engine at the core, strategy games can stretch far beyond the turn-by-turn limitations of a representative game like chess. Why have only eight basic soldiers, when you can represent a full army of a thousand? Why restrict yourself to movement on an 8×8 grid, when you can simulate a landscape complete with hills, rivers and seas?

The imagination was always there. All that was needed was the combined intelligence of hundreds of developers sharing ideas so that years of iteration were possible, each new game building on what had gone before.

From Turn-Based to Real-Time

Turn-based strategy games came first. These often simulate real-world board games or add extended functionality onto similar models, using the computer to do the rules and calculations. There’s a place for turn-based strategy systems, as the games provide different challenges to the more frenetic ideas of real-time strategy.

With turn-based games, the player has time to take a step back and think. Need a break? Leave the game there, get up, walk around. Think about it. Because of this, turn-based strategy games tend to veer towards mental acuity. Players who are very skilled in their logic and strategical thinking will enjoy having time to decide on the right moves.

They’re also easier to code. Like the player, the computer opponent is also given time to ‘think’. Calculations can take time, and they follow set structures. Much like the chess engines, the code crunching behind turn-based strategy games looks multiple moves ahead, determining the correct outcome through a trifecta of brute force logic, evaluation, and data.

1982 Utopia Game

But while a turn-based system provides the right tools for a game, it falls short of being a simulation, something which is an end goal for many strategy enthusiasts.

Enter the real-time strategy genre (RTS). From the early 80s, games began to develop beyond pure turn-based interfaces, with titles such as Utopia (a city-building game for the Intellivision, 1982), The Ancient Art of War (a troop battle simulation for Apple II and MS-DOS, 1984), and Stonkers (tank combat on the ZX Spectrum, 1983). Games like these pushed the boundaries of their turn-based roots, but it wasn’t until Herzog Zwei, a Sega MegaDrive/Genesis game, that the world was truly brought real-time strategy and tactics—in Mech form!

Dune II followed in 1989, setting the parameters for RTS for the next few years, which was superseded by the worldwide megahit, Command & Conquer in 1995.

Letting the Genie Out…

If Command & Conquer put the concept of RTS in the public eye, it was Microsoft and Ensemble Studio’s masterpiece that took it to the next level.

Now well over two decades old, Age of Empires remains one of the finest examples of RTS gaming ever. To thank for all this is the Genie engine.

Understanding that the development of a game like this required a robust engine, Ensemble created Genie, which became the central core to the Age of Empires series. Genie had all the code for the AI, dealt with the graphics, handled user input and multiplayer modes, and provided a framework. This left the designers with time to allow their imagination to run free.

Want a different type of building? Not a problem, put the data into Genie and it’ll work. Need a different type of troop? Easy, Genie’ll handle it.

With the core engine separate from the flavour and context of the game, one could be developed without impacting the other.

It wasn’t without its problems. Bugs in the engine would propagate throughout the system and were easily exploited by players worldwide, but it could as was patched and further developed. When the development team was asked for more, Genie provided them with the tools to produce an expansion pack for the game with extra nations, and new units to go with it. Then, when Age of Empires II was desired, Genie delivered.

Playing Draughts, Badly

Skip back a few years to the early 1980s and the Memotech MTX512. On a cassette tape lies Draughts. A simple title for a simpler age.

It should have been a simple idea to teach a computer to play draughts (Checkers for our US friends). It lacks the complexity of chess, and there’s only one type of piece.

Yet the Memotech version of Draughts had a serious flaw. The AI (if you could call it that) of the engine was pretty rubbish. It couldn’t even win a game.

What did the developers do? They made it cheat.

Every so often, the computer opponent would make an illegal move, or even get a piece appear on the board you swore was missing a moment ago. It was the only way that the game could provide any sort of challenge to the human player.

Why mention this now? Because Genie didn’t cheat.

And everything else did.

Resources, Resources, Resources

Modern strategy and tactic games revolve around resources. From the brilliant Sim City, where money is so tight it’s painful, to the sprawling world of Civilization, where everything from oil to bananas is counted–resources enable you to build homes, develop new technologies and arm armies. Without them, you’re stuffed.

So what’s a quick and easy way to make the computer stand a chance against your better brain? Without the decades of research and development that’s in a top-tier chess engine, the code behind strategy games had to do something a little dirtier.

It simply gave the computer opponents more resources.

Say what?

Age of Empires Game Screenshot

Yes, just like the Memotech Draughts game snagging a new piece, in the background of your favourite early 1990s wargame, some AI general somewhere was sneakily adding to his food supply. It’s a bit like stealing money from the bank in Monopoly while your sister is looking at something else.

Ensemble Studios, with their Genie engine, refused to have it cheat. Age of Empires plays fairly—just remember that when you’re being beaten!

This led to some criticism of the game–players felt it was too easy. Well, that’s what can happen if the playing field has been levelled, and the opponent is a first-era Pentium processor.

Some SAGE Thoughts

Back in Command & Conquer land, the developers at Westwood Studios and Electronic Arts were also making the core of the game into an engine they could utilise on other projects. This culminated in an engine entitled SAGE—the Strategy Action Game Engine.

SAGE meant that Electronic Arts was able to develop games quickly and efficiently with the background structure and tactical ability of their leading wargame franchise. One notable title that gained from this reuse of code was The Lord of the Rings: The Battle for Middle-earth and its sequels, proving that with some solid re-skinning and an abundance of flavour, the recyclability of a game engine is very lucrative indeed!

Wonderfully, for wannabe RTS developers, a group of dedicated enthusiasts has created an open-source version of SAGE called (somewhat unimaginatively) OpenSAGE.

Similarly, OpenAGE exists for those looking to recreate the feel of those first Age of Empires games.

These are free to use, putting tactical combat at everyone’s fingertips (if you’re the kind of person who wants to get down and dirty with some code).

Specialised Engines Only?

Are strategy games forced to use strategy game engines? No. There’s a strong community using Unity for RTS development, pushing on the AI developed inside that more generic engine, and enjoying the other benefits that Unity brings (such as a user-friendly interface, and superior graphical capabilities). Equally, should you want to, then Unreal Engine provides a lot of the core functionality that goes into a strategy game.

However, when it comes to battle games, unique rule sets and a desire for optimisation pushes genre developers to create their own engines rather than lead too heavily on existing archetypes.

Next Time…

Ever wondered what goes on behind the controls of a modern aircraft? The answer… an engine.

Join us next time when we look at how the simulation genre has embraced game engines.