"pile" style Deck location

Game development with Board Game Arena Studio
Post Reply
sparr
Posts: 65
Joined: 08 April 2014, 02:12

"pile" style Deck location

Post by sparr »

getCardOnTop( $location )
Get the card on top of the given ("pile" style) location
This "pile" concept is mentioned in a few places in the Deck documentation, and it's mentioned that the standard "deck" location is a pile, but I can't find any info on what, if anything, makes another location a "pile". One of the locations in my game is pile-like, and I'd like to keep cards in it in order, if possible.
User avatar
panyakali
Posts: 15
Joined: 11 May 2020, 15:59

Re: "pile" style Deck location

Post by panyakali »

I know that this post is *super* old, but I was actually just wondering the same thing... Can anyone help?
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: "pile" style Deck location

Post by Tisaac »

I think any location is actually a pile but you must not use the location_arg that store the position of the card in the pile.
User avatar
Brainchild
Posts: 71
Joined: 31 January 2014, 19:42

Re: "pile" style Deck location

Post by Brainchild »

That's my understanding too. As long as you don't change the location_arg, that location will behave as a pile. Each card in the pile will have an auto-incremented location_arg value that identifies where it is in the pile relative to the other cards.
User avatar
joezg
Posts: 70
Joined: 16 June 2011, 17:17

Re: "pile" style Deck location

Post by joezg »

My understanding is similar.

When you shuffle the location, all items in that location get random int in location_arg which is order of cards in a pile.

I think that "pile" is just that: a location that has unique int in location_arg representing the order of items in that location. It is not important if the location was shuffled or not, but every item has to have unique int in location_arg.
User avatar
panyakali
Posts: 15
Joined: 11 May 2020, 15:59

Re: "pile" style Deck location

Post by panyakali »

OK, so, just to chime in here- from what I've discovered from fiddling around with BGA "Deck" methods, when you create a set of cards to go into a specific deck, they are *NOT* in a "pile" format by default. To get each element in the deck to have a unique location_arg, you must first call the shuffle('my_location_name') on the deck, and this will both shuffle the cards and turn the location into a "pile" deck.
User avatar
Brainchild
Posts: 71
Joined: 31 January 2014, 19:42

Re: "pile" style Deck location

Post by Brainchild »

panyakali wrote: 06 July 2020, 19:39 OK, so, just to chime in here- from what I've discovered from fiddling around with BGA "Deck" methods, when you create a set of cards to go into a specific deck, they are *NOT* in a "pile" format by default. To get each element in the deck to have a unique location_arg, you must first call the shuffle('my_location_name') on the deck, and this will both shuffle the cards and turn the location into a "pile" deck.
I have not observed this behaviour in the game I'm implementing. I'm using a pile (unique location_arg for each card) and I never call shuffle(). I do however call insertCardOnExtremePosition() with a 'true' value for the third argument, which may be another way to trigger pile semantics.
User avatar
panyakali
Posts: 15
Joined: 11 May 2020, 15:59

Re: "pile" style Deck location

Post by panyakali »

I'm using a pile (unique location_arg for each card) and I never call shuffle(). I do however call insertCardOnExtremePosition() with a 'true' value for the third argument, which may be another way to trigger pile semantics.
Perhaps. When I'm making these new piles I use the typical array structure:

Code: Select all

array ('type' => $type,'type_arg' => $value,'nbr' => $nbr );
...and then I just call createCards without any bells and whistles:

Code: Select all

createCards( $card_creation_array, 'new_pile');
...so that may be it.

I'm still learning the framework- is insertCardOnExtremePosition typically a better way to go?
User avatar
Brainchild
Posts: 71
Joined: 31 January 2014, 19:42

Re: "pile" style Deck location

Post by Brainchild »

panyakali wrote: 07 July 2020, 01:36 I'm still learning the framework- is insertCardOnExtremePosition typically a better way to go?
No, what you're doing is correct. I also call createCards() but for my game the deck order isn't important and each player starts with every card already in their hand anyway. It's a unique situation.
Post Reply

Return to “Developers”