Page 1 of 2

Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 4:45 am
by AnarchCassius
My game randomly generates a level on load. During testing this has been all well and good. Now I'm trying to implement a main menu and load the level. Fine. Now I add a return the main menu upon game over or quit so you can start over. Problem. The 2nd time the level loads the game almost certainly crashes. Task Manager is showing that only about half the extra memory it claims when it loads the main level gets released when it returns to menu.

So I did some more tests. Eliminating the shift to menu and back by making F1 reload the level has the exact same almost always crash effect. Interestingly however this never happens in Game Editor, only in the export. I can press F1 all darn day long in Game Mode and I noticed that when doing so there is a noticable pause before the level loads, while the exported game reloads almost instantly and then crashes.

Does anybody have more information on this or ideas for a solution?

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 6:13 am
by AnarchCassius
Seriously confused now. I broke the level build function down in to steps and delayed each step by a few deciseconds. This doesn't affect the crash, in fact it doesn't seem to work at all once I export. What is timed to take several seconds and visibly does so in GE, seems to happen all at once and crash the program when exported.

EDIT: Okay had a .dat file in there confounding things, apparently .exes read .dats over their own intenal data. In any case the breakdown doesn't help much. Somtimes it crashes part way through, sometimes it crashes when it tries to load the 2nd or 3rd step. However only on reload, the first load up each time is 100% fine no matter what.

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 1:37 pm
by Hblade
The same sort of thing happened to me when I was loading and saving array variables to try and make a Tile Editor. The situation is spawned by variables believe it or not.



Most of your variables, were they created in Global code or were they created originally? Also, check and make sure the variable types don't differ within each Ged file, for example if you have a "SPAWN" variable, and it's an Integer in one ged saved in the "Level" group, (Saved groups and stuff), and you have the same "SPAWN" variable in the next GED but it's a "real", then it will cause crashing.

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 5:42 pm
by AnarchCassius
Most of my variables are Global or Actor variables defined in GE style. I am also using a few multidimensional arrays defined in the Global Code.

In theory there are 3 groups of save data, one for scores, one for game status and one to store the Player's Actor variables between levels.

However none of these system are actually involved here. I'm not loading a different GED (though I tried that originally), I'm reloading the level from itself. The first run is always fine but when I try to reload it crashes, usually just after drawing the main level frame walls. No variables or other GEDs are being loaded, the code should execute exactly as on the initial run.

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 6:12 pm
by Hblade
Oh now I understand. okay what you need to do is reset EVERY variable that involves the level generation, I asume your arrays use "cloneindex" right? Example:
TILE_X[cloneindex]

if so then thats your problem, your going to have to find a way to reset the cloneindex or something. I'm having a similar problem with the RPG system.

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 7:03 pm
by AnarchCassius
I see. So the memory not being released isn't leaked, GE is still holding variables there. At least that much is reassuring.

Still... every variable that involves level generation? I have none. All variables used are locals, it's not dependent on outside data, it just runs a function. Further, the GUI IS variable dependent and is displaying the proper 0'd information for start-up. What does reset mean in this context? They seem set to 0 automatically and even if, not nothing in my code should turn the unexpected value into a crash.

... Don't tell me it could be starting with the old locals used internally in the functions. THAT might make my code crash.

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 7:45 pm
by Game A Gogo
Before loading/generating a level, do this: "Variable=NULL;" change Variable to the name of the actual variable, even if this is an array, don't put []'s
I think this might fix your problem

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 8:37 pm
by AnarchCassius
I can't do that. It won't run the game if I try to use NULL with an array or an actor variable.

I've tried deleting everything on level close and NULLing what Globals I can. No noticeable effect. When I alter the code to not make a level at all and just place Player on a black screen I can usually reload about a dozen times but there is still an unreasonable chance of crashing.

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 10:19 pm
by lcl
Seeing your level generation & load codes may help people to help you. :)

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 11:11 pm
by Game A Gogo
AnarchCassius wrote:I can't do that. It won't run the game if I try to use NULL with an array or an actor variable.

then in that case you'll need something like:
Code: Select all
int i;
for(i=0;i<64;i++)Variable[i]=NULL;

Make sure to change 64 to the same value you inputed in the variable creation window for the array size

Re: Serious problem with Windows Export

PostPosted: Sun Mar 13, 2011 11:34 pm
by Hblade
Ahh, clever dude!

Re: Serious problem with Windows Export

PostPosted: Mon Mar 14, 2011 11:31 pm
by AnarchCassius
Thanks, I figured a loop would do trick but I wanted to be sure. Mine also would have been longer :)

Anyway I thought I had a stable version without the level now. I just ran a bunch of resets fine but on second check I got crashes fairly regularly. I've also noticed the game crash on exit, not just load up. Also it's not crashing at any particular point in the level build, and often just afterwards. Finally, it's totally messing up my mouse over cursor changes after the first load.

So with that I think I have this solved. I just noticed it crashing tied to mousing over a certain item after reload and thus pulled all my Mouse Enter/Cursor Change triggers. Now it seems great.

I can't confirm if the NULLing was necessary or the mouse was the entirety of my problem. I can say Mouse Enter, Cursor Change or both can seriously flip out if you use LoadLevel it seems. Fine on the first run but on the 2nd I got not only the crashes but also no cursor and wrong cursors ranging from other game art to the default pac man.

Re: Serious problem with Windows Export

PostPosted: Fri Mar 18, 2011 6:31 pm
by AnarchCassius
No response? Can I get somebody to test this with other export versions or perhaps a Windows besides XP? Just use Change Cursor on Mouse Enter in an actor in a scene that gets reloaded.

Failing that, where's the bug tracker?

Re: Serious problem with Windows Export

PostPosted: Fri Mar 18, 2011 8:13 pm
by Game A Gogo
if Change Cursor is whats causing the problem, I'd recomend using an actor that follows the mouse (Make sure to disable mouse button down and mouse button up individually) and change the actor's animation depending on what you need. Of course, this is only another way to do this, not really an answer to your problem S:

Re: Serious problem with Windows Export

PostPosted: Fri Mar 18, 2011 8:17 pm
by AnarchCassius
Yeah that was my plan, it would just be nice to see this fixed.