UPDATED 12:55 EDT / APRIL 03 2015

NEWS

How chaos theory comes into play in designing video games

Mouse TrapIn theory, programming a video game should be nice and mathematical, with each line of code following an ordered structure that produces straightforward, predictable effects. You tell the program to spawn a monster, it spawns a monster. But as game designs become more and more complicated, adding things like realistic physics and destructible environments, the outcome of an action is not always predictable, which can result in all kinds of unexpected glitches.

Veteran game developer Kevin Ryan attributes these unexpected outcomes to the butterfly effect, an element of chaos theory that says that very minor changes can cause a chain of events that result in a disastrous outcome. The butterfly effect is named for the common example of a butterfly flapping its wings, which results in subtle atmospheric changes that cause a hurricane hundreds of miles away.

Ryan was the creator and coder of The Incredible Machine, a whimsical 1992 game that allowed players to build complicated Rube Goldberg machines that moved objects around with conveyor belts, springs, and other contraptions. More recently, Ryan created Contraption Maker, a spiritual successor to The Incredible Machine that is available through Steam.

 

“The butterfly effect becomes very obvious”

 

In an article on Gamasutra, Ryan explained the difficulties he ran into when creating the game, attributing many of the problems to chaos theory and the butterfly effect.

“When you have a contraption made up of possible hundreds of parts that are interacting with each other for hundreds or thousands of frames then the butterfly effect becomes very obvious,” Ryan wrote. “Move a tennis ball over by just 0.0001 units and it may bounce off a teeter-totter a fraction of a second later and then make something else bounce left instead of right and divergence is off to the races.”

Ryan explained that “as long as the initial starting positions of all the parts were the same then the contraption should always run exactly the same.” But because Contraption Maker is cross platform, the way things things move could change between different platforms based on how they calculate certain numbers.

According to Ryan, the eventual solution used “an automated determinism check” that persistently monitors the way objects are behaving compared to a predetermined value. This allowed the developers to catch and correct errors as they made updates to the game.

photo credit: Rube Goldberg setup, Saturday via photopin (license)

Since you’re here …

… We’d like to tell you about our mission and how you can help us fulfill it. SiliconANGLE Media Inc.’s business model is based on the intrinsic value of the content, not advertising. Unlike many online publications, we don’t have a paywall or run banner advertising, because we want to keep our journalism open, without influence or the need to chase traffic.The journalism, reporting and commentary on SiliconANGLE — along with live, unscripted video from our Silicon Valley studio and globe-trotting video teams at theCUBE — take a lot of hard work, time and money. Keeping the quality high requires the support of sponsors who are aligned with our vision of ad-free journalism content.

If you like the reporting, video interviews and other ad-free content here, please take a moment to check out a sample of the video content supported by our sponsors, tweet your support, and keep coming back to SiliconANGLE.