Page 1 of 1

Deckbuilder

Posted: 26 July 2022, 10:58
by Oermelie
Hi everyone,
Im new to BGA and I want to create a deckbuilder.
How to accomplish that every player have his own deck?

Sorry for this perhaps easy question.

Greetings
Marco

Re: Deckbuilder

Posted: 26 July 2022, 12:37
by RicardoRix
Does the player create the deck each and every game? Or is the deck to be maintained over many games?

If the player creates a new deck each game, then you just use the DB, the same any other normal game.
https://en.doc.boardgamearena.com/Game_ ... bmodel.sql

But if it's over many games, then you have some limited options:

game preferences: (probably not very well suited)
https://en.doc.boardgamearena.com/Game_ ... ns.inc.php

legacy data. (limited, and not used much?)
https://en.doc.boardgamearena.com/Main_ ... _games_API

Encoded string (probably best?)
Agricola has a different approach by giving the user a long data string. This string is encoded/decoded.
Later the user can enter the same string. I remember flash games sometimes used this approach and worked for saved game states.
This is also good for sharing decks between players in forums and such.
The downside might be that this information is public information to a degree. So you can't really cover specially attained otherwise locked cards.

Re: Deckbuilder

Posted: 26 July 2022, 15:27
by Fletcheese
I'd recommend using the "Deck" component utility: https://en.doc.boardgamearena.com/Deck

Default all the card locations to the deck/play area and when a player purchases/picks a card, move the card to that player by setting the location to their unique player ID. If you're new you probably should spend some time reading through the tutorials and this will start making a lot more sense.

Re: Deckbuilder

Posted: 27 July 2022, 10:48
by Oermelie
Thanks for your answers.

The deck is created each game.

So i have to create a deck object per player?

deck_{playerid}

or a db table per player?

Re: Deckbuilder

Posted: 27 July 2022, 11:19
by SwHawk
No the Deck component is able to manage all the cards in your game, you just specify their location.

Since you want each player to have their deck, I'd advise using "deck_$playerId" and associated "discard_$playerId" locations, keeping the location_arg field to indicate order of cards in the deck.

The locations in the Deck component are yours to create and chose, you don't have to stick to the locations given in the documentation.

EDIT: Actually the Deck component can manage any object you want. In the game I'm adapting, I'm using it for cards and tokens, and everything is fine.