SetGameSpeed(1000) (solved)

Started by mchammer, Tue 18/09/2007 21:34:35

Previous topic - Next topic

mchammer

Im trying to write a function witch speeds up the whole game at least over 20xNormal game speed. The use of the function would be that when player character sleeps, the game world keeps going normaly (but very fast) at background.
  I have tried simple "SetGameSpeed(1000)" when player goes sleeping and first it seemed to be working fine, but then game started crashing (whitout any errormessage) when this speed is used.
And now it sometimes work and sometimes crashes after about 10secs, even if i dont change anything. Debug shows that fps is somewhere around 400 when it works and around 200 when it crashes.

Can this kind of function be done whit SetGameSpeed() properly? Or is there any other way to do it?

My 40 bullets - An action/war game.

Pumaman

It shouldn't crash without an error message. Is the game small enough to upload for me to investigate?

mchammer

Quote from: Pumaman on Tue 18/09/2007 21:37:19
It shouldn't crash without an error message. Is the game small enough to upload for me to investigate?

I sent the link in pm.
My 40 bullets - An action/war game.

Pumaman

I ran it a few times and tried sleeping, and didn't get any crashes. The only problem I got was when I tried to sleep twice in a row and got a Divide By Zero error in the script.

Can you tell me exactly what you did when it crashed, and what game settings (eg. resolution, graphics filter, etc) you're using?

mchammer

#4
QuoteThe only problem I got was when I tried to sleep twice in a row and got a Divide By Zero error in the script.
This is because "player goes sleep" code isnt ready yet, shoudnt have anything to do with crash.

When it crashes i just press use and then click bed object. it doesnt always crash, but usualy.
when it crashes, "sleepcounter" at middle of the screen is somewhere near 18 seconds.


I dont know if these are the settings editor uses but
this is the acsetup file from the game's_Debug folder:
[sound]
digiid=-1
midiid=-1
digiwin=1096302880
midiwin=-1
digiindx=0
midiindx=0
digiwinindx=0
midiwinindx=0
[misc]
gamecolordepth=16
defaultres=1
screenres=0
letterbox=0
windowed=0
refresh=0
gfxfilter=None


edit:  I downloaded beta10, and now instead of crashing, game just freezes and i have to shut it down with ctrl+alt+del. When ctrl+alt+del is pressed it says the  'program isn't running'  message.  (I dont have english windows but that usual message anyway.)
My 40 bullets - An action/war game.

Gilbert

Hmmm, what system are you using (like windows version, amount of ram, etc.)?

This may not be related, but just to make sure...

mchammer

Quote from: Gilbot V7000a on Wed 19/09/2007 11:05:01
Hmmm, what system are you using (like windows version, amount of ram, etc.)?

This may not be related, but just to make sure...

Windows Xp home
AMD Athlon 3200+
512ddr
nvidia geforce fx5500
My 40 bullets - An action/war game.

mchammer

#7
I just noticed that SetGameSpeed has nothing to do with the crash. I erased mouse.Mode = eModeWait; from SleepingFunciton to see if mouse freezes when game crashes, and it didnt crash anymore.
  Then i put mousewait line back to function and erased everything else, and game crashed again (but after longer time because gamespeed wasnt at 1000 anymore.)

I tried to set all wait cursors settings (except name) to same as normal cursors settings but game crashed anyway.

edit:

Found the reason:
Code: ags

  // Adds text to 'infotext'.
  if (Mouse.Mode == eModeWalkto) Infotext.Text = "Walk to ";
  if (Mouse.Mode == eModePickup) Infotext.Text = "Pick up ";
  if (Mouse.Mode == eModeLookat) Infotext.Text = "Look at ";
  if (Mouse.Mode == eModeUse) Infotext.Text = "Use ";
  if (Mouse.Mode == eModeTalkto) Infotext.Text = "Talk to ";
  if (Mouse.Mode == eModeUseinv) {
    Infotext.Text = "Use ";
    Infotext.Text = Infotext.Text.Append(item[active_inventory].name);
    Infotext.Text = Infotext.Text.Append(" to ");
  }
  Infotext.Text = Infotext.Text.Append(Game.GetLocationName(mouse.x, mouse.y));


I have this at repeatly execute,  when mouse mode was set to wait, it didnt clear infotext and kept adding locationname to it until it crashed the game. ::)
My 40 bullets - An action/war game.

Pumaman

Well spotted! I'll see if I can improve it to give an error rather than crashing when this happens.

SMF spam blocked by CleanTalk