Making It Real: Incorporating Physics in Video Games
|Areas of Science||
Video & Computer Games
|Time Required||Very Long (1+ months)|
|Prerequisites||Some programming experience is recommended since this is an advanced project.|
|Material Availability||Readily available|
|Cost||Low ($20 - $50)|
AbstractHave you ever played a video game and gotten so involved that you felt as if you were living inside the game? What were the characteristics of the game that made you feel part of the action? One component of an absorbing video game is an onscreen world that makes sense—a world that takes physics into account. A game in which the player feels the effect of trudging through mud, slipping on ice, or catapulting a bird is more fun than one with no environmental interaction. In this science project, you will create a game or animation including the effects of physical principles. Have fun, because the sky's the limit.
To incorporate physical principles into a video game or animation for a more realistic experience.
Michelle Maranowski, PhD, Science Buddies
Thanks to Steve Johnson, Senior Director of Design and Web Development at LinkedIn, for valuable input on physics, animation, and video gaming.
Cite This PageGeneral citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.
Last edit date: 2018-01-06
Have you ever heard of the video game Pong? It was built and marketed back in 1972 as an electronic version of a ping-pong game. On either side of the screen are two white lines that act as the "paddles" and can be moved up and down vertically. The players use their paddles to bounce a moving circle, which acts as a ping-pong "ball," back and forth, with the object of somehow getting the ball past their opponent's paddle to score points and win the game. How the ball bounces, and the angles and trajectories involved, are all based on physical principles. This video game was among the first to use physics in its design.
The use of physics in video games has improved a lot since Pong. Physics is now playing a greater role in video game design. In 2004, the game Half-Life® 2 ushered in extremely realistic physics to video games. Today, players can immerse themselves in a game and feel as if they are playing in a real world. In fact, when the physics in a game world doesn't make sense, the player's immersion in the game can be easily broken.
But how do game developers incorporate physics into their designs? Do they struggle writing mathematical formulas in the programming language that they use to create the game? What are some common techniques used to simulate action?
First of all, game developers don't usually write complex physics formulas in their games. They rely on pre-made physics engines, or extensions, for the software package that they are using, to supply the physics for the game. An engine or extension is essentially a library of commands and functions that a developer adds to the software to accomplish different kinds of action. Two kinds of engines are used: high-precision engines and real-time engines. Scientists and developers designing computer-animated movies use high-precision physics engines because these projects need lots of processing power and time to perform the detailed calculations. Game developers use real-time physics engines because they don't require extremely detailed calculations; they need quick calculations to make a game look real for the player. Examples of physics engines that game developers use are HavokTM and PhysXTM.
Game developers have to use physics when dealing with the effects of gravity, elasticity, sound, and the interaction of light with objects. Typical physics engines and extensions employ the following techniques to address a variety of situations that depend on physical laws:
- Collision detection. Checks for collisions and then responds to collisions.
- Ragdoll physics. Creates animations that depict a character's death or when a character picks up a limp object.
- Deformable bodies. Gives objects the ability to deform and shatter.
- Soft-body physics. Allows for the simulation of hair, water, clothes, etc. The calculations here are very complex.
- Particle physics. Allows for the simulation of phenomena like snow, rain, dust, and explosions.
Each of these techniques uses a variety of algorithms, or a list of coded instructions, to perform calculations, based on physical laws and modeling methods, to perform the simulations.
In this science project you will add a physics engine to a game-oriented programming environment like GameMaker, and use it to incorporate actions based on physical principles into a simple video game or animation of your own design.
Terms and Concepts
- Physics engines
- High-precision engines
- Real-time engines
- Collision detection
- Ragdoll physics
- Deformable bodies
- Soft-body physics
- Particle physics
- ZIP file
- Catapult physics
- Flow chart
- Have you played any video games that seemed unreal to you or defied physics? How did that affect your game play?
- Can you determine the physical principle or law behind the effects that you see in the video games you play?
- What is a graphics processing unit (GPU), and how do GPUs contribute to game play?
- What is Newtonian physics?
- What kinds of algorithms and modeling methods are used in the physics techniques mentioned in the Introduction?
- Arnason, B. (2008, March 28). Evolution of physics in video games. Retrieved November 17, 2011, from www.olafurandri.com/nyti/papers2008/Evolution of Physics in Video Games.pdf
- Jakobsen, T. (2003, January 21). Resource guide: Advanced character physics. Gamasutra. Retrieved January 3, 2018, from https://www.gamasutra.com/view/feature/131313/advanced_character_physics.php
The following articles discuss different techniques employed by typical physics engines:
- Wikipedia contributors. (2011, November 4). Ragdoll physics. Wikipedia: The Free Encyclopedia. Retrieved November 17, 2011, from en.wikipedia.org/w/index.php?title=Ragdoll_physics&oldid=459026040
- Wikipedia contributors. (2011, September 24). Soft body dynamics. Wikipedia: The Free Encyclopedia. Retrieved November 17, 2011, from en.wikipedia.org/w/index.php?title=Soft_body_dynamics&oldid=452273831
The following article investigates the physics of the popular Angry Birds game. It may give you some ideas that you can use in formulating your own game. At the bottom of the article are some other links related to physics and gaming that you can check out:
- Allain, R. (2010, October 8). The Physics of Angry Birds. Wired.com. Retrieved November 22, 2011, from www.wired.com/wiredscience/2010/10/physics-of-angry-birds/
- Schiesel, S. (2011, May 10). Physics, with wormholes by you. New York Times.com. Retrieved November 22, 2011, from www.nytimes.com/2011/05/11/arts/video-games/portal-2-a-video-brain-game-review.html
This page will help you get started with a programming language you can use to make a video game:
- Science Buddies staff. (2017). Kid-friendly Programming Languages and Resources. Retrieved January 3, 2018 from https://www.sciencebuddies.org/science-fair-projects/references/kid-friendly-programming-languages
News Feed on This Topic
Materials and Equipment
- Computer with internet connection
- Programming language of your choice. See the Kid-Friendly Programming Languages and Resources page for some ideas, although this project is better suited for more advanced languages like GameMaker that include physics engine capabilities or add-ons.
Preparing to Design Your Game or Animation
The goal of this project is to design a video game or animation that incorporates the laws of physics to make it realistic for the player or viewer. To do this, you will need to do some background research on available programming languages and physics engines that you can use. The Kid-Friendly Programming Languages and Resources provides some information about programming langauges, but you will need to do your own research about physics engines. GameMaker is a good language to start with because it contains some built-in physics capabilities and there are third-party add-ons available.
Designing Your Game or Animation
- As noted at the beginning of this procedure, this project follows the Engineering Design Process. If you run into trouble making your game or animation, or if you feel you want more practice before starting this project, check out the home page for your programming language. It should contain tutorials, help documentation, and forums where you can ask questions.
- Define the problem. In this case, you will create a simple video game or animation that incorporates physics for a more realistic gaming, or viewing, experience for the player. Refer to the Science Buddies Define the Problem page to help you set the boundaries for the project.
- Do background research. Read about the history of physics in gaming and think about how physics can be used to make a game or animation better.
- Read the article "Evolution of Physics in Video Games" and other references in the bibliography to develop an understanding of how physics was used in games and how it is used now, and the various techniques employed for realistic simulations.
- Also start thinking about the goals of building a successful video game.
- Specify requirements. The project requirements are the characteristics that your video game or animation must have to be successful. In this case, to be successful, your game or animation must incorporate physical principles, resulting in a more realistic experience for the player. Refer to the Science Buddies Specify Requirements section for tips on how to formulate your game's design requirements. Here are some ideas to consider when formulating the requirements:
- Will you be designing a game or animation?
- What is the overarching concept of your game or animation? For instance, will you bounce a ball in a room? Create a bowling game? Throw bombs at a castle wall in a medieval game? Or ride a car through an obstacle course?
- What kinds of physical principles will you demonstrate? Bounce a ball against a wall and experiment with momentum? At what angles will the ball bounce off the wall? Roll balls on various surfaces and take friction into account? How will mud differ from grass? Or will you play with catapult physics and experiment with beam angles?
- What kinds of sprites (that is, images or animation) will you be using in your game or animation, and where will you get them?
- What are the physical actions that you wish to demonstrate throughout the game or animation? Does the physics engine you are using support these physical actions? How will you use the physics engine to enhance your game or animation idea?
- How much time can you spend on writing the game or animation? You need to write the game or animation and then test it. Try to manage your time wisely.
- How long will the game or animation last?
- What will be the player's goal and how will the game or animation end?
Building Your Game or Animation
- Create alternative solutions. Keeping your project requirements in mind, think about different ways that you could build your game or animation. Take a look at this Science Buddies document Create Alternative Solutions to guide your efforts.
- Think about different ways you could accomplish something in your game or animation. Is one simpler and still just as good? Would one solution change your original game or animation idea a little, but might end up making it better in the long run?
- Once you have developed a few solutions, analyze the solutions by making rough sketches and flow charts for each one. Refer to the Science Buddies Choose the Best Solution document to help you pick a working solution.
- Develop the solution Once you have created a set of requirements and a possible solution, it is time to open your programming environment and start working on building a sample video game or animation. After you are satisfied with the sample you create, move on to the actual programming.
- Build a character or object and have it operate in a simple version of your game or animation. Remember to review your requirements so that you keep yourself focused on the task. For guidance, review the Science Buddies Prototyping document.
- Program your video game or animation and keep testing it as you work. When you have fulfilled a requirement or task, run the game or animation and test it out.
- Break the programming up into smaller tasks, so that the project is not overwhelming.
- Test the game or animation along the way so that you can fix small issues as they come up. This will prevent your having a long set of events at the end that don't work.
- Once you have finished your game or animation, check to see that all of the project requirements are fulfilled.
- Test and redesign. Review the Science Buddies Test and Redesign document to help organize your work. Test your game or animation out on your family, your friends, and yourself. Take notes on what your players enjoyed and didn't enjoy about it. Use the feedback to improve your game or animation.
The Final Product: Presenting Your Game or Animation
- When presenting your game or animation at your science fair, try to bring in a computer. If you are not able to do so, take screenshots of your work, print them out, and mount them to a poster board.
- You should include the following items in your presentation:
- A list of your project requirements that guided your building of the video game or animation.
- The rough sketches or flow chart that describes how the game or animation works.
- An explanation of what you learned from your research and from ceating a realistic video game or animation based on physics.
- If you would like to publish your game or animation for a wider audience to play, check the home page for your programming language. Many of them have options to upload your program or game and share it online.
Keep the fun going! Find local opportunities related to this project.Register on ActivityHero
If you like this project, you might enjoy exploring these related careers:
- Delve deeper into the physics. Instead of using a physics engine or extension, can you write any of your own physics functions from scratch?
- If the right physics are not in a game or animation, the game world may seem unreal. To demonstrate and test this out, you can make a different version of your game or animation where the physics is not included in one or two features. How will this affect game play? Will your players notice the difference?
- If you know another programming language, try incorporating what you learned about using physics engines into a game or animation created with that language.
Ask an ExpertThe Ask an Expert Forum is intended to be a place where students can go to find answers to science questions that they have been unable to find using other resources. If you have specific questions about your science fair project or science fair, our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.
Ask an Expert
News Feed on This Topic
Looking for more science fun?
Try one of our science activities for quick, anytime science explorations. The perfect thing to liven up a rainy day, school vacation, or moment of boredom.Find an Activity
Explore Our Science Videos
Colorful Melting Ice Ball Patterns - STEM Activity
Slippery Slopes - STEM activity
How to Make Elephant Toothpaste