BUG: Inter-level popup without finishing the level

BUG: Inter-level popup without finishing the level

Postby Tedium » 26 Feb 2012, 11:24

Something weird happened:
Bug.png
I'm running the latest svn. Somehow the Inter-level popup appeared for no reason :?.
User avatar
Tedium
 
Posts: 122
Joined: 19 Oct 2011, 10:40

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

Postby Edward_Lii » 26 Feb 2012, 16:02

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. :)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

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

Postby Tedium » 28 Feb 2012, 15:04

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.
User avatar
Tedium
 
Posts: 122
Joined: 19 Oct 2011, 10:40

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

Postby acme_pjz » 28 Feb 2012, 16:45

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 313 times
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

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

Postby Edward_Lii » 29 Feb 2012, 07:52

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.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

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

Postby acme_pjz » 29 Feb 2012, 08:45

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
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

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

Postby Edward_Lii » 29 Feb 2012, 08:49

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.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

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

Postby acme_pjz » 02 Mar 2012, 18:25

There is another bug with inter-level popup, it pops when a new level is started :| And I can't produce this bug anymore...
Attachments
unknownbug.jpg
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

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

Postby Edward_Lii » 02 Mar 2012, 19:02

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.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

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

Postby acme_pjz » 20 Apr 2012, 14:46

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...
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

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

Postby acme_pjz » 20 Apr 2012, 15:12

Fixed in SVN r346, but not sure if it will introduce any new bugs
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

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

Postby Edward_Lii » 20 Apr 2012, 15:16

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.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

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

Postby acme_pjz » 20 Apr 2012, 16:18

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)
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

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

Postby Edward_Lii » 20 Apr 2012, 16:20

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. :|
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

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

Postby acme_pjz » 20 Apr 2012, 16:36

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
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

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

Postby Edward_Lii » 20 Apr 2012, 16:43

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:
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Who is online

Users browsing this forum: No registered users and 1 guest