• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Dialog poker system

Status
Not open for further replies.
Level 6
Joined
Apr 15, 2012
Messages
205
I have been trying to figure out how to create a poker game with dialogs like the one in Poker Defense Revolution. The problem is that the only way that I know how to do it requires a lot of actions since there are 52 diffrent kind of cards and 5 card slots. I have figured out how too compare the cards by using arrays. If somebody knows how to make it with a small amount of code, please tell me.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
The idea is to de-couple the art from the card.

The actual system works by either keeping track of which type and suit of card the players own or by keeping track of which cards players have (and each card is given a unique type and suit). In the graphic component you then generate the art based on the type and suit of card. The easiest way to do this would be to map type and suit to various art data such as a struct of all the needed visuals. You then feed this art data into your system which generates the corresponding card dialog components.

The important part is to keep card mechanics and card art separately and try and abstract cards into data rather than code.
 
Level 6
Joined
Apr 15, 2012
Messages
205
I might try to split the card into 2 dialog item images, the upper part of the card will be the type of card (2,3,4,5,6,7,8,9,10,J,Q,K,A) and the lower part will be (Hearts, Spades, Diamonds, Clubs) that way it will be easier to generate the cards.
 
Level 3
Joined
May 4, 2008
Messages
51
If I were you, I'd make a 52 integer array and store/retrieve my information from with with a simple function that would return the number of the card, the type and the actual owner.

Here's how I would format it: "NNTPP"
NN: Number of the card, 01-13
T: Type of the card, 1-4
PP: The ID of the player actually owning the card (0-15)

That's my two cents.
 
Level 6
Joined
Apr 15, 2012
Messages
205
If I were you, I'd make a 52 integer array and store/retrieve my information from with with a simple function that would return the number of the card, the type and the actual owner.

Here's how I would format it: "NNTPP"
NN: Number of the card, 01-13
T: Type of the card, 1-4
PP: The ID of the player actually owning the card (0-15)

That's my two cents.

Do you mean like this: Card[01-13][1-4][0-15]? There are also 5 slots for each hand. How so I for example make this Card[01][1][1] show the image of two of hearts for player 1? I have never used functions before, please explain.
 
Status
Not open for further replies.
Top