[ Solved ] Define this is a team game and get the teams in the current game?

Game development with Board Game Arena Studio
Fred504
Posts: 22
Joined: 06 January 2024, 13:20

[ Solved ] Define this is a team game and get the teams in the current game?

Post by Fred504 »

Hello

How and where should I define that the game is played with teams?

How should I get the teams of the current game?
Last edited by Fred504 on 10 January 2024, 20:48, edited 1 time in total.
Fred504
Posts: 22
Joined: 06 January 2024, 13:20

Re: Define this is a team game and get the teams in the current game?

Post by Fred504 »

In this page https://en.doc.boardgamearena.com/Game_ ... os.inc.php
we can see
- coop mode
- tie breaking
...

But I see nothing about team mode.

Des anybody know
- how to set team mode
- how to get the teams of the current game
?
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: Define this is a team game and get the teams in the current game?

Post by RicardoRix »

You can download a project from BGA Studio to see how other developers have done it.

I've never done this, but my best guess is that you use

Code: Select all

'losers_not_ranked' => true,
This will show winners, and losers in the game end result page.
The rest is up to you to code, there is nothing else in the framework:
At the end of the game, set the score to the same for all the winners, probably above 0.
and set the score to the same for all the losers, probably 0 or less.

You could modify the player table to add a new field to keep track of teams. There are a few places in the code to modify for this, like the dbmodel and the php game setup.
Last edited by RicardoRix on 10 January 2024, 13:54, edited 1 time in total.
User avatar
ufm
Posts: 2039
Joined: 06 January 2017, 08:38

Re: Define this is a team game and get the teams in the current game?

Post by ufm »

Currently, such a feature doesn't exist in BGA framework.

For now, the only possible course of action is:
- Set 'losers_not_ranked' to true
- Set the scores of all teammates in a team equal

How to get the list of teammates depends on the game and you.
If all teams sit alternately, you could use player_no in player db table. If not, you may have to add a column.
Fred504
Posts: 22
Joined: 06 January 2024, 13:20

Re: Define this is a team game and get the teams in the current game?

Post by Fred504 »

ufm wrote: 10 January 2024, 13:53 Currently, such a feature doesn't exist in BGA framework.

For now, the only possible course of action is:
- Set 'losers_not_ranked' to true
- Set the scores of all teammates in a team equal

How to get the list of teammates depends on the game and you.
If all teams sit alternately, you could use player_no in player db table. If not, you may have to add a column.
Thanks.
OK for these points.

! But for the current teams:
When you start a game with teams (ex coinche), BGA asks you if you want the teams player1+player2 vs 3+4 or other settings.
I can't guess the setting players choose.
So I need a framework function or an SQL query to get this information.
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: Define this is a team game and get the teams in the current game?

Post by RicardoRix »

that's a game option:
https://en.doc.boardgamearena.com/Optio ... ences.json

You would do well to read some documentation, or follow a tutorial:
https://en.doc.boardgamearena.com/Studi ... _reference

and you can download the coinche project.
Fred504
Posts: 22
Joined: 06 January 2024, 13:20

Re: Define this is a team game and get the teams in the current game?

Post by Fred504 »

OK with options.thanks! 👍
Fred504
Posts: 22
Joined: 06 January 2024, 13:20

Re: Define this is a team game and get the teams in the current game?

Post by Fred504 »

RicardoRix wrote: 10 January 2024, 14:14 that's a game option:
https://en.doc.boardgamearena.com/Optio ... ences.json

You would do well to read some documentation, or follow a tutorial:
https://en.doc.boardgamearena.com/Studi ... _reference

and you can download the coinche project.
The BGA documentation says options are in gameoptions.json

In the github coinche, there's no gameoptions.json.
The options are in gameoptions.inc.php
https://github.com/drasill/bga-coinche/ ... ns.inc.php

So I don't know how I should do
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: Define this is a team game and get the teams in the current game?

Post by RicardoRix »

Generally speaking you're gonna have to figure things out for yourself.
The documentation is pretty good, in that it is concise. I would recommend you read it, and then read it again.

From:
https://en.doc.boardgamearena.com/Optio ... ences.json
Game options change (Optional!)
gameoptions.inc.php is now considered legacy, and gameoptions.json and gamepreferences.json are recommended for new projects:

The wiki and the template project have been updated: https://en.doc.boardgamearena.com/Optio ... ences.json
Any questions/problems can come to me, or can be asked here.
The format of the json files matches the format of the old php files
We realise there are some drawbacks (sorry!):

No comments in the JSON file, meaning you have to check the wiki for examples
No PHP constants in the JSON file, meaning magic numbers
However, we hope it's good for BGA because:

Simpler to parse (for robots and humans)
Easier to check for errors (we could perhaps use an XSLT one day)
No need to run game-specific PHP code on the metasite
NOTE: Switching is totally optional, and the legacy files will still work for existing projects, and for those who know about them.
Post Reply

Return to “Developers”