informa
/
2 MIN READ
News

Sponsored Feature: Two Brains Are Better Than One -- How to Thread Game AI 2

This Intel-sponsored feature, part of Gamasutra's Visual Computing section, presents a practical look at how
In this Intel-sponsored feature, part of Gamasutra's Visual Computing section, game programming veteran Orion Granatir presents a practical look at how to use multi-core CPUs to thread game elements, in this case artificial intelligence (AI) for your game. Whether discussing complex pathfinding systems or simple scripting engines, AI drives gameplay -- and to maximize AI's potential, it needs threading in order to utilize the entire CPU. As Granatir explains in the technical article's introduction: "The concepts described in this article were used in the creation of the multithreaded AI of Intel's Smoke demo. This demo showcases functional and data decomposition with multiple game technologies, including physics, audio, and AI. The source code is free to download at Whatif.intel.com." Granatir offers illustrated examples of a sample AI, and then defines challenges of threading its code: "For our simple AI, we need the collision and the move system to be thread safe. We could put locks around any access to these systems, but we'll see lower performance because threads will have to block and wait for each other. The solution for collision and pathfinding are similar, so let's focus on collision. For the collision system we will have multiple requests in parallel. For multiple readers, the collision data is just fine. This is no different from the serial case because the data is not changing. When someone starts writing data, then we have work to do. Data access to be protected (with locks) or the data has to be double buffered. If the data is double buffered, the readers can just access the data from the last frame and not worry about the writes until the next frame. We can run collision independent of AI three ways: issue early and use late, deferred requests, and task stealing. Each is worth a bit of investigation." The full Gamasutra sponsored feature goes into greater depth on the multithreaded AI concepts used in Intel's Smoke demo.

Latest Jobs

Cryptic Studios

Remote
1.19.23
Senior Producer

Anne Arundel Community College

Arnold, MD, USA
1.30.23
Instructor/Assistant Professor, Game Art

Night School Studio

Los Angeles, CA, USA
1.09.23
Level Designer / Scripter, Games Studio
More Jobs   

CONNECT WITH US

Explore the
Subscribe to
Follow us

Game Developer Job Board

Game Developer Newsletter

@gamedevdotcom

Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Browse
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more