Recent

Author Topic: debug works fine, compiled exe acts different  (Read 6062 times)

Yin

  • Newbie
  • Posts: 3
debug works fine, compiled exe acts different
« on: March 05, 2011, 01:51:33 am »
So I'm using Jedi-SDL to make a game, and I use SDL_GetTicks to get number of milliseconds and set the framerate using that.

On my main computer, everything seems to work fine.

But today I tried it on my laptop and on an older computer, and on both of them the fps seems capped at ~11. Seems like an error with SDL_GetTicks not getting a high enough resolution time, right?

Well, the crazy thing is that I tried running from within Lazarus on the laptop and lo and behold the the debug works perfectly at 60 fps. But the generated exe is still at 11.

Any idea how I can make things work as good in the compile as in the debug? Why would the debug have access to a more accurate time through SDL_GetTicks?

I'm not a great programmer, I barely dabble... So hopefully one of you guys will have some suggestions on what to try.

Yin

  • Newbie
  • Posts: 3
Re: debug works fine, compiled exe acts different
« Reply #1 on: March 05, 2011, 02:04:03 pm »
I might add that this problem is for Windows XP, and both debug and compile works fine if the code is compiled on Linux Mint on the same computer (which I just tested). This is very confusing.

Yin

  • Newbie
  • Posts: 3
Re: debug works fine, compiled exe acts different
« Reply #2 on: March 06, 2011, 12:08:06 am »
Well, I guess I sort of solved it. Every now and then, GetTicks would lag or spike on those old computers for some reason. And the way I was doing things, I suppose this crippled the game.

So now I use SDL_Delay to wait what's left of a frames time (as I saw was being done in examples), and when one of these wait times is too high(GetTicks messing up the calculating of how much is left to wait) I instead set it to an average of previous good values.

I still experience some skips in framerate, but at least it is playable on those computers now.

Edit: As for why it works fine, without skips, in debug... Is debug maybe running the process in some sort of higher priority perhaps?
« Last Edit: March 06, 2011, 12:21:20 am by Yin »

 

TinyPortal © 2005-2018