Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Game freezes after a seconds


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 kovicic   Members   -  Reputation: 100

Like
0Likes
Like

Posted 18 March 2012 - 09:46 PM

Hi everyone, I am developing a single game with C++/SDL under Linux, just for render in 2D (I couldn't use openGL for hardware requeriments).
In its 1st phase it was just a sprite moving around, it worked.

I added screens, and the sprite. Each screen has it own file, the sprite movement it's in a spite sheet.
According I move backward/forward I change the screen or the sprite 'walk' through differents screen, jumps, etc.

I only once load the sprite file, the other ones, which contain the differents, screens (backgrounds) are loaded on demand (and I free them as well). I mean, if it's time to screen2, I do a SDL_FreeSurface(screen1) and then I load screen1.

It seems it's ok, but after a seconds the game gets stuck, it freezes.

What could be wrong?.

Thanks, and regards

kovi

Sponsor:

#2 willpowered   Members   -  Reputation: 510

Like
0Likes
Like

Posted 18 March 2012 - 11:34 PM

Any idea where in your code it is getting stuck?
Is it during game logic, or drawing? You're going to have to find out a bit more information.

#3 Nypyren   Crossbones+   -  Reputation: 4504

Like
0Likes
Like

Posted 18 March 2012 - 11:42 PM

If it's caught in an infinite loop, break the process in your debugger and see where it is (you can do that in Linux, right?).

#4 Bacterius   Crossbones+   -  Reputation: 9089

Like
0Likes
Like

Posted 19 March 2012 - 12:54 AM

(you can do that in Linux, right?).

Seriously...

OP: try and figure out where the problem is coming from first, by either breaking as Nypyren suggests or scatter some printf's around your code (ghetto debugging). Then you can usually either resolve the issue if it's a logic bug (infinite loop, condition never being satisfied, etc...), or if it's an error message from one of the API's you're using you can usually google it and find an answer, and ask here if nothing comes up. As it is now your question is much too general and we can't really give any specific help.

The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS