Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET Game Programming (http://www.xtremevbtalk.com/-net-game-programming/)
-   -   Moving 2 sprites without using a timer. (http://www.xtremevbtalk.com/-net-game-programming/326812-moving-2-sprites-using-timer.html)

sjm2357 02-04-2014 12:28 PM

Moving 2 sprites without using a timer.
 
Hi all,
I'm new to game programming so please excuse me if this has been asked before....

I've created a Pong game that uses a timer to control the main loop of the game, but I've seen another game (Pacman) that has multiple sprites moving at the same time without using a timer.
The Pacman game has classes for the sprites, does this remove the need for a timer? I mean does the game create a new thread for each of the sprites, or how is the game controlled?

Thanks,
Sean.

snarfblam 02-04-2014 02:54 PM

Using a timer is generally an uncommon method of driving a game engine. It's easy for beginners and works well enough for the simplest of games, but as you move on to more advanced projects it quickly becomes inadequate. Timers can be slow or imprecise, and worse, the precision can vary between machines.

Some games use an idle loop. In VB or C# this means updating your game every time the Application.Idle event fires.

In other cases, the timing of the game engine is managed by a graphics library. The game loop updates game logic, renders graphics, and then displays them on the screen, the latter two being done via the graphics library. XNA addresses this at a high level, helping you separate game logic from rendering logic and managing the timing and frame skipping. Lower-level libraries like DirectX and OpenGL leave some of this work up to the programmer.

The determine which method is used by a particular game, you would generally have to look at the code and see.


All times are GMT -6. The time now is 09:40 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.