Generating starting tokens

Game development with Board Game Arena Studio
Post Reply
User avatar
Hornir91
Posts: 38
Joined: 15 October 2018, 06:39

Generating starting tokens

Post by Hornir91 »

Hi.

I came recently into a problem with generating starting game situation. I need to ask what are the best practices connecting to it? Should I create cards and tokens in the setupNewGame() method or with separate gamestate? I've tried already with separate state to generate tokens with notifications, but there is a problem that notifications aren't sent to the client. Am I doing something wrong?
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: Generating starting tokens

Post by RicardoRix »

yes in the setupNewGame()

you can then load the data you need in getAllDatas() and receive it on the client in setup: function( gamedatas )

- no notifications required.
User avatar
Hornir91
Posts: 38
Joined: 15 October 2018, 06:39

Re: Generating starting tokens

Post by Hornir91 »

Oh, thanks. I thought that getAllDatas() only works when reloading a page, but it also functions on start. I will do it with setupNewGame().

Another question is that through the game, states are utilising notifications to get the informations from the server and when I need to generate something on new round I will have to work with them?
User avatar
tchobello
Posts: 694
Joined: 18 March 2012, 13:19

Re: Generating starting tokens

Post by tchobello »

notifications send information from PHP (server) to javascript (client).

when entering a new state, you can send info with arg_nameofstate (for use in javascript or the action bar).
User avatar
Hornir91
Posts: 38
Joined: 15 October 2018, 06:39

Re: Generating starting tokens

Post by Hornir91 »

Ok, thanks.
Post Reply

Return to “Developers”