Page 1 of 1

Generating starting tokens

Posted: 11 December 2020, 17:57
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?

Re: Generating starting tokens

Posted: 11 December 2020, 18:13
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.

Re: Generating starting tokens

Posted: 11 December 2020, 18:51
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?

Re: Generating starting tokens

Posted: 11 December 2020, 20:12
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).

Re: Generating starting tokens

Posted: 12 December 2020, 16:53
by Hornir91
Ok, thanks.