Maths in video games

james.png

My name is James Hyde and I am a build engineer at the UK’s leading games studio – Creative Assembly (CA) – currently working on several titles – including our brand-new IP! I’ve been with CA for two years now; my first project was Halo Wars 2 (HW2) – the sequel to one of my very favourite games. Working on a project I’m so passionate about, on the team behind Alien: Isolation, in the studio behind Total War – and owned by the company that gave us Sonic and the Mega Drive! – is literally the best job in the world. Since becoming a build engineer there has never been a dull day.

Working on a project I’m so passionate about… is literally the best job in the world.

A build engineer is responsible for the ‘build’ (essentially a working version of the game at any point in time) and for delivering these to third parties (whether that’s our parent company – SEGA – or a collaborative partner – such as 343 Industries). Within – and indeed behind – each one of these builds is an abundance of mathematics.

halowars1

My passion for maths stems back as far as I can remember. It was the orderliness, absoluteness and purity that first captivated me – and the fact that I had an affinity for it – but what kept me intrigued as I grew up – and the reason I studied maths at A Level and beyond – was its breadth of applications. Many of those applications can be found in games development.

halowars2

Software development in general is full of maths, however, nothing quite boasts a spectrum of mathematics like the modern-day video game. Unlike most other software applications, games typically simulate elements of the real world, such as physics and lighting. All games employ some form of mechanics, whether discrete or continuous, and these often involve randomisation, conversions and feedback loops (from diminishing returns to arms races). A large part of the design process involves balancing risks with reward – game theory is a whole area of maths dedicated to this problem. And it is commonplace these days to balance unit and mission stats post-launch, relying on sophisticated statistical analysis of huge swathes of session data.

The code in particular is teeming with maths.

There is so much maths going on under the hood of HW2 and so many artefacts of mathematical work having been implemented: linear transformations behind the unit animations, linear interpolation for the camera movement, and trigonometry to calculate visibility bounds – to name a few. The code in particular is teeming with maths. Software code in general makes significant use of algebra, sets, relations, functions, logic and optimisation.

halowars3

The engine is the subset of code that transcends instalments yet is continuously improved upon throughout production. In HW2, the engine team focused on improving the rendering, lighting and physics systems. The physics system naturally employed Newtonian mechanics and the rendering and lighting made extensive use of trigonometry, linear algebra and calculus. Also, a firm grasp of imaginary numbers was required for the spherical harmonics used in the Shaders.

HW2’s core game-specific code includes systems for artificial intelligence, locomotion and combat. The AI system uses geometry, trigonometry and linear algebra, particularly in its avoidance code – part of which was integrated from Alien: Isolation. The pathfinding required deep knowledge of networks and the most efficient graph traversal algorithms. Both the locomotion and combat systems made use of equations of motion: including ballistic projectiles, such as Reaver missiles, Kodiak artillery shells, and Jump Pack Brutes. For the hit-scan weapons, such as the Scarab and Locust beams, simultaneous equations are solved in real-time to calculate the intersection of the raycasts and hitboxes.

halowars4

Like any video game, HW2 runs on numbers, shapes and logic. Not only do all our devs require a firm grasp of fundamental mathematical concepts but this game would not be possible if it were not for the recruitment of specialised devs with a strong mathematics portfolio – often having read maths or computer science at university.

Like any video game, Halo Wars 2 runs on numbers, shapes and logic.

Game development is just the tip of the iceberg when it comes to career paths for budding mathematicians. Whoever you are, whatever your background, if you see the beauty in mathematics and enjoy solving problems then consider pursuing maths in Further and Higher Education. If you also relish creativity and have a passion for video games then consider a career in the games industry: CA has studios in both Horsham – a quaint market town in the south of England – and Sofia – the lively capital of Bulgaria. Come chat to us at EGX this April or reach out to us on Twitter: @CAGames!

James Hyde