Set up initial scores

Game development with Board Game Arena Studio
Post Reply
User avatar
DargorX
Posts: 33
Joined: 10 September 2012, 20:16

Set up initial scores

Post by DargorX »

Hello!

First of all I'm newbie and I'm suffering with my first development :(

I'm totally blocked trying to set up players scores on table refreshing, it must be a very simple thing that all the games do but I'm not able to find the place to do that :oops: :cry:

I thought that the initial state (the first one after state 1) was the place but I am observing that some code in that state function (stNewRound in my case) are not executing (like a simple self::debug) and other parts yes.

Thanks in advance.
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: Set up initial scores

Post by RicardoRix »

Not 100% sure what you're asking:

You need to update the player_score field in the player DB.

I think you mean the php game function. getAlldatas() (this is the F5 page refresh and/or start of the game).
you'll have something like $result['players']
but normally this is all setup for you, and it's automatically applied client side.

otherwise, for the client during the game with notifications:
http://en.doc.boardgamearena.com/Game_i ... yers_score
User avatar
DargorX
Posts: 33
Joined: 10 September 2012, 20:16

Re: Set up initial scores

Post by DargorX »

OMG! :lol:

I splitted players in $result['player'] and $result['opponents'] for different player boards view and other data, and I've not noticed I was breaking this automatic behaviour :D

Sorry for the newbie question.
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: Set up initial scores

Post by RicardoRix »

I would expect everything inside the player table to be global information for all, so no need to change it. There's more boiler plate code supplied for things like favourite player colours.

client side as another freebie you'll have

this.player_id to identify the current player.

you'll often see things like,
if (player_id == this.player_id) inside a loop.

you also have
if ( this.isCurrentPlayerActive() )
Post Reply

Return to “Developers”