Friday, October 7, 2016

Are You a Gamer?

Calling all gamers! Have you ever wondered how video games actually work? If so, this is the blog for you!

Whether you're playing Call of Duty, Super Mario Brothers, or Cooking Mama, your game is running on a "game loop". This is a piece of code that runs over and over again, possibly hundreds of times per second, to tell the hardware what to draw on the screen. The image below shows how the computer updates the screen:



The three main stage of the loop are: update player input, update the game world, and tell the graphics card what to render. An image of this code is shown below:


The human brain and eye perceives images individually if there are 10-20 frames per second. Any more, and the images become continuous and the different frames are not perceived! If it is producing 30 frames per second, that means the computer has .0333 seconds to produce each frame. 60 frames per second, and the computer only has .01666 seconds.  How do video games produce images so quickly? While an image is being shown, the computer is producing the next image on the fly! These images are drawn on something called a framebuffer, which is a large grid of pixels on the screen.  While the computer is working 60 frames a second on graphics, that only leaves .005 to detect and respond to player input, produce sounds, and work on collision detection. Computers work at a speed so much faster than the human brain, which allows computers to make video game graphics so realistic! So cool!

 References:
http://howtomakeanrpg.com/a/how-do-video-games-work-basic-architecture.html

2 comments:

  1. I love playing cooking mama! I think I'm going to love it even more now that I have more incite on how the graphics work (if it's even possible to love cooking mama more than I already do!!😏) What is the most common FPS setting in games? Does it vary by platform?

    ReplyDelete
  2. nice entry! thats crazy how fast processors and computers have to draw and redraw images on the screen. I never would have thought that games work on a frame by frame basis and that makes it so impressive to see games with incredibly detailed graphics being refreshed at something like 60 fps

    ReplyDelete