Jump to content
  • Advertisement
Sign in to follow this  
Erondial

Game running really slow?

This topic is 4669 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!