Page 1 of 1

Post Release / Best approach for new feature (involving new user preference, gamestates or dbupgrade)

Posted: 19 September 2021, 13:29
by vurtan
I'm working on adding a "highlight last move" feature to one game. The information about the last move is only available in the notifications sofar and I believe that is not possible to extract the data from there without much effort (otherwise please tell me).

My idea is to store the relevant information (three integer values for the last move, six if I go for the last two moves) on my own and update them accordingly. In addition if the highlighting should be active or not, and how many moves should be highlighted should be player specific.

For the user specific setting I need one new setting in the gameoptions.inc.php. That is quite simple and I believe will not break running games (since there is a default value settable).

For storing the information I found two possible ways:
1. Adding new global game states (using self::initGameStateLabels(...) )
2. Extending one of the existing tables (player or deck-component)

I implemented it currently using the first option with new global game states, and in Studio it worked like a charm. The not existing game states got at the beginning a 0 (which is ok for me).

In addition I checked the Post-Release information (https://en.doc.boardgamearena.com/Post-release_phase and wondered if that might break any running games if I would deploy the version, or should I go using the second way?

Also if I missed a possibility to implemented that, please let me know.

Best regards
Helmut

Re: Post Release / Best approach for new feature (involving new user preference, gamestates or dbupgrade)

Posted: 19 September 2021, 17:48
by Victoria_La
Yes adding new global won't break anything if you handle default case (0) properly.
But I still don't understand what do you mean by highlighting last move? Isn't last move last in the log?
You can hook up to logging system (and notification system) to track the last move id, what exactly you are looking for?

Re: Post Release / Best approach for new feature (involving new user preference, gamestates or dbupgrade)

Posted: 21 September 2021, 08:33
by vurtan
Thanks for the answer regarding the new global. I'm glad that it wont break anything.

The game I'm working on is Veletas (https://boardgamearena.com/gamepanel?game=veletas). It is a 2 player only game and during the game you move shooters and place stones on a board.
The last move and the last stone placement are available in the notification log (two seperate entries for each action) with all the infos I would need.
I would love to hook into the logging system to get the info from there. If you know one implemented where it is done or have something to start for me please let me know.

The highlighting should be similiar to the highlighting in Halma, Squadro and Insert for example. There the last moved piece is highlighted with a shadow/border. This allows the player to see easily the last move of the opponent on the board and has not to read the coordinates from the log and check them on the board.

I could only get read access for the the project of Squadro where the last moved piece is determined using a column in a table. No idea how Insert or Halma track that.

Re: Post Release / Best approach for new feature (involving new user preference, gamestates or dbupgrade)

Posted: 21 September 2021, 11:19
by vurtan
Maybe to be a little bit clearer about the hooking in the notification system. I do know how to setup it up in the gamename.js to responded to notifications if the page is loaded.
What I do not know is how to access the notification during the setup() method in the gamename.js after the page is refreshed.

Re: Post Release / Best approach for new feature (involving new user preference, gamestates or dbupgrade)

Posted: 21 September 2021, 11:27
by Een
The right method is to store the last move to be able to display it as part of the current game state (either in gamestate variables, or in the database, depending on what's the easiest for the game), including after a refresh. When you do a refresh, you load the full state from the database (notifications are not replayed from the start of the game when refreshing; only new notifications will be received and handled by the interface to evolve from the current state).

Re: Post Release / Best approach for new feature (involving new user preference, gamestates or dbupgrade)

Posted: 22 September 2021, 22:22
by vurtan
Thanks for the answer. It assured me, that I did it the right way.

I do store the last move in the a gamestate variable to have it for a page refresh.