Speed gain by combining Sprite Displaying and Game Logics?

Advanced game related topics
User avatar
Kapslok
User
User
Posts: 34
Joined: Tue Sep 01, 2009 2:29 pm
Location: Finland

Speed gain by combining Sprite Displaying and Game Logics?

Post by Kapslok »

Hello,

I've tried to figure out one basic thing about PureBasic sprites...

In Purebasic, on DirectX or OpenGL, does displaying sprites hang up the CPU until the sprite is displayed?

This would clear one fundamental issue.
Which approach would be better for a cpu-intensive game:

1)
- Do game logics - loop
- Display Sprites - loop
- Flip

Or

2)
- Buffer Sprite coordinates of previous frame - loop (nothing is displayed yet)
- Do game logics and display sprites from the buffer in the same loop
- Flip
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: Speed gain by combining Sprite Displaying and Game Logic

Post by Rook Zimbabwe »

Kapslok wrote:In Purebasic, on DirectX or OpenGL, does displaying sprites hang up the CPU until the sprite is displayed?
in every game ther is issues edpending on the size of the grphics card, its speed and buffer aare key elements on how much it can draw quickly...

if yuo are animating as well as drawing you will ee a slowdown with over 1999 sprites on most low end cards... The medium gade: 3999 is pretty easy. As far as the high end 500+ dollar cards I have no idea as I can't afford one so I don't worry about it.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
Kapslok
User
User
Posts: 34
Joined: Tue Sep 01, 2009 2:29 pm
Location: Finland

Re: Speed gain by combining Sprite Displaying and Game Logic

Post by Kapslok »

Rook Zimbabwe wrote: in every game ther is issues edpending on the size of the grphics card, its speed and buffer aare key elements on how much it can draw quickly...
Yes. It seems to come down to that quite often. But ofcourse the program decides how to build up the display etc. I was wondering about the possibility to render sprites and calculate game logics simultaneously, so that when the graphics card is displaying a sprite cpu is already figuring out new stuff to draw... And especially with Sprite3D commands.
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Speed gain by combining Sprite Displaying and Game Logic

Post by djes »

You could. It is especially needed with network games, as the latency is so big that you have to do calculations in parallel.
Thorium
Addict
Addict
Posts: 1308
Joined: Sat Aug 15, 2009 6:59 pm

Re: Speed gain by combining Sprite Displaying and Game Logic

Post by Thorium »

Kapslok wrote:I was wondering about the possibility to render sprites and calculate game logics simultaneously, so that when the graphics card is displaying a sprite cpu is already figuring out new stuff to draw... And especially with Sprite3D commands.
Yes it's possible but can result in lower speed if you do it wrong or if the CPU does not have to do much work anyway. Thats because of the sycronization overhead.
One little trick is to use the time FlipBuffers is waiting for screen syncronization to calculate CPU stuff for the next frame. And thats easy to do with threads without a noticeable overhead.
Post Reply