How to detect game end

Game development with Board Game Arena Studio
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: How to detect game end

Post by thoun »

Tisaac wrote: 16 February 2024, 20:48
thoun wrote: 16 February 2024, 13:31 I use this in getAllDatas :
$isEndScore = intval($this->gamestate->state_id()) >= ST_END_SCORE;
Wouldnt that be dangereous if you use state with ids > 100 ? :)
Yes of course you'll need to adapt the code if your state numbers aren't ordered
User avatar
AxeCrazy
Posts: 90
Joined: 15 March 2014, 01:07

Re: How to detect game end

Post by AxeCrazy »

My problem is not te detection of the endgame.(Yes, perhaps i should have created a new thread :) )
That works as it should and also the scoring is displayed oke.
My problem is the final state of the board.
This is saved correctly before switching to endgame stae in the backend, but this state does not become available in the frontend.
So i cannot change the final state of the board.
When pressing F5 the final state is displayed correctly.

Was thinking about overriding the argendgame function, but this is not recommended.
And the board in the gamestate object is not modified at each state event.
Any ideas on how to get the final board state to the frontend?
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: How to detect game end

Post by Tisaac »

AxeCrazy wrote: 17 February 2024, 00:12 My problem is not te detection of the endgame.(Yes, perhaps i should have created a new thread :) )
That works as it should and also the scoring is displayed oke.
My problem is the final state of the board.
This is saved correctly before switching to endgame stae in the backend, but this state does not become available in the frontend.
So i cannot change the final state of the board.
When pressing F5 the final state is displayed correctly.

Was thinking about overriding the argendgame function, but this is not recommended.
And the board in the gamestate object is not modified at each state event.
Any ideas on how to get the final board state to the frontend?
Not sure to understand, why dont you send notification ?
User avatar
AxeCrazy
Posts: 90
Joined: 15 March 2014, 01:07

Re: How to detect game end

Post by AxeCrazy »

Eureka!
Thats it.
As said, first game, so nothing is obvious.

Thanx a lot!
Post Reply

Return to “Developers”