Page 1 of 1

BUG: Inter-level popup without finishing the level

PostPosted: 26 Feb 2012, 11:24
by Tedium
Something weird happened:
Bug.png
I'm running the latest svn. Somehow the Inter-level popup appeared for no reason :?.

Re: BUG: Inter-level popup without finishing the level

PostPosted: 26 Feb 2012, 16:02
by Edward_Lii
Hello Tedium,

Tedium {l Wrote}:I'm running the latest svn. Somehow the Inter-level popup appeared for no reason :?.

Strange, never happened to me and I couldn't reproduce it.

Are those your best time/number of recordings of the previous level?
If so than probably the GUIObjectRoot didn't get deleted (properly).

Anyway, if it happens again try to give as much information as you can.
What you did, when it happened, etc...

Thanks for reporting. :)

Re: BUG: Inter-level popup without finishing the level

PostPosted: 28 Feb 2012, 15:04
by Tedium
Edward_Lii {l Wrote}:Are those your best time/number of recordings of the previous level?

Yes they are.The bug will occur when you restart a level just before finishing it. Level 1 of the tutorial-levelpack "A walk in the park" is a good level for testing this bug.

Re: BUG: Inter-level popup without finishing the level

PostPosted: 28 Feb 2012, 16:45
by acme_pjz
Hi,

Tedium {l Wrote}:
Edward_Lii {l Wrote}:Are those your best time/number of recordings of the previous level?

Yes they are.The bug will occur when you restart a level just before finishing it. Level 1 of the tutorial-levelpack "A walk in the park" is a good level for testing this bug.


Yes I reproduced this bug :) and fixed it in latest SVN.

By the way, I found that if the player and shadow goes to the exit simultaneously, then in the inter-level screen the player and shadow seems out of sync :| To reproduce this minor bug, play the attached level pack:
boring_crash.zip
(1.01 KiB) Downloaded 318 times

Re: BUG: Inter-level popup without finishing the level

PostPosted: 29 Feb 2012, 07:52
by Edward_Lii
Hello acme_pjz,

acme_pjz {l Wrote}:By the way, I found that if the player and shadow goes to the exit simultaneously, then in the inter-level screen the player and shadow seems out of sync :| To reproduce this minor bug, play the attached level pack:

I see what you mean, I made a bigger test map and what I noticed is that it happens alternately that they are in sync and that they aren't.
So the first time is in sync, because that's the regular play, than starts the recording in which the player (or shadow) is a bit off.
But the next replay they are in sync again. :|

I'll look into this.

Re: BUG: Inter-level popup without finishing the level

PostPosted: 29 Feb 2012, 08:45
by acme_pjz
Hi Edward_Lii,

This bug occurs because inside the game logic code the if player or shadow goes to the exit then the code calls win function immediately, so the player and shadow are all resets, but after this the game logic code processes the game logic of shadow, so they are out of sync. IMHO if we won then we should change some variable first, after game logic code we check this variable and show inter-level popup if we won

Re: BUG: Inter-level popup without finishing the level

PostPosted: 29 Feb 2012, 08:49
by Edward_Lii
Hello acme_pjz,

acme_pjz {l Wrote}:This bug occurs because inside the game logic code the if player or shadow goes to the exit then the code calls win function immediately, so the player and shadow are all resets, but after this the game logic code processes the game logic of shadow, so they are out of sync. IMHO if we won then we should change some variable first, after game logic code we check this variable and show inter-level popup if we won

Good find, I agree that it's best to handle the winning at the end of the update cycle.
This does also apply to the "winning" inside the replay so I think it should be a flag in the Game class.

Re: BUG: Inter-level popup without finishing the level

PostPosted: 02 Mar 2012, 18:25
by acme_pjz
There is another bug with inter-level popup, it pops when a new level is started :| And I can't produce this bug anymore...

Re: BUG: Inter-level popup without finishing the level

PostPosted: 02 Mar 2012, 19:02
by Edward_Lii
Hello acme_pjz,

acme_pjz {l Wrote}:There is another bug with inter-level popup, it pops when a new level is started :| And I can't produce this bug anymore...

Strange, hopefully it's related to the fact that winning is handled in the middle of the update cycle and not in the end.
Other than that we can only hope it won't happen again, or that we can find the bug.

Re: BUG: Inter-level popup without finishing the level

PostPosted: 20 Apr 2012, 14:46
by acme_pjz
Hi Edward_Lii,

Finally I found where the bug occurs. When one completes a level, the level replay auto plays, and when the player come to the exit (maybe the player and shadow come to exit simultaneously) press 'Next' immediately, then the bug occurs... I'm fixing this bug now...

Re: BUG: Inter-level popup without finishing the level

PostPosted: 20 Apr 2012, 15:12
by acme_pjz
Fixed in SVN r346, but not sure if it will introduce any new bugs

Re: BUG: Inter-level popup without finishing the level

PostPosted: 20 Apr 2012, 15:16
by Edward_Lii
Hello acme_pjz,

acme_pjz {l Wrote}:Fixed in SVN r346, but not sure if it will introduce any new bugs

Thanks for fixing it. :)
I really hope this is the last we'll ever hear of it.

Also I don't think it's needed to add a check in Main.cpp before fading in, because something similar is done when fading out in Functions.cpp.

Re: BUG: Inter-level popup without finishing the level

PostPosted: 20 Apr 2012, 16:18
by acme_pjz
But IMHO we really need the added code in Main.cpp, there is exactly where the bug occurs. If you click 'Next' when player goes to the exit, then the level changed to next level and 'nextState' is set to 'STATE_GAME' in the 'while(SDL_PollEvent(&event))' loop. Then code continues, to 'currentState->logic()' then winning event triggers... So before run logic code we should change current game state to new state (if any)

Re: BUG: Inter-level popup without finishing the level

PostPosted: 20 Apr 2012, 16:20
by Edward_Lii
Hello acme_pjz,

acme_pjz {l Wrote}:But IMHO we really need the added code in Main.cpp, there is exactly where the bug occurs. If you click 'Next' when player goes to the exit, then the level changed to next level and 'nextState' is set to 'STATE_GAME' in the 'while(SDL_PollEvent(&event))' loop. Then code continues, to 'currentState->logic()' then winning event triggers... So before run logic code we should change current game state to new state (if any)

Okay, that makes sense. :)

EDIT: But GUI events aren't handled by the SDL_PollEvent loop. :|

Re: BUG: Inter-level popup without finishing the level

PostPosted: 20 Apr 2012, 16:36
by acme_pjz
Edward_Lii {l Wrote}:EDIT: But GUI events aren't handled by the SDL_PollEvent loop. :|


:? There are 3 functions in the loop: inputMgr.updateState(true); currentState->handleEvents(); GUIObjectHandleEvents(); clearly the last function processes GUI events

Re: BUG: Inter-level popup without finishing the level

PostPosted: 20 Apr 2012, 16:43
by Edward_Lii
acme_pjz {l Wrote}::? There are 3 functions in the loop: inputMgr.updateState(true); currentState->handleEvents(); GUIObjectHandleEvents(); clearly the last function processes GUI events

You're right. :oops:
Thought that happened separately, but of course the GUI needs to know the key presses.

I think the code could be added, but it somehow doesn't feel good to put such a workaround in the main loop. :think: