PDA

View Full Version : Speedup


rob
September 28th, 2005, 08:55 PM
We've got a big speedup with the last revision. I'm getting 66 FPS at 640x480, 52 FPS at 800x600, 35 FPS at 1024x768, and 16 FPS at 1600x1200.

The fact that our game is still very easily playable at 1024x768 is very good. We're on the right track.

Rob

steve_d555
September 28th, 2005, 10:37 PM
Yes, I was wondering where the slowdown was coming from so I just started commenting out things in gameStart() until I found it. Seems I forgot to displayFormat the background image for fast blitting so it was a very slow redraw. And if it ever gets too slow we can always take off the frame limiter which tries to keep it stable at ~60 FPS.

EDIT: Wo, I was just playing around with it and Hardware surfaces seemed to give me a large increase for 1024x768 (keeps me ~69). If you want to test it (for maybe > 1024x768) for setVideoMode just change the flags to
SDL::DOUBLEBUF | SDL::HWSURFACE

EDIT 2: Nevermind, just tested with SDL::DOUBLEBUF | SDL::SWSURFACE and it was the same. Maybe with more complex objects, but not with 2D.

rob
September 28th, 2005, 10:44 PM
Performance will go down the more features we write, but it won't be too bad.

What do you think about moving the drawing routines (or any other particular routines) into a thread? While there is threading overhead, the advantage would be that the code could go on to do other things.

We could just run everything in the main thread, then have our seperate worker threads handle network IO, in-game chatting, etc.

Let me know your thoughts.

steve_d555
September 28th, 2005, 10:48 PM
Threading might not be bad, considering there is almost no overhead (as you said) and the growing popularity of Dual Core and SMP systems.

I still have yet to figure out how to do chatting though. I mean we can't really have an event for every key (i.e. SDL::Key::A; blit(A) and so on and so forth). I tried some stuff with Ruby's built-in system (gets) but that didn't work out (maybe I was doing it wrong.)

rob
September 29th, 2005, 07:01 PM
Regarding chatting, couldn't we spawn a second window (since 640x480 seems to work well anyway), and do the chat there? That could run in a seperate thread, and we could use GTK there or something.

I dunno.. We'll have to think about this one I guess..

steve_d555
September 30th, 2005, 12:20 AM
I just solved our chat problem, it is very basic but I think it should be fairly good.

The wierd thing is that this game runs about 10 - 15 FPS better at 1024x768 than 640x480 (my resolution is 1280x1024 that may be why.) I also lose almost 40FPS by changing 32bit to 24bit, even though I am running at 24bit.