Game running really slow?

Started by
4 comments, last by Erondial 18 years, 3 months ago
Hi. I'm new here, and I have a problem :) I'm writing a 2D Space Shooter in C++, using SDL. I've got the game running on a GetTickCount() timing scheme, which is probably not the way to do it, but that's not my only problem. If I use just while(1), and have everything running, the game slows down waay too much when I put a small planet in (300x250 pixels). Basically, my routine has it covering itself with a sheet of black and then painting itself in a new position, reletive to the player's ship. Now, this is obviously not going to work in the long term, because there's going to be more stuff flying around then a ship and a planet, and the game's already going too slow as it is... what am I doing wrong? There has to be something wrong, because I can play games like Escape Velocity (what I'm trying to recreate) with absolutely no problem, and they have tons of stuff flying around on screen... Anyway, any help is greatly appreciated. Thanks in advance :)
Advertisement
Hmmm... so, you're using Windows GDI? That might be the problem... what are your computer specs?
No, I'm using SDL... I know the GDI is way too slow for this.

I'm on a 1.3 GHz Athalon, Raedeon 7200 Video Card, 1GB of Ram.
The only real way to get an answer is to use a profiling tool. there are some listed in one of the forums here. profilers basically tell you where the big slowdowns are happening in your engine (by code and line numbers). Once you identify the bottlenecks you will answer your own question and begin to be able to optimize those areas of the code.

-me
If you are using SDL, then can't you use SDL_GetTick();

I'm just looking at this tutorial. It seems like you might be drawing too often and using more CPU cycles than is necessary.
Thank you to all of you. The tutorial looks like it could defintetly help. Thanks for being so quick in responding :)

EDIT: WOW. THANK YOU. I had never even heard of a profiler before, and it came with MingW all along. XD Thank you very much, this'll definetly help me sort out the problems.

[Edited by - Erondial on January 4, 2006 4:11:10 PM]

This topic is closed to new replies.

Advertisement