Page 1 of 1

log order change on refresh

Posted: 24 June 2020, 09:33
by Ralchimist
Hi!

I have an "issue" with log notification.
Here is my code: (with 3 notifications)

Code: Select all

 self::notifyAllPlayers( "noClaimer", clienttranslate( 'Nobody claims ${TileId}.' ), array(
                'TileId' => $tiletoclaim['id'], 
                'tile_type' => $tiletoclaim['type'],
                'tile_value' => $tiletoclaim['type_arg'],
            ) );
            self::notifyAllPlayers('pickTile', clienttranslate( '${player_name} pick a tile from the Great Wall.' ), array (
                    'deck_from'=> 'greatwall', 
                    'player_id' => $player_id,
                    'player_name' => self::getActivePlayerName(),
                    'tile' => $newTile ));
                self::notifyPlayer( $player_id, 'blank', clienttranslate('${You} pick ${TileId}'), array(
                    "You" => "You",
                    "TileId" => $newTile['id'],
                ) );
In the log, I can see them in the right order and everything works fine:
first: Nobody claims ${TileId}
second: ${player_name} pick a tile from the Great Wall
third: ${You} pick ${TileId}

But when I refresh the page, the order of logs is modified:
first: ${You} pick ${TileId}
second: Nobody claims ${TileId}
third: ${player_name} pick a tile from the Great Wall

The self::notifyPlayer displays before the self::notifyAllPlayers...

maybe I've done something wrong.
Thanks for your help!

Re: log order change on refresh

Posted: 01 January 2021, 13:03
by Ralchimist
up! I still have the issue.

Re: log order change on refresh

Posted: 01 January 2021, 17:43
by Victoria_La
Does t really matter? When you refresh they probably become different type of notifications, i.e history which only used to show log text

Re: log order change on refresh

Posted: 08 March 2021, 11:50
by Ralchimist
I come back to this problem.
If there's notifyPlayer log and notifyAll log at the same timing(minute ranged), on refresh the notifyPlayer log appears first...

Why logs do not appear in precise (milliseconds or seconds?) chronological order?

Re: log order change on refresh

Posted: 10 March 2021, 20:53
by LaszloK
It's probably something to do with how log entries are stored in the DB. The same thing happens in a lot of games. Look at a Hanabi replay log - things look pretty odd there, too.

Ideally this should be fixed site-wide, but as it is just a minor inconvenience in most games (if that) I wouldn't hold my breath. If you can present a compelling case as to why it's a major problem for you, that might change things, of course.

Re: log order change on refresh

Posted: 25 May 2025, 08:45
by ShaPhi7
Bumping this up to check to see if anyone has any good ideas for solutions on this, as it's still an issue.

I'm working on a premium game, where the turn based game is currently close to unplayable because of notifications showing as in the correct order.

I've only been able to come up with rubbish workarounds such as numbering notifications (which will look pretty awful to the user and adds complication to the code).

I'd be really keen to here ideas on how to address this.

Re: log order change on refresh

Posted: 27 May 2025, 21:18
by ShaPhi7
I think the easiest way for me to solve this is by grouping notifications together, rather than firing multiple notifications off in a short space of time. Hopefully this doesn't impact the gameplay too much.

I would still be keen to hear potential ideas/solutions from the community here.