runewake2
Member
|
Properly Loading a Game and Restarting
I am trying to add restarting to Dark Time, however, whenever I attempt to load right now my game segfaults in the World.update() code somewhere.
There are two times when I load the game, the first is from the Game Menu when the player hits continue. The second is when the player reloads to the last save while playing (after death or just because they screwed something up).
My game runs fine without the call to World.load().
To accomplish loading from the menu I transition to the game state and load a world using World.new(world_path) then, once the world has successfully loaded I call World.load(save_path) to load the saved data. After this call the program segfaults in World.update().
The same issue occurs when I attempt to load from the in game menu.
How can I get loading to work without crashing?
I can provide code samples if they will help.
|
|
04-23-2013 08:54 PM |
|
gwald
Member
|
RE: Properly Loading a Game and Restarting
Hey how did you go?
I would guess your save file is referring to something that's been removed from memory and causing the crash?
I would try loading the save file right after it's been created to confirm the save is working.
next, bind the save and load functions to a key and debug what event is causing the problem.
My Blog
http://www.esenthel.com/community/showthread.php?tid=6043
I hang out at Esenthel IRC Channel
http://webchat.freenode.net/?channels=#Esenthel
|
|
05-21-2013 06:12 AM |
|
Rubeus
Member
|
RE: Properly Loading a Game and Restarting
You could try debugging the issue by commenting out the save/load for all objects except the world/player and see if you get the error. If it works, add 1 object at a time to see which is erroring. If you find an object that causes it, fix it, then continue adding object to be sure it isn't multiple objects that could cause it.
When you find an object that is causing the issue, just be sure that after the load, all the variables have the proper values. Most likely, you just have a pointer somewhere that isn't reinitialized by the load sequence.
|
|
05-21-2013 01:32 PM |
|