Skip to main content
gamedev.net
🔒 Locked

TBackGroundSprite

Started by Agoth Jul 6, 2000 at 2:55 PM 0 replies 400+ views
Original Post
Agoth
Agoth
Hi, i''m using the TBackGroundSprite in my game, but it''s very slow... I create it in the OnTimer Event of the DXTimer, and the Frame Rate slow down to 3, 2, even 0... Is there a faster way to create the TBackgroundSprite than to create it on every DXDraw flip? Thanks, Agoth.
-}Agoth{
Gunner
Gunner
Hi Agoth,

Don't "Create" your tbackground object in DXtimer, that's suicide.

You only need to create them once.
Set it up in your form's OnCreate event or something, then assign all of you images to your map / tiles.

You will usually only use engine.draw and engine.move in dxtimer for map manipulation.

Then when your game level is complete and want to go to the next level, procedure out to re-assign a new set of tiles to your map.. again whatever suits your needs, then
it's back in the main loop.

I usually re-use all my previously created tiles, i remove or add them as i need to. I just re-assign images / propreties to them.

Just to give you an example, in my full game i have a 20,000 x 20,000(approx) pixel world using 128x128 TBackground tiles and i get a rock solid 75 fps/vsync on.. With tons of other crap moving around/ fireing... etc
vsync off i get 400 fps, soo i know i still have loads of CPU overhead to add other functionnality.

I'm running a p2 350.

Hope this helps.

Gunner



Edited by - Gunner on July 7, 2000 9:02:22 AM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.