Presentation is loading. Please wait.

Presentation is loading. Please wait.

How do games work? Game Workshop July 4, 2006. Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects.

Similar presentations


Presentation on theme: "How do games work? Game Workshop July 4, 2006. Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects."— Presentation transcript:

1 How do games work? Game Workshop July 4, 2006

2 Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects

3 Game entities Items the player interacts with More precisely, a self-contained piece of logical interactive content Example: Player character Enemies Walls to collide with Not: Background map & music

4 Game entities in GM In GameMaker, entities are OBJECTS Other items are in the game too Sprites Sounds Backgrounds Tiles

5 Computer runs the game How? What does it have to do? Draw the background Play music Draw entities Detect key presses Detect mouse Detect collisions of entities Send messages Do calculations (math) Control items: if no lives then end game

6 When do we do them? How many times a second?

7 Your computer Draws the screen about 30-60 times in one second Games do all the tasks we wrote about 30-60 times a second also

8 Game loops Games are driven by a game loop that performs a series of tasks every frame Some games have separate loops for the front and and the game itself Other games have a unified main loop

9 Game Loop Does each of the tasks for running the game Repeats 30-60 times per second Does the order of tasks matter? Sometimes Sending network messages is important for time-dependent multi-player games

10 Tasks Handling time Gathering player input Networking Simulation Collision detection and response Object updates Rendering Other miscellaneous tasks

11 Coupling Can decouple the rendering step from simulation and update steps Results in higher frame rate, smoother animation, and greater responsiveness Implementation is tricky and can be error-prone To do it, we make simple calculations for the rendering, and correct them later when we get the math results

12 Execution order Most of the time it doesn't matter In some situations, execution order is important Can help keep player interaction seamless Can maximize parallelism Exact ordering depends on hardware

13 Updating game objects Updating each object once per frame can be too expensive Can use a tree structure to impose a hierarchy for updating Can use a priority queue to decide which entities to update every frame

14 Loading levels When we change levels we need to load all the resources and objects for the level Also have to load the “game state” – states for all the game objects/entities This can take some time


Download ppt "How do games work? Game Workshop July 4, 2006. Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects."

Similar presentations


Ads by Google