This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Sprites and the framerate


Sprites and the framerate

Postby Karel » Apr 21, 2003 @ 4:01pm

Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby ppcStudios » Apr 21, 2003 @ 5:18pm

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby Karel » Apr 23, 2003 @ 11:15pm

Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby maurice » Apr 24, 2003 @ 10:00am

maurice
pm Member
 
Posts: 37
Joined: Feb 26, 2003 @ 9:08pm
Location: Rotterdam


Postby spacemonkey » Apr 24, 2003 @ 12:14pm

spacemonkey
pm Member
 
Posts: 11
Joined: Apr 20, 2003 @ 12:13pm


Postby Hosed » Apr 24, 2003 @ 2:11pm

L. L. Goodwin<BR>Purveyor of Code<BR><A href="http://www.planettribes.com/hosed/">Hosed's House of Code</A>
User avatar
Hosed
pm Member
 
Posts: 249
Joined: Jan 3, 2002 @ 2:51am
Location: Montana, USA


Postby Karel » Apr 24, 2003 @ 8:26pm

Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby ppcStudios » Apr 24, 2003 @ 8:57pm

Krelis, are you creating a timer for each sprite? I'm not sure I would want to do that. I've not looked into how much overhead multiple timers generate, but it wouldn't seem like a good thing if you're creating a boatload of sprites.

I create a handful of timers of different frequencies at the start of my application, and derive all my sprite timing from those.
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby Karel » Apr 24, 2003 @ 9:29pm

Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby ppcStudios » Apr 24, 2003 @ 10:12pm

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby Karel » Apr 24, 2003 @ 10:51pm

Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby Guest » May 14, 2003 @ 3:35am

Guest
 


Postby ppcStudios » May 14, 2003 @ 5:05am

The problem with using GetTickCount( ) is the resolution varies from platform to platform. Most WinCE devices have a resolution of ~1ms, NT/Win2K has a resolution of ~10ms and Win95/98/ME is on the order of ~50ms. Using SetTimer ensures you have a stable time base for animation, which is a necessity for reliable, platform independent animation.

[edit]Of course multimedia timers are the preferred way to do animations, but we don't have that option on CE devices. An alternative would be to create a thread that does a Sleep(timeout) then calls a callback function to trigger the animation frame update. This would give excellent resolution and be pretty stable.
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby efortier » May 14, 2003 @ 5:28am

Hi. Here is my 2 cents.

What I did was to include both frame based and time based animations.

Frame based for the walking animations of my characters. The higher the frame rate, the faster they walk. I found that the on-screen result was a lot nicer for the characters with frame-based animations.

I use time-based animations for the world objects. So no matter what the frame rate is, and no matter how fast the characters are walking around, the world objects are animated on a steady base.

Now, if timing is important on other platforms than PPC, you may want to take a look at the performance counter. They offer very (very) high resolution. However my understanding is that they are not availailable on all systems. My iPaq 3850 has them. All my PCs have them too (Athlon XP, P3, etc).

Check out QueryPerformanceCounter() and QueryPerformanceFrequency() for more on this. What you could do is make some base timing functions that first try to use the performance counter, if unavailable fall back to GetTickCount().

And there's also timeGetTime() on non PPC platforms. This has been a favorite of mine in the past.

--Eric
User avatar
efortier
pm Insider
 
Posts: 373
Joined: May 15, 2002 @ 10:32pm


Postby ppcStudios » May 14, 2003 @ 5:36am

Good point Eric... I was just about to post about QueryPerformanceCounter but wanted to verify first that it may or may not be supported on all winCE devices as its an OEM implementation.
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Next

Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron