Implementing multi-stage secret action

Game development with Board Game Arena Studio
Post Reply
User avatar
salty-horse
Posts: 78
Joined: 14 June 2012, 23:08

Implementing multi-stage secret action

Post by salty-horse »

The game I'm working on, Mottainai, has a flow similar to Race for the Galaxy.
On a turn you can "build" a card by "paying" for it from your hand.

The player needs to provide me with several pieces of information before I'm willing to reveal the results to the other players:
1) Which build type they wish to make.
2) Which card they wish to build.
3) Which cards they wish to use as payment.

It makes sense to me to do all these things on the client-side, only sending the full action to the server after the player made all the choices.
However, I have a few questions:
1) RFTG (from what I can gleam from its client-side implementation) involves the server somehow, but I'm not sure how. Apparently you first pick a card, then get a notification from the server regarding how much you need to pay. How is that implemented without informing the other players of a state change?
2) If I wish to implement everything in the client side, I would like to update the status bar with new text and buttons after each step, but in the BGA this seems "reserved" to the game state mechanism. Is it OK to force different values to appear in it?
User avatar
Inaofr
Posts: 142
Joined: 26 March 2020, 22:26

Re: Implementing multi-stage secret action

Post by Inaofr »

I don't know for 1).
For 2), modifying the title bar (you call it status bar) is described in the BGA doc, see updatePageTitle() in http://en.doc.boardgamearena.com/Game_i ... eful_stuff.
User avatar
salty-horse
Posts: 78
Joined: 14 June 2012, 23:08

Re: Implementing multi-stage secret action

Post by salty-horse »

Thanks. Very weird how the rest of the doc calls it a "status bar".
Also, removeActionButtons isn't documented.
Is there a way to discover more of these functions that's not through the wiki documentation?
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: Implementing multi-stage secret action

Post by Victoria_La »

There are few ways to do that, document here in Multi Step Interactions

https://en.doc.boardgamearena.com/BGA_S ... _Selection

Regarding 1 you should send all possible moves in state args, if they secret make them private (see notification docs).
It possible to do server data request but its not officially supported/documentd, so just stick with documented stuff.
User avatar
salty-horse
Posts: 78
Joined: 14 June 2012, 23:08

Re: Implementing multi-stage secret action

Post by salty-horse »

Thanks!
User avatar
Hornir91
Posts: 38
Joined: 15 October 2018, 06:39

Re: Implementing multi-stage secret action

Post by Hornir91 »

Victoria_La wrote: 03 October 2020, 22:54 There are few ways to do that, document here in Multi Step Interactions

https://en.doc.boardgamearena.com/BGA_S ... _Selection

Regarding 1 you should send all possible moves in state args, if they secret make them private (see notification docs).
It possible to do server data request but its not officially supported/documentd, so just stick with documented stuff.
Hello. I'm trying to implement client states for selecting a card and playing it through a button, but there is a problem. How can I send args needed for such a state? I'm getting error, because ${You} isn't provided (needed for 'descriptionmyturn') and I can't figure out a way to do it for this client state.

Also I can't do it with two server states (one for selecting card and one for generate buttons and send ajax call), because active state is a multipleplayer one and I would prefer just to sent ajax after all the operations in the client.
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Implementing multi-stage secret action

Post by Tisaac »

Are you sure it's not ${you } instead ?
User avatar
Hornir91
Posts: 38
Joined: 15 October 2018, 06:39

Re: Implementing multi-stage secret action

Post by Hornir91 »

Nope. I have something like this.

Code: Select all

        onCardClicked: function(e) {
            dojo.stopEvent(e);
            dojo.addClass(e.path[0].id, 'card_selected');
            this.setClientState('client_PlayerChooseCard', {
                "descriptionmyturn": "${You} must choose a card place",
            });
        },
And In client_PlayerChooseCard I have ofcourse buttons for ajax calls to send data to the server but I'm getting an error:
"Invalid or missing substitution argument for log message: ${You} must choose a card place error"
User avatar
Hornir91
Posts: 38
Joined: 15 October 2018, 06:39

Re: Implementing multi-stage secret action

Post by Hornir91 »

Heh, writing post above I've noticed that ${You} was typed with upper letter. With "you" it started working >.>
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Implementing multi-stage secret action

Post by Tisaac »

Hornir91 wrote: 09 January 2021, 21:34 Heh, writing post above I've noticed that ${You} was typed with upper letter. With "you" it started working >.>
That's precisely what I meant ;)
Post Reply

Return to “Developers”