UPDATED 12:55 EST / 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)

A message from John Furrier, co-founder of SiliconANGLE:

Your vote of support is important to us and it helps us keep the content FREE.

One click below supports our mission to provide free, deep, and relevant content.  

Join our community on YouTube

Join the community that includes more than 15,000 #CubeAlumni experts, including Amazon.com CEO Andy Jassy, Dell Technologies founder and CEO Michael Dell, Intel CEO Pat Gelsinger, and many more luminaries and experts.

“TheCUBE is an important partner to the industry. You guys really are a part of our events and we really appreciate you coming and I know people appreciate the content you create as well” – Andy Jassy

THANK YOU