As a designer, I of course have a desire to make games, but one of my stumbling blocks is programming. Since I never had any formal education in Computer Science (my degree was a Bachelor of Arts in Computer Games Design) this has always been a bit of a hurdle for me when trying to build my own games. But about nine years ago I started digging into how to do this, starting with GameMaker and its own language. I then moved on to Unity, using C#, then Unreal’s Blueprints system, and – more recently – C++ within Unreal. I’ve learned A LOT in that time, but I’ve increasingly felt that I needed a solid Computer Science foundation in order to fully understand some of the inner workings of games which will subsequently help me to program faster and more efficiently without bashing my head against a wall on problems that a lot of programmers will know the answers to quickly and easily. This became more apparent when I recently ran into a problem I’d experienced with Unreal’s AI Navigation system, which required me to delve into the source code, and – while I pretty much solved the issue – it still left me without a full grasp of how its underlying structures and syntax fitted together.
To that end, I embarked on finding quality learning, that aligned with my current level of knowledge but would push my understanding of low-level and foundational Computer Science further and found Gustavo Pezzi’s Wolfenstein Raycasting Course which starts with a JavaScript prototype, then moves into using C for the full implementation of the engine. Building a game from scratch, without an existing engine, is fairly daunting for a typical non-programmer like myself but id Software’s Wolfenstein 3D from 1992 is old enough and simple enough to understand more completely in its entirety even than something like Doom from the following year so it seemed like a good fit. Not too complex, and at my knowledge level, but also pushing me further. The course is mostly about the wall and world rendering, with a section on sprites, so there is no animation, AI, or other game logic within, but that’s fine. I was mostly fascinated with how the raw raycasting algorithm worked.
The final implementation of the engine uses plain old C, the SDL library for basic window handling, and a PNG decoder to load texture data into memory and that’s it, no other libraries or engines used. It’s a pretty magical moment when you create something purely from mathematics that then becomes an entire world on screen.
For anyone wondering how it works, the short answer is to pay attention to the minimap in the top left. The player camera is firing a number of rays equivalent to the pixel width of the screen (in this case 800 at a screen res of 800 x 450) within the field of view.
Each ray uses some trigonometry, and good old linear algebra to determine if it’s hitting a grid section that’s a wall or not. If it is, it checks the distance to the wall and vertically scales that pixel column appropriately. It then renders each vertical pixel based on a texture id assigned to the wall and the cartesian coordinates of the texture’s colour data.
One of those old discussions about scope came up recently at work, so I was interested to see how long it would take to make something in as small a scope as possible.
So I made Pong, you can play it via the link above. It probably still has a few bugs, but should be mostly stable. You can play it in a browser in either singleplayer or a couch multiplayer mode, side by side. It uses keyboard controls but should also support XBox and Playstation controllers
It took me probably a couple of hours (if that even) to get a simple working version of it up and running. But I ended up taking it further, and over the next few evenings I coded in some pretty basic AI for a singleplayer mode, a menu to choose between the two, some audio, and fixed a load of bugs.
Pong was an obvious candidate for a small scope game: the controls are simply up and down, and any modern engine (I used Unity) can handle the ball’s physics movement and collisions pretty easily. Creating a game as small as Pong is also a great exercise in experiencing the process of creating and releasing a full game. And is, as most game developers will already know (and are always eager to drill into students), eye opening in terms of what proportion of time is spent on developing the various aspects of an entire game.
Bugs probably took up most of my time, which was mostly down to getting the ball’s physics to behave properly, and some UI issues with selection and click sounds. Aside from bugs, it was the extra features I decided to implement that took up the rest of the time. The AI for the singleplayer mode is pretty rudimentary and can still definitely be improved. Despite this it still took up a fair proportion of the time.
AI Mechanics
The AI predicts the path of the ball by first checking if the ball is heading towards them. It then casts a ray from the ball’s position, along the ball’s forward direction, until the ray hits a point on the right edge of the screen. It takes the Y position of the point hit, then moves towards it (at the same speed a human player could for fairness) in order to block the ball. Obviously this would produce a perfect block every time, provided that the AI could reach the blocking point in time, so I introduced a random factor of error by adding or subtracting a random amount into the Y position to try and simulate a real player not quite guessing the path of the ball correctly. This process is then repeated after a short time (also randomised within a range) for correction as the ball is continuing to travel towards the AI.
The ball is casting a ray in the direction of its travel. At this vector it will hit the top right corner, so the AI moves to intercept it.The main AI coroutine, it’s recursive, but the delay before it repeats again is set in the coroutine itself
The AI could still do with some improvement. As of yet it does not correct itself for the ball’s position more accurately as the ball gets closer (just as a human player would), but this is pretty easy to fix. It also only tries to predict the ball’s final position when the ball is facing towards the right edge of the screen, it cannot predict the direction of the ball before a bounce from one of the top edges. This is trickier to fix as I have to calculate the ball’s direction vector after the bounce. It’s possible of course, but I’ll have to dig into some more physics maths.
Extra Mechanics
While Pong is a simple game, there are strategies and mechanics that permit more skilled play, and deepen its gameplay somewhat. By changing the direction of the ball depending on what part of the paddle it hit, we can add some player control to its velocity. In my version (and I think this is similar for the original) if the ball hits the very centre of the paddle it will move horizontally back across the screen. However, if the ball hits anywhere between the centre and the top edge of the paddle, its direction will be altered according to how far it is from the centre, up to a maximum angle of 45 degrees.
So if the ball hits the very top edge of the paddle it will be fired upwards at a 45 degree angle. If it hits the bottom edge it will be fired downwards at 45 degrees. If it hit exactly between the centre and the top edge it would be fired upwards 22.5 degrees and so on.
The mechanic also provides a nice risk/reward balance. Hitting the ball closer to the top or bottom edge of the paddle is harder to pull off and you risk losing the ball. However managing to do it, and hitting the ball off at an extreme angle, makes it harder for your opponent to catch.
The ball has hit the top edge of my paddle, therefore it will direct itself at probably the maximum angle upwards (45 degrees)
All in all, it’s a good exercise in creating and releasing a full game, and all the pitfalls and challenges that come with it. The basic (probably buggy) version took me an hour or two, but that version had no win conditions or anything that could define it as a complete game. Everything else took me a few more evenings to create, package, and release a full game. If anything it’s a reminder of that old maxim that the last 10 percent is 90 percent of the work.
Now that it’s done though, I could still improve it more, but I might start making other classic games just to see what the process is, and there’s always something new to learn even from the smallest of titles.
No, not 3D modelling, and no not catwalk modelling either. But rather the way in which we represent intellectual property, narrative themes, and real world roles in games. Modelling therefore, in the context of game design from here-on refers to how a game implements the themes and actions of the original narrative or real world activity that it is based on. I’ve recently been drawn into thinking about these concepts since playing a particular board game that models its source material quite superbly, one that is based on The Lord of the Rings.
War of the Ring
War of the Ring is a popular grand strategy board game based on the Lord of the Rings books by J.R.R. Tolkien. It’s a competitive two-player game where one side plays as the dark lord Sauron with his evil forces of Mordor, and the other as the Free Peoples of Middle Earth with their fellowship heroes. It is certainly grand, and games can be very long, akin to the likes of Star Wars Rebellion and the Game of Thrones board games.
What War of the Ring manages astonishingly well, is to make you feel like you’re reliving the story of The Lord of the Rings, despite the fact that each game feels likes its own separate story and the player’s own separate spin on the original tale. You have plenty of agency and free will to make your own decisions on how to move your characters and armies, yet each game feels connected to the plot and themes of the books.
These themes and plot points of The Lord of the Rings are expressed in the game through mechanics that span from simple, to deep implementations. For example, at a basic level, one of the rules for the character of Saruman is that he can never leave his region of Isengard on the map. This models the events of the story (in the films) that Saruman indeed never leaves that region. But this is a very basic rule that brute forces that particular aspect of the story onto the player. What makes the game more interesting are the deeper methods of making the player feel like they’re recreating the story of The Lord of the Rings.
For example, as the Mordor player, you must constantly search for the ring. You do this by assigning the limited dice you have available at each turn to be used for this purpose. Thus, the Mordor player must make a decision each turn: spend more time focussing on the hunt for the ring, or instead use more dice to move armies and conduct battles. This models nicely into the idea that Sauron’s gaze can be distracted by his lust for the ring. In fact this idea is used as a strategy at the end of the book where the Free Peoples lead an assault against Mordor in order to distract Sauron from focussing his gaze on Frodo, who is very close to destroying the ring.
Hope, Immortality, and The Machine of War
The Free Peoples’ hope for victory hangs by a thread, the elves are leaving the lands, and what good is left in the world must hold out against a tremendous force. The huge growing armies of Mordor are formed in an almost industrialised method. Hope relies on Frodo destroying the ring in Mount Doom as the Free Peoples cannot hope to achieve victory through force of arms alone, unless they band together.. yet some are more reluctant to go to war than others…
All of these ideas are expressed through some nifty mechanics in War of the Ring. The Free Peoples are fragile, and when one of their units is killed, they are permanently removed from the game. When a Mordor player’s unit is killed however, it is put back into the supply pile, ready to be mustered on to the battlefield once more. The Free Peoples player therefore sees his units as more fragile, their life more precious. The Mordor player sees their units as indispensable pawns. Given this scarcity of manpower, the Free Peoples’ player must also convince more races to join in war against Sauron if they are to have any hope of defending themselves.
War of the Ring’s political track requires that each race first be ‘At War’ before they can muster armies or move them into enemy territory. This staged process can be advanced through use of a certain dice roll, invasion of their territory by the enemy, or – for the Free Peoples’ player – visiting a race’s settlement with their heroes. It’s a system that neatly ties into the book’s narrative about races who, for various reasons, are unwillingly to go to war, or even help one another, and must be persuaded to, lest they find themselves succumbing to Mordor.
The political track for each race is advanced through invasion of their territory, a dice roll, or persuasion
Each game of War of the Ring still manages to feel different, each game still creates a new narrative, one that is personal to both players. Yet each game also still captures the essence of The Lord of the Rings’ story. And this is really the key, it is the essence of the story, the themes that are important, not the events of the story itself that make the player feel they are a part of Middle Earth at this point in its history.
The name’s Bond, I murder everyone
Goldeneye on the Nintendo 64 is a fantastic game. In 1997 it was the first commercially successful first person shooter on a console that convinced me that consoles could do first person shooters well (and this is coming from an almost exclusive PC player).
But while Goldeneye was amazing, I feel that its modelling of Bond and the narrative themes and tropes that come with that saga were lacklustre. Bond is much more than just shooting and gadgets. He’s skilled in the art of deception, interrogation, he’s a driver, a pilot, a smooth talker, a gambler, and of course, a womaniser (though that last point is maybe not the most tasteful thing to model in a game..). That last point, and his orphaned past, even provides a potential hook into mechanics that explore his flaws.
It’s important to point out though, that not modelling Goldeneye accurately to those themes of a Bond movie (or book) doesn’t make it a bad game. It didn’t really matter, the game still held up to the cold light of mass criticism; it’s still a good game. Conversely, it’s also just as important to point out that none of this is suggesting that effective modelling in games creates a great game either.
But it’s interesting to wonder what Goldeneye would look like if it was modelled more faithfully to the tropes of its source material. IO Interactive – they of Hitman fame – are currently working on a 007 game, and to be honest, I feel like the recent Hitman trilogy from 2016 onwards actually embodies the themes of Bond more than Goldeneye did, which could make for a new Bond game by them really quite interesting.
Narcos: Rise of the Cartels
Narcos, the XCom-like game based on the TV series about drug lords, wasn’t received particularly well, commercially and critically. But what stood out most to me was how the gameplay bore little resemblance to the actual plot points of the TV show.
Like Goldeneye, the Narcos game focussed on one singular element of its source narrative, shooting the bad guys. Progression in the game is also confined to a series of linear missions, with some additional side missions thrown in for flavour. But there’s so much more to Narcos than that, and the series has so much more potential for interesting gameplay. Gathering evidence, exposing corruption, persuading politicians, using informants, all of these activities act as setups for combat but are just as relevant to the source material.
Alien: Isolation
But are there any examples of good video games that also model their source material well? I think Alien: Isolation is a good candidate. It explores and expresses such themes and tropes as: survival of the fittest, loneliness (isolation, literally), heritage, motherhood, and primal fear.
The second Alien film (Aliens) utilises strong themes of survival and motherhood in the relationships between not only the principal character Ripley and the sole child survivor Newt, but also a further entangled relationship with the Alien Queen and her eggs. Even the Facehuggers themselves feel like a warped, distorted, and terrifying allusion to the trauma of giving birth.
Alien: Isolation’s principal character is Ripley’s daughter, setting out to find her mother, during which she encounters abject terror in the form of the Alien, and corporate corruption in the form of Weyland Yutani. Additionally the mechanics of Alien: Isolation feel like a childlike game of hide and seek, except the hunter is the Alien, an apex predator and the only known species to effectively threaten human survival. Through some of its mechanics then, Alien: Isolation has managed to really capture the spirit of the franchise, while also being a great game.
But how do we model a game effectively to its source material?
Like a lot of things in design, or art in general, I don’t think there’s an easy answer or rule. After all, no game design survives beyond first contact with its players, and I certainly would never profess to have all the answers. But maybe there are a few things that we can do to help capture the spirit of the source material, such as:
Identify the deeper themes and tropes.
Understand that effective modelling may not just be about replicating narrative, but more about making a player feel the same way they do when consuming the source material.
Identify the problems that characters face in the source material and how they overcome them. How would this be represented as a game mechanic?
Why a character does something, may be much more important than what they do.
And of course, playtest. Playtest, playtest, playtest.