Page 1 of 1

Reply shows "move 3" as first move

Posted: 28 June 2020, 17:56
by Emanuele Ornella
In this reply I do see something wrong.
Actually 2 things are wrong:
1. the starting tile Alice should be on the first player's hand, but I do not see it
2. the reply is starting from move 3 instead of move 1 !

I do not understand how this would be possible!
The message on the action bar clearly indicated that this is the first turn. This is a special state to hand the fist turn of each round.
So the fact the message is correct, means this is the actual first turn.
So why is the move on the log showing the number 3 instead of the number 1 ?

I guess something was going wrong, but I do not know how to reproduce this...

Any idea? Was this ever happen before ?

Thanks,
Ema

Re: Reply shows "move 3" as first move

Posted: 29 June 2020, 08:50
by vincentt
Hi

If you do things when you initialize the game and trigger notifications it may come from this.
About the fact that the card is not on the correct position, I think that you trigger automatic actions in the first states, but as notifications are not setup they are not caught.
the best way is to check your getAllDatas as I think that the position is not sent.

Cheers

Re: Reply shows "move 3" as first move

Posted: 07 July 2020, 08:42
by Emanuele Ornella
I had another player reporting the same. It is always the move 2 missed and the Alice tile is not showing.
However he told me that he was able to see Alice tile but when he clicked made the move, the game hang up and all other players needed to F5 to continue with the game.
So I can exclude there is a problem on the DB as Alice was visible at the beginning.
And also because F5 reset the situation...
So it may be something about notifications as you said, but I do not understand why this is not happening all the times!

Also: why is the log not recorded? Why a missing notification would avoid to record the log?
In the cases reported the first move (which is actually turn 2) is missed from the log. Why is that?
I am not doing anything actively to record the log... so what could avoid the log to be missed?
move 3
move 3
move3.jpg (23.87 KiB) Viewed 1099 times
move 4
move 4
move4.jpg (25.45 KiB) Viewed 1099 times
This is where I send to all players the notification that Alice is going back to the board from the first player's hand:

self::notifyAllPlayers( "aliceTileBackOnBoardnotification",
clienttranslate( '' ),
array(
'player_id' => $player_id,
'player_name' => self::getActivePlayerName(),
'locationx' => $newlocationforalicex,
'locationy' => $newlocationforalicey
)
);
And this is coming from a takeTilesAction.
I am checking if this is the very first turn of the round to see if I need to send Alice back on the grid...

In the JS I have this connected to that notification:

Code: Select all

moveAliceBackToBoard: function(newlocationx,newlocationy){
			var thedivforalice = dojo.byId("card_1"); // this is Alice

			// I also change the location in the div
			thedivforalice.dataset.locationx = newlocationx;
			thedivforalice.dataset.locationy = newlocationy;
			thedivforalice.dataset.whereisthecard = "board";
			dojo.place('card_1','board');
			this.slideToObject( 'card_1', 'square_'+newlocationx+'_'+newlocationy   ).play();
			// adding the pointer for the cursor because Alice can be selected again!
			dojo.toggleClass( 'card_1', 'cardwithpointer' );
		},
But at this point apparently that div is gone and the log is not recorded...
And this is not happening all the times!

Any suggestion, brainstorming is welcome... because from the log I am not sure I can understand why the log is missed! Simply because it IS missed!

Ema

Re: Reply shows "move 3" as first move

Posted: 07 July 2020, 09:38
by joezg
Log is a list of notifications. That is the only thing stored so a game should be replayed as game setup followed by stream of notifications. (Or something very similar to this.)

Look for the code that updates the UI outside of notifications, possibly in action handlers in JS.

Re: Reply shows "move 3" as first move

Posted: 07 July 2020, 12:00
by Emanuele Ornella
So let me think loud...
If the log does not show move 2 it is because it was not recorded in the DB.
And the cause can be because the action was not arrived from the JS to the PHP, or because the notification did not come back correctly from PHP to JS.
If the game was loading while making the action and everyone was stuck it is more likely the game was not receiving the action, am I wrong?

I am not sure the issue is on the UI update because in this case the notification would be stored... or not?