PDA

View Full Version : Cards



VenomousFiligree
November 16th, 2009, 08:28
Is it possible to extract the card mechanics from Savage Worlds and sell it as a stand alone extension?

Phil

drahkar
November 16th, 2009, 18:44
Unlikely. The sold modules are sold under a contract and most likely those contracts will not allow for that.

VenomousFiligree
November 16th, 2009, 19:20
Unlikely. The sold modules are sold under a contract and most likely those contracts will not allow for that.

All contracts are now held by Smiteworks USA :)

ddavison
November 16th, 2009, 20:56
The mechanics and code within FG are property of SmiteWorks, whereas the graphics and text specific to Savage Worlds are the property of Pinnacle Entertainment Group.

I believe it would have to modified to make it useful to people as an external system. Maybe something where it grabs all images from a "deck" folder under images or something. To be honest, I haven't actually looked into the code yet.

Do you have something specific in mind that you are looking to accomplish with it? I could chat up the original dev for that piece and get his thoughts.

Oberoten
November 16th, 2009, 21:16
With cards being in a separate folder one might just as well make cards for events and or futhark rune-stones etc. Could be very useful actually.

Hmmm..

- Obe

VenomousFiligree
November 16th, 2009, 21:16
Duty and Honour (https://www.omnihedron.co.uk/dutyandhonour/?page_id=101). It uses decks of cards (no dice).

joshuha
November 16th, 2009, 21:26
I actually programmed the deck code for Savage Worlds (unless it was changed in the newest version) so I would be happy rather than just extract it help the community come up with a more generic interface to it that would allow more customizable decks.

Phystus
November 16th, 2009, 23:49
Heck, I've got some buddies that would probably like to be able to just play card games via FG.

Cards would be good!

~P

tdewitt274
November 17th, 2009, 01:49
It would be nice to have a generic. The uses could be endless for extentions. Cards, Deck of Many Things, Harrow/Tarrot Deck, Runes, Critical Hit/Miss...

Not to mention in game games!

VenomousFiligree
November 17th, 2009, 07:08
I actually programmed the deck code for Savage Worlds (unless it was changed in the newest version) so I would be happy rather than just extract it help the community come up with a more generic interface to it that would allow more customizable decks.
Cool :)

My request (for D&H) would be for each Player (and GM) to have a deck and be able to deal out any number of cards "in front of them". The GM should also be able to deal a single card "in the centre of the table".

I would imagine this would be best achieved having the cards come up in the chat window, with the GM perhaps being able to switch IDs to differentiate between his single card and his multiple cards.

Zeus
November 17th, 2009, 08:13
Cool idea, my group would love to be able to run some real time games of Three Dragon Ante within our 4E games. A generic card deck feature would be a great addition.

joshuha
November 17th, 2009, 12:32
I actually programmed the deck code for Savage Worlds (unless it was changed in the newest version) so I would be happy rather than just extract it help the community come up with a more generic interface to it that would allow more customizable decks.

In case it wasn't clear I am talking about creating a new card interface from the ground up as a community effort. While I did program the card code for Savage Worlds that specific code was owned by Digital Adventures and thus now property of Smiteworks USA.

tdewitt274
November 17th, 2009, 14:40
Would this work as extention? I'm still pretty new to the programming (mostly working my way through existing code).

I would be interested in joining a group to develop this. I don't think that I'd be much help programming in the beginning. I've done other web coding, but am not familiar with Lua and my XML is weak.

sondermann
November 19th, 2009, 00:28
We could finally use the Savage World Adventure Deck in Fantasy Grounds!

johros
November 20th, 2009, 19:07
I would love to play some Munchkin games using fantasy grounds.
Many board games have cards in them, I would gladly pay money for a card extension.

Wargamer777
November 23rd, 2009, 02:57
Heck... I'm thinking DRAMA Deck aka TORG!! If we have a generic code that would pull from images we placed in the deck folder, it would be very nice. In order for it to work, we'd need to be able to define just how many cards are in the deck too.

joshuha
November 23rd, 2009, 04:02
Well what we should do first is define a set of requirements on what all we want it to do. That way we can start building a generic framework where hopefully all the mod maker has to do is make some path statements to a directory to pull in the card deck.

tdewitt274
November 23rd, 2009, 04:20
Just a quick list of Features and Functions. Feel free to add additional items. Better to have too many than not enough.

Features:

A user's "hand"
Customizable size of the deck
Customizable images for the card
Description of the card
Attribute of the card
Suit
Color
Card backing graphic
Card "number" or "letter"
Facing (upside down, right side up)
View (back, front)
Rotation (in case they are scattered on a field)
X, Y coordinate of the card (if on a field)

Functions:

Shuffle
Draw a card
Hold a card
Discard a card
Discard pile
Cut the deck


I think this should cover most of the features for a deck of cards, tarot, runes, bones, etc.

tdewitt274
November 23rd, 2009, 14:42
Thinking about the Shuffle function, there are a few methods that I use to shuffle a pack of cards. The "Bridge" method, "Shotgun" method, and "Double Shotgun" method.

The Bridge method splits the deck into two. Then the user bends back the cards and lets go slowly. The cards fold back into one pack at regular intervals. Probably the best/easiest method.

This could be done by taking the deck and determining a random number, or half the deck size, and splitting the deck. Then, append the bottom values to another temp control by alternating between the decks. Then take the resulting temp control and replacing the original. To "mix it up" a little, a random value between 1 card and no more than 10 can be used to move values into the temp control.

The Shotgun method (I'm sure there's a better name) is where the user takes the deck in one hand and "shakes" a lot into the other hand. This takes a range of cards from "below" and puts it on "top" only to be covered again.

This could be done by determining the maximum number and looping through a random number until the max has been reached. Each set of random numbers places the values on top of an existing temp control.

The Double Shotgun method is the same as the Shotgun, except the distribution is alternating. For example, the first range is put in the hand, the second on top, the third on the bottom, the forth on top until out of cards.

This can be done by using the Shotgun method and alternating if the modulus of the current count of the loop divided by two is equal to zero going on top, otherwise added to the bottom.

I've always heard that shuffling requires an average of 7 times to properly distribute a deck. I would suggest this be done only for the "Bridge" method. It takes considerably more to fully shuffle the Shotgun methods, unless small numbers are used.

tdewitt274
November 23rd, 2009, 15:02
Drawing cards is a pretty easy concept. You take the card off the Deck and put it in your Hand. If you do not need it, you put it in the Discard. It gets complicated when you add in the "Cut the Deck" feature.

In essence, I think there should be two decks, one being the Deck (all unused cards) and the Discard (all used cards). There should also be a character specific Hand that contains cards from the Deck that haven't been Discarded.

The "Cut the Deck" feature is kind of tricky. Sometimes you want to see just the card. Sometimes you want to use the card. For example, seeing a High or Low value to determine who does what is simply looking at the card. In Cribbage, you use the card for reference to gain points. For the most part, I've never participated in a game that says what to do after you reveal a Cut Card. This may be a GM option that says to reshuffle after cutting or to keep the deck intact.

The Hand should be limited, or unlimited, by the Game being played. For example, Go Fish has a different Hand size than Gin Rummy or Cribbage. If the hand size is exceeded, the rules need to say what to do with the excess cards. This may be an advanced feature that can be added later.

tdewitt274
November 23rd, 2009, 15:15
The nature of this thread is to create a generic "Card" deck. I think this can go beyond just cards and into objects as well. So long as there is a specific number of Objects in the Container.

What is a "card"? It's a three dimensional object with a front, back and sides. The front and back may have different looks. Each one has a specific size (length, width, and dept). In addition, they all have other attributes such as rotation, XY coordinates, and whether it is rightside up or upside down.

The object also has some meaning and description (physical and metaphorical). An object could be a Queen of Hearts or the rune Thorne. A specific color associated with the meaning, as well as the object itself. Sometimes the object may have multiple meanings such as a Tarot card showing at 0 degrees and at 180 degrees.

Sometimes the object has multiple values. For example, the Ace. Sometimes it can be high (J, Q, K, A) and sometimes low (A, 2, 3, 4). Sometimes a different value, like in Blackjack. This may be an advanced feature that can be updated in a future version or on a specific module/ruleset.

tdewitt274
November 23rd, 2009, 15:26
The size of the deck really doesn't matter except when shuffling, drawing a card, or holding cards. It should essentially be used to determine how to the above are administered.

If after drawing a card, the Deck is empty, then it needs to be reshuffled with the cards in the Discard.

If a reshuffle command is issued, it needs to shuffle the cards in the Deck and the Discard.

I don't know a lot about the FG framework, but I think that the "Cards" themselves could probably be created in an Extention. This way you can bring in your own custom collections.

tdewitt274
November 23rd, 2009, 15:30
Another feature that may be beneficial to games is the ability to "cherry pick" your cards.

For example, using a Tarot card deck to tell a person's fortune is pretty much useless in a RPG game. However, the ability to say "this is what I want the fortune to read" is pretty much priceless.

Essentially, a "Stack the Deck" feature should be implemented. This can move the cards needed to the top of the deck. Something like "AH, 2C, 3S, 4D, 5C" will put the cards in order at the top of the deck. Adding the ability to throw random cards in between would be nice as well!

Phystus
November 24th, 2009, 00:47
I've got a couple, um..., make that a bunch of functions to add to the wishlist:


Deal card
Play card (for trick-oriented games like hearts, bridge, euchre, etc.)
Optional logic for automatically determining the winner of a trick
Take trick
deal kitty
take kitty


Bidding and scorekeeping could be taken care of by chat and notes, respectively.

~P

tdewitt274
November 24th, 2009, 01:25
I typed up this big old email, so some of this is featured in Phytus' post above. I'm too lazy to clean it up ;)

Sorry in advance for the huge post.

Collections

In addition to the Deck, Hand, and Discard, there should also be a Table, Drawer, and Pool.

The Table
This allows the user to place items on a "table" so that others can see them. There may be times when a Hand is not used. This would be useful in demonstrations of the game (or just make the hand Visible to others). Most times, however, a card is moved from a Hand to a Table, but the Table could also allow to move to the Hand or Discard as well. The ability to keep items on the table not visible to others may be used as well.

In some games, the ability to score points is determined by what is on the table. There are games where you lose points for having cards in your hand. It would be up to the game to determine what the Bonus/Penalty is based on where the card is located.

The functions available to a Hand should also be available to the Table.

Drawer
A "Drawer" can be used to hold additional things, like money or chips. The ability to add more objects into the Drawer should be available.

Also, the ability to "convert" items in the drawer to other denominations should be available. The Drawer would have a starting amount deducted from the character. The character can add additional objects into the Drawer as needed.

Pool (for lack of a better word)
Objects from the Drawer can be added to the Pool. The users should be able to add to the Pool, but cannot pull from the Pool until there is a declared "winner." A "minimum bet" and/or "previous bet" may need to be maintained, as well as a "call" feature.

Functions

Scatter Shuffle
A "Scatter Shuffle" would be handy for decks that require orientation (Tarot, runes, etc). Start with the deck of cards and randomize the order, one by one, assigning a rotation to each card. If the degree is <= 90 or > 270, the rotation is 0. Otherwise, the rotation is 180.

Shuffling multiple times will randomize this information.

Straighten Deck
Puts the orientation of all cards to a rotation of 0.

Sort Deck
Puts the deck in the original order. Possibly straighten the deck as well.

Examine Deck
Shows the contents of the deck.

Trade Card
The ability to give cards to another character can be handy in multiple card games. Go Fish, for example, is based on this concept. Other options would be to "give" an RPG player a card so that it can be activated/used at another time (ex, "You need this card to get in." or "Play this card to get a +2 to attack.").

Activate/Deactivate
This kind of steps into the realm of CCGs, but the ability to "activate" an ability of the card can be helpful in multiple situations. For example, in Cribbage, you play 2 cards that total 15 to get 2 points and moves your counter on the board.

Sort Hand/Table
Mostly a user convenience, the ability to sort your hand. Options would be High-Low, Low-High, or Manually.

Group Hand/Table
The ability to separate objects from others. For example, in Gin Rummy, you want to group your different 3 of a kinds so that the points can be accumulated correctly.

Dealing Cards
I neglected to add this earlier because I thought that just having a "Draw" option would work. Dealing cards uses a specified rotation in distributing cards for the quantity of the cards in a starting hand. This usually is to the Left of the Dealer. An "order" for each Character and an indicator for the Dealer should work fine. Dealing starts with the Dealer and adds one to the order, then the "draw" function would be called. If the Order goes beyond the number of players, it is reset to 1 and continues on it's way. This is done until the Dealer has the desired amount of cards in his hand.

With Dealing, it should be noted that Cheat Options can play in the shuffling or distribution of the cards.

Rounds
The ability to determine when a round is finished is important. Technically, this is an initiative order. Start out with the Dealer with the lowest intiative and the person to the left with the highest. Everyone in between as a lower initiative. The ability to "bow out" of a round is needed.

Settings

Starting Hand
The Starting Hand should be a number of cards that are dealt. It should be independant of the Hand's maximum quantity.

Cheat options
The ability to cheat should be available for RPGs, but not in normal games. As mentioned before, "Stacking" the deck to get a desired result should be available for a RPG to further plot lines.

Adding a "character" into the mix would add options. For example, the player can use their "thievery" skill to try a cheat maneuver. Others would get an "perception" attempt to see if they can catch the cheat.

Cheat options would be "Passing a Card", "Card up the Sleeve", "Bottom of Deck Dealing", "Palming", and maybe "Pull a weapon".

Additional Features

Layouts
If possible, add different layouts to the Table. Hearts layout, Tarot layouts, etc. This may be difficult, but I would think that some scripting would be possible to move items on a Map.

tdewitt274
November 24th, 2009, 01:51
Just an FYI, I can code in Javascript and VBScript, but not LUA. From the look of it, it shouldn't be too bad to convert.

Here's a Bridge Shuffle in JS:


function BridgeShuffle () {
var strDeck = "As,2s,3s,4s,5s,6s,7s,8s,9s,10s,Js,Qs,Ks,Ah,2h,3h,4 h,5h,6h,7h,8h,9h,10h,Jh,Qh,Kh,Ac,2c,3c,4c,5c,6c,7c ,8c,9c,10c,Jc,Qc,Kc,Ad,2d,3d,4d,5d,6d,7d,8d,9d,10d ,Jd,Qd,Kd";
for (j=0; j < 7; j++) {
aryDeck = strDeck.split(",");
TorB = Math.round(Math.random());
strDeck = "";
for (i=0; i < (aryDeck.length)/2; i++) {
if (strDeck != "") { strDeck = "," + strDeck; }
if (TorB == 0) { TVal = (aryDeck.length)/2-1-i; BVal = aryDeck.length-i-1; } else { BVal = (aryDeck.length)/2-1-i; TVal = aryDeck.length-i-1; }
strDeck = aryDeck[TVal] + "," + aryDeck[BVal] + strDeck;
}
}
document.write(strDeck);
}


Edit: Forgot about alternating the top and bottom to get a random determination.
Edit2: Sorry, too many hours staring at a screen...

tdewitt274
November 24th, 2009, 03:34
Shotgun Shuffle - shuffled 7 times, not nearly as random as the Bridge Shuffle.



function ShotgunShuffle () {
var strDeck = "As,2s,3s,4s,5s,6s,7s,8s,9s,10s,Js,Qs,Ks,Ah,2h,3h,4 h,5h,6h,7h,8h,9h,10h,Jh,Qh,Kh,Ac,2c,3c,4c,5c,6c,7c ,8c,9c,10c,Jc,Qc,Kc,Ad,2d,3d,4d,5d,6d,7d,8d,9d,10d ,Jd,Qd,Kd";
for (k = 0; k < 7; k++) {
aryDeck = strDeck.split(",");
var i = 0;
strDeck = "";
while (i <= aryDeck.length-1) {
MaxVal = i + Math.round((aryDeck.length/4-1) * Math.random())+ 1;
if (i+MaxVal >= aryDeck.length-1) { MaxVal = aryDeck.length-1; }
tempDeck = "";
for (j=i;j<=MaxVal;j++) {
if (tempDeck != "") { tempDeck += ","; }
tempDeck += aryDeck[j];
}
if (strDeck != "") { strDeck = "," + strDeck; }
strDeck = tempDeck + strDeck;
i = MaxVal + 1;
}
}
document.write(strDeck + "<br />");
}

tdewitt274
November 24th, 2009, 03:44
Double Shotgun Shuffle - still not as good as the Bridge Shuffle



function DblShotgunShuffle () {
var strDeck = "As,2s,3s,4s,5s,6s,7s,8s,9s,10s,Js,Qs,Ks,Ah,2h,3h,4 h,5h,6h,7h,8h,9h,10h,Jh,Qh,Kh,Ac,2c,3c,4c,5c,6c,7c ,8c,9c,10c,Jc,Qc,Kc,Ad,2d,3d,4d,5d,6d,7d,8d,9d,10d ,Jd,Qd,Kd";
for (k = 0; k < 7; k++) {
var SideVal = 1;
aryDeck = strDeck.split(",");
var i = 0;
strDeck = "";
while (i <= aryDeck.length-1) {
MaxVal = i + Math.round((aryDeck.length/4-1) * Math.random())+ 1;
if (i+MaxVal >= aryDeck.length-1) { MaxVal = aryDeck.length-1; }
tempDeck = "";
for (j=i;j<=MaxVal;j++) {
if (tempDeck != "") { tempDeck += ","; }
tempDeck += aryDeck[j];
}
if (SideVal == 1) {
if (strDeck != "") { strDeck = "," + strDeck; }
strDeck = tempDeck + strDeck;
} else {
if (strDeck != "") { strDeck += ","; }
strDeck += tempDeck;
}
i = MaxVal + 1;
SideVal *= -1;
}
}
document.write(strDeck + "<br />");
}

Oberoten
November 24th, 2009, 09:42
Nice start. :)

That'll give us something to cut our teeth on.

- Obe

tdewitt274
November 24th, 2009, 13:28
A simplified version of the Scatter Shuffle.



function ScatterShuffle () {
var strDeck = "As,2s,3s,4s,5s,6s,7s,8s,9s,10s,Js,Qs,Ks,Ah,2h,3h,4 h,5h,6h,7h,8h,9h,10h,Jh,Qh,Kh,Ac,2c,3c,4c,5c,6c,7c ,8c,9c,10c,Jc,Qc,Kc,Ad,2d,3d,4d,5d,6d,7d,8d,9d,10d ,Jd,Qd,Kd";
for (k = 0; k < 7; k++) {
var tempDeck = strDeck;
strDeck = "";
while (tempDeck != "") {
aryDeck = tempDeck.split(",");
RandVal = Math.round((aryDeck.length-1) * Math.random());
if (strDeck != "") { strDeck += ","; }
strDeck += aryDeck[RandVal];
tempDeck = aryDeck.join(",");
if (aryDeck.length != 1) {
if (RandVal == 0) {
tempDeck = tempDeck.replace(aryDeck[RandVal]+",","");
} else {
tempDeck = tempDeck.replace(","+aryDeck[RandVal],"");
}
} else {
tempDeck = tempDeck.replace(aryDeck[RandVal],"");
}
}
}
document.write(strDeck + "<br />");
}

tdewitt274
November 24th, 2009, 13:36
Draw Card (bottom) with the modified Scatter Shuffle:



function ScatterShuffle () {
strDeck = "As,2s,3s,4s,5s,6s,7s,8s,9s,10s,Js,Qs,Ks,Ah,2h,3h,4 h,5h,6h,7h,8h,9h,10h,Jh,Qh,Kh,Ac,2c,3c,4c,5c,6c,7c ,8c,9c,10c,Jc,Qc,Kc,Ad,2d,3d,4d,5d,6d,7d,8d,9d,10d ,Jd,Qd,Kd";
for (k = 0; k < 7; k++) {
var tempDeck = strDeck;
strDeck = "";
while (tempDeck != "") {
aryDeck = tempDeck.split(",");
RandVal = Math.round((aryDeck.length-1) * Math.random());
if (strDeck != "") { strDeck += ","; }
strDeck += aryDeck[RandVal];
tempDeck = aryDeck.join(",");
if (aryDeck.length != 1) {
if (RandVal == 0) {
tempDeck = tempDeck.replace(aryDeck[RandVal]+",","");
} else {
tempDeck = tempDeck.replace(","+aryDeck[RandVal],"");
}
} else {
tempDeck = tempDeck.replace(aryDeck[RandVal],"");
}
}
}
return strDeck;
}
function DrawCard () {
if (strDeck == "") { strDeck = ScatterShuffle(); }
aryDeck = strDeck.split(",");
if (strDeck == aryDeck[0]) {
strDeck = strDeck.replace(aryDeck[0],"");
} else {
strDeck = strDeck.replace(aryDeck[0] + ",","");
}
document.write(strDeck+"<br />");
document.write(aryDeck[0]);
}


Edit: Modified to take a card off the top.

tdewitt274
November 24th, 2009, 13:59
Deal Hand function with modified Deal Card function (forgot to take the card off the top).



function DrawCard () {
if (strDeck == "") { strDeck = ScatterShuffle(); }
aryDeck = strDeck.split(",");
if (strDeck == aryDeck[0]) {
strDeck = strDeck.replace(aryDeck[0],"");
} else {
strDeck = strDeck.replace(aryDeck[0] + ",","");
}
return aryDeck[0];
}
function DealCard () {
var NumUser = 4;
var NumCard = 10;
var strHand = "";
for (i=1;i<NumUser;i++) {
strHand += ";";
}
aryHand = strHand.split(";");
for (i=0;i<NumCard;i++) {
for (j=0;j<aryHand.length;j++) {
if(aryHand[j] != "") { aryHand[j] += ","; }
aryHand[j] += DrawCard();
}
}
strHand = aryHand.join(";");
document.write (strHand);
}

tdewitt274
November 24th, 2009, 14:24
Just a quick note. These functions are not error handled for decks that are not evenly divisible by 2. So, if you modify the deck to be a odd length, you'll end up with issues. Since they're individual procedures, this shouldn't be a big issue right now.

Eventually, I'll post these to a website so you can see them in action.

Sigurd
November 24th, 2009, 17:30
I think we should have a target to direct everybody. Something with known rules we can then apply to amorphous projects.

Lets start with straight poker because its structure is easy.
The hands get dealt.
There are a number of draws\discards from a diminishing deck.
The hands get put on the table.
The cards get collected.
The cards get shuffled.
Begin again.Respectfully, I'm going to recommend Cribbage as a target game because I think most of its elements would be useful.

2 - 4 'hands'
1 Kitty of hidden cards built from discards
A turned over card that can affect the other cards
A point system.
A score keeping system

I hope this is helpful.


Will we be able to reduce everything to right click options on a deck?

tdewitt274
November 25th, 2009, 02:16
I think we should have a target to direct everybody. Something with known rules we can then apply to amorphous projects.

Good idea. Unless someone has other suggestions, how about 5 Card Draw (https://en.wikipedia.org/wiki/Five-card_draw)? It's pretty straight forward and the Wiki entry has the basics.


Will we be able to reduce everything to right click options on a deck?
I think this should be able to be accomplished. Between the Right Click and GM Options, I think everything should fit.

On another note, if needed, I have a website that we can use as well. However, I think that keeping conversations on this thread would be helpful.

While we work on ideas, does anyone know what would be the best approach for this project? I don't know much about the structures (Ruleset, Module, Extention) to know what would work best or wouldn't work at all.

tdewitt274
November 25th, 2009, 03:14
Compilation of previous posts. Suggestions are appreciated.

Framework: 5 Card Draw (https://en.wikipedia.org/wiki/Five-card_draw) (suggested)

Collections

Character
Money
Drawer
Chips

Value
Image

Conversion Info
Kitty
Bets

Order
Quantity

Table
Deck
Size
Cards

Front Image
Back Image
Description
Suit
Color
Order Number
Card Number/Letter
Facing
Orientation
X, Y Coordinate (if on a field)

Hand
Discard


Settings

Hand

Starting Size
Max Size

Cheat Options (Advanced features)

Stack the Deck (Option)
Pass a card
Palming



Features

Bidding
Score keeping
Card Layouts


Functions

Shuffle

Bridge (https://www.fantasygrounds.com/forums/showpost.php?p=81253&postcount=26)
Shotgun (https://www.fantasygrounds.com/forums/showpost.php?p=81259&postcount=27)
Double Shotgun (https://www.fantasygrounds.com/forums/showpost.php?p=81259&postcount=28)
Scatter (https://www.fantasygrounds.com/forums/showpost.php?p=81259&postcount=30)
Sort - Original order
Straighten Deck - Orientation
Examine

Draw a card

Deal (https://www.fantasygrounds.com/forums/showpost.php?p=81267&postcount=32)
Draw (https://www.fantasygrounds.com/forums/showpost.php?p=81267&postcount=31)
Cut the deck

Hand

Sort

Manual
Suit
Number

Group

Manual
Suit
Number

Hold a card
Play/Activate/Deactivate
Discard a card
Take Trick

Table

Sort

Manual
Suit
Number

Group

Manual
Suit
Number

Take Trick

Drawer

Convert Money
Distribute Chips

Kitty

Make Bet
Take Kitty

Sigurd
November 25th, 2009, 03:43
I don't know that we have to concern ourselves with betting right away. A lot of times players can simply keep track of what they have to bet and the DM can keep half an eye on it if its necessary.

On the other hand, it might be possible to have a 'player box' that holds available tokens. When these are gone you're bankrupt, have to buy tokens or whatever.

A player reserve like that could be useful for other things too.

Still I think we should constrain ourselves to the cards first and tighten our focus to get genuine success. If we can achieve something we will gain momentum.


Sigurd

tdewitt274
November 25th, 2009, 05:15
Still I think we should constrain ourselves to the cards first and tighten our focus to get genuine success. If we can achieve something we will gain momentum.

Valid point. Never hurts to see a wish list. This way you can keep in mind other options for down the road. But, as you said, you need to focus on v1.0. If all works out, then think about v2.0.

Sigurd
November 25th, 2009, 07:11
I might be wasting time here because I know _Nothing_ about LUA. I'm going to have to look into it.


It seems to me thought that the first, most basic function could be a line tool to handle just the randomization

Deck = is a data set of x cards.
Draw - a function that pulls one from the dataset, diminishing the total by one.
Shuffle - A function that returns all the cards to the data set.

So a standard deck would be 52, or 54, cards with a structured list of values.

01-13clbs,01-13dmnds,01-13hrts,01-13spds,01jkr,02jkr

A random roll of 14 should draw the 01dmnds and remove it from the deck.

Even if the function was a die roll that returned "01dmnds" or whatever it would be useful if you knew nobody else could draw the same card.

Down the road...
The values would have to be unique and ideally be comparable. 12 is better than 11 but spds might be better than clbs.

The card values should be rather verbose because Italian, Spanish, Tarot, and 'decks of many things' might be in the future.


Some manner of tying each value to an image and showing that image would make it much nicer for the player but its not strictly necessary. What is necessary is not duplicating cards when you use the draw function because you shouldn't know what other cards are in play.


Am I spinning my wheels or is this useful?


Sigurd

tdewitt274
November 25th, 2009, 13:17
Am I spinning my wheels or is this useful?


This is useful, I forgot to mention in some of my notes about issues that could arise with a deck.

The Javascript functions that I posted take a specific string of each of the name values. It should, of course be expanded to include the different attributes of the card. In order to sort the deck to put it to normal, it requires a Sort order. This is much easier than trying to figure out if Diamonds are better than Spades, comparing a 3 and a K, etc.

There are also some card games that use multiple decks. For example, there's a game out there who's name escapes me that uses four decks of cards.

On the same line, Go Fish has multiples of the same type of card within the same deck. So, when drawing/dealing a card, you need to get rid of a specific card.

One of my questions with Lua is weather you can take a string with all the defined values, parse it, and create the deck? This could be helpful with adding a "Select Deck" function that stores all the Decks and loads the one that you need (ex, /deck Tarot, /deck Standard, /deck Go Fish).

zabulus
November 26th, 2009, 21:44
Hmm.... with cards incorporated, you could put most any boardgame into FG. I'm thinking talisman, runebound, endless possibilities... *shivers happily*

Zeus
December 13th, 2009, 11:58
Is anyone still actively working on this? If so could they update this thread or perhaps PM me with the latest status.

I'd be happy to lend a hand in its development. Whilst I am not proficient in LUA programming I do have extensive experience of programming in other languages such as C, Ada, VB, .NET as well as competencies in XML and so I'm sure I could offer some value.

I'd also be more than happy to do the graphics; game table with seating?, card decks, shufflers as well as all the required frames etc.

I'm not fussed about commercial aspects and would be happy to contribute my time towards a free community owned solution, equally though if someone wants to produce a paid-for solution, I'd be happy to contribute in return for a free copy for me and my group.

Let me know.

tdewitt274
December 13th, 2009, 13:23
I'd also be interested, but have limited Lua programming experience. I'm currently working my way through my first Ruleset, haven't made it past the first page of my character sheet.

I have VBScript, Javascript, HTML, PHP, ASP, and CSS experience. Although I do have knowledge of XML, SVG, and C#. I've also been trudging my way through different tutorials for FG and sort of understand the basics behind Lua (just need practice). Graphics, umm, yeah, Microsoft Paint rules! But I do have Gimp.

I have a few more ideas for this as well.

I think an "Open Deck" would be the best. Then anyone can use the system. I have a website with forums, wiki, blog (nothing set up, but a couple of options), and plenty of available room.

tdewitt274
December 13th, 2009, 15:14
This is all off the top of my head, so no real binding suggestions.

The "Deck" could be set up like a character sheet from the 4E_JPG ruleset is set up. This would allow for ease of entry.

The "main" page can show the Deck Name, Description, Shuffle Method, and other information that pertains to the deck itself. This can also include a "Deck Front" and "Deck Back" image. The "Deck Front" image would be a template for making your own card.

A "cards" page will allow for adding new cards to the deck. Fields would include "Number", "Suit", "Description", "Order", "Optional" (check box), and "Card Image". A right click menu with "Add Card", "Delete Card", "Delete All Cards" would be needed.

Based on more research into shuffling (https://en.wikipedia.org/wiki/Shuffling), my previous scripts may not be sufficient.

Some additional information on Card Games (https://en.wikipedia.org/wiki/Card_game)

Brenn
December 13th, 2009, 15:27
I'd also be interested, but have limited Lua programming experience. I'm currently working my way through my first Ruleset, haven't made it past the first page of my character sheet.

I have VBScript, Javascript, HTML, PHP, ASP, and CSS experience. Although I do have knowledge of XML, SVG, and C#. I've also been trudging my way through different tutorials for FG and sort of understand the basics behind Lua (just need practice). Graphics, umm, yeah, Microsoft Paint rules! But I do have Gimp.


This is off the subject of the thread, but I think you're going to come to like the lua implementation in FG. It's not full featured lua, but it has enough power to do most anything you would want to do in the scope of creating a ruleset in FG. I think it was an excellent choice by the devs. I was even able to write a recursive parser (https://www.fantasygrounds.com/forums/showthread.php?t=9294) in it to send tables through the chat channel to clients. In retrospect I could have done the same using the database to deliver the data, but at that point in time I didn't understand it that well. The problems I tend to run into is wanting to change or access things that are hard coded in the program.

Sounds like you're just like me when it comes to graphics...

Anyway carry on with this card thing, I'll be interested to see the results.

tdewitt274
December 13th, 2009, 16:35
Inkscape makes me look like a god ; )

tdewitt274
December 27th, 2009, 21:39
Just some messing around.

I created an SVG document (zipped) in Inkscape (sorry, haven't cleaned it up) that can represent the cards. If you use Inkscape, go to Edit > XML Editor and look at "Layer1". If using another XML editor, "Layer1" is where everything is at.

All four suits are represented in the document, you just need to make them visible as needed.

To show the suit

Modify the style of "heart", "club", "spade", or "diamond" to "display:none" (remove the image), or removing it (to make it visible)
Modify the "xlink:href" property of "smallSuit1" to the appropriate image name.

Modifying the Text

Expanding all the tree for "cardText1" (Inkscape) will show the text of the card in both corners.
Make the style of "cardText1" to "fill:#000000" for Black, "fill:#ff0000" for Red


Here's some thoughts on the card itself as it would be represented in FGII. I think they would work best as "tokens" to allow for the rotation.


<card>
<deckorder>14</deckorder>
<suitorder>1</suitorder>
<suit>heart</suit>
<textvalue>A</textvalue>
<fulltextvalue>Ace</fulltextvalue>
<faceimg>/images/cards/aceheart.png</faceimg>
<backimg>/images/cards/cardback.png</backimg>
<rotation>180</rotation>
<orientation>down</orientation>
<description>
<normal>Ace of Hearts</normal>
<inverted>Ace of Hearts</inverted>
<down></down>
</description>
<coordinate>0,0,0,0</coordinate>
</card>

Shows an Ace of Hearts (14th card in the deck, first in the suit) with a face value of "A" that is rotated 180 degrees (inverted) face down (card backing would show) in the upper left hand corner, no description because it is face down. In Tarot, the descriptions would be different (ex Hanged Man normal and inverted).

cpbs
March 24th, 2010, 02:11
Was wondering if this idea was still under construction. I was looking for a functional ability to randomize a certain set of items in "box" inside FG. So when I click the box, if it has dungeon tiles in it, one would be randomly drawn.

tdewitt274
March 28th, 2010, 00:35
Nothing has been developed on my side, mostly due to lack of knowledge.

If there is someone that has the knowledge that would like to help develop, I can provide as much as I can.

VenomousFiligree
June 22nd, 2010, 14:29
Would still like to see card decks myself, the card deck pulled out from Savage Worlds would be fine.

tdewitt274
June 30th, 2010, 00:24
Would still like to see card decks myself, the card deck pulled out from Savage Worlds would be fine.

I think that the cards in question would fit under copyrighted.

I haven't had a chance to tinker any further. I'd like to help develop, but just don't have the knowledge.

VenomousFiligree
June 30th, 2010, 00:27
I think that the cards in question would fit under copyrighted.

I agree and would be happy to pay for it! :)

Zeus
June 30th, 2010, 01:53
Here's a screenshot of a D&D 4E Three-Dragon Ante prototype that I built late last year. I opted to use tokens to represent cards in player hands and for tracking purposes you can see in the screenshot I am using a modified version of the 4E combat tracker to manage the gambit and round play.

Each player (including the DM) can open an expanded image version of their respective cards (also in screenshot) by using the button controls in the respective player hand windows.

I should point out that the extension is far from complete and there is a fair bit of functionality missing but deck management (shuffling, splitting and dealing), drawing/discarding/playing a card, gambit and round initiative are all in. I only paused development due to some constraints with FGII but the recent 2.7.0 test release has extended the API somewhat so I plan to go back to see what I can complete just as soon as I have completed a few other 4E related projects.

https://farm5.static.flickr.com/4102/4746994601_622e476ea4_m.jpg (https://farm5.static.flickr.com/4102/4746994601_94f3cd7dd7_o.png)

VenomousFiligree
June 30th, 2010, 07:51
Good work! :)

VenomousFiligree
July 2nd, 2010, 23:31
Vote for cards, click here! (https://featurelist.org/features/details/930)

Edit:
For those that don't want to register (even though an email address isn't required), if you have a goggle wave account there is a (unofficial) Feature Request Wave here (https://wave.google.com/wave/waveref/googlewave.com/w+Nx7zhE1rA/~/conv+root/b+F5w1oV_xC).

tdewitt274
July 3rd, 2010, 01:40
I don't think it's a matter of a vote for Cards, as I've seen that there is interest. The issue is lack of programming. Much of the framework is laid out in the previous posts (db structure, features, and some JS code).

I would be more than interested in working as a Project Manager, but I would want to learn to code out of the process. I have experience with VBS and JavaScript, but Lua escapes me.

Anyone interested?

VenomousFiligree
July 3rd, 2010, 08:37
I don't think it's a matter of a vote for Cards, as I've seen that there is interest. The issue is lack of programming. Much of the framework is laid out in the previous posts (db structure, features, and some JS code).

I would be more than interested in working as a Project Manager, but I would want to learn to code out of the process. I have experience with VBS and JavaScript, but Lua escapes me.

Anyone interested?
Just highlighting the fact that I'm trying to organise a Feature Request Tracker (https://www.fantasygrounds.com/forums/showthread.php?t=12711), so the Devs know what the community want, mind you they don't have to take notice! :D

Jharii
July 8th, 2010, 02:02
The ability to make decks of cards to draw randomly from would make it so you could play many board games via FGII.

You would need to make public draw decks (everyone can see), private draw decks (only the drawer can see), and the ability to make private cards public and vice versa.

Dunno if this was touched on in this thread or not, but I thought I would add it.

Could see definite fun playing games like Middle Earth Quest, Talisman, and Descent being played ad nauseum.

tdewitt274
July 8th, 2010, 02:16
You would need to make public draw decks (everyone can see), private draw decks (only the drawer can see), and the ability to make private cards public and vice versa.

Dunno if this was touched on in this thread or not, but I thought I would add it.

Not sure if I mentioned it myself, I was thinking the same thing earlier today. If the cards only appear to the person holding them (except discard, laid hands, etc), then even the "DM" would be able to play.

Phystus
July 9th, 2010, 03:06
Yes, letting the DM play is important. Though whomever is hosting could always login to another session as localhost as a workaround for that.

Preventing the DM from peeking would also be important.

~P

Bidmaron
December 31st, 2010, 13:15
If we were ever going to actually do this (looks like we'd need a leader to step up, and that isn't me right now), I'd participate. I have rudimentary experience in programming extensions and modules. This effort would stall quickly, however, unless we can convince Moon_Wizard to add the ability to set the image programmatically (without that, you couldn't manage the variable open table layouts you'd need with many games like the gin/rummy family, Magic the Gathering, tarot displays, etc).

phantomwhale
December 31st, 2010, 14:40
If we were ever going to actually do this (looks like we'd need a leader to step up, and that isn't me right now), I'd participate. I have rudimentary experience in programming extensions and modules. This effort would stall quickly, however, unless we can convince Moon_Wizard to add the ability to set the image programmatically (without that, you couldn't manage the variable open table layouts you'd need with many games like the gin/rummy family, Magic the Gathering, tarot displays, etc).

My, your busy on the forums these days - mind you, so am I :)

My 2 cents - I'm adjusting the card functionality within Savage Worlds to better allow what is required for Deadlands. Two points here - firstly, I might be able to offer a better card library "template" to get this effort started afterwards (might being the operative word) and secondly the Savage library is adequate, but far from 100% so a new effort from scratch wouldn't be reinventing too much of the wheel.

As for image copyright - no ideas.

Bidmaron
December 31st, 2010, 15:08
I wasn't talking about copyright if you thought I was. I don't see how the card image copyright is any different from the copyright issues you face with a module. Not that it isn't important.....

phantomwhale
January 1st, 2011, 01:27
I wasn't talking about copyright if you thought I was. I don't see how the card image copyright is any different from the copyright issues you face with a module. Not that it isn't important.....

LNPATWGC (late night post after three whiskeys, got confused - trust me, this acronym is going to take off !)

Anyhow, in the sober light of day, I'll still be revisiting cards soon, and see if there is an opportunity to offer a "core" library as public domain, as well as get the card work done that I need for Deadlands; I notice Foen did this with Dropdown lists, which he coded for the BRP ruleset, for instance.

tdewitt274
January 3rd, 2011, 00:57
I started messing around with this. So far I have everything from initiating from a "command line". Here's a list:



Commands:

/ante [#]: Kicks an ante. First person is required to include a number.
/bet #: Sets the current bet.
/raise #: Takes the current bet and raises by the number given.
/call or /see: Calls the current bet.
/deck: Populates the default deck.
/shuffle: Shuffles the current deck.
/show: Displays the current deck.
/stakes: [Under Construction] Shows the current stakes.
/game: Loads the game chosen from a list. Currently only Poker and a default.
/help: Listing of the above commands.

Future Commands:

/buyin: Buys in the player with the minimum stakes.
/deal: Deals to all bought in and ante'd players up to the max for the game.
/discard: Comma delimited list of cards to throw back.
/fold or /pass: Removes the player from play.
/check: Delay a betting decision while remaining in the hand (only if no bets have been made).

Nylanfs
January 3rd, 2011, 02:46
It would be awesome to be able to run something like Fluxx (https://www.wunderland.com/LooneyLabs/Fluxx/) in FG :) The rules automation would really speed things along.

Bidmaron
January 3rd, 2011, 04:31
Great start. The graphics will be the hard part, I think.

tdewitt274
January 3rd, 2011, 04:46
Nylanfs: I've never played Fluxx, so I don't know how the deck is constructed. Technically, the whole shuffling and drawing should work so long as it works like a regular deck. It gets difficult when you have to assign suits and such.

Bidmaron: Yeah, I'm dreading that part. I think I remember someone saying that you could drop tokens onto an image. Not sure if this was an extention or if it's part of the 4e ruleset. If I have something to work with, I can probably figure it out. I'm still a noob on the lua part. I have no idea how to attach things to the XML. Great learning experience!.

phantomwhale
January 3rd, 2011, 05:43
Savage Worlds implements all the cards as tokens, and the card dealing mechanic by simply dropping immovable card "tokens" onto a card table "image".

Then the player start drawing stupid things in the drawing layer and get shouted at... well, that's how it happens for me anyway.

tdewitt274
January 3rd, 2011, 15:22
Phantom: I kind of figured that SW was off limits because it was a published ruleset. I'd like to try and see if the Cards would be able to develop its own way of doing the process so that it can be independant.

Just a quick note, I'm struggling with a little piece of the code but still making some good progress. However, shortly, I'll be starting my New Year resolution and will be limited on time during the week. As I get closer to an 0.1 version, I'll post what I have.

In the mean time, I'd be interested in seeing what people would like to use this for. Previously, I've seen board games, some RPGs (Aces & Eights), rune decks, tarot, Fluxx, etc. If you can give a name of the game and a brief description of how the process works, then I'll see if I can keep this in mind.

Example 1: Monopoly. Two decks, one "Community Chest" and one "Chance". Players pull off the top of the individual decks when landing on the appropriate zone. After all cards are exhausted, any cards not held by the player are reshuffled.

Example 2: War. A deck is shuffled and split into two even packs. Each player plays a card and the cards are evaluated. If they are different, the person with the highest card (Ace high) wins the trick. (I can't remember what to do with a tie.) Whoever wins the trick takes both cards and puts it in their discard pile. When the player runs out of cards in his pack, the discard is shuffled and added to the pack.

VenomousFiligree
January 3rd, 2011, 16:00
Duty and Honour & Beat To Quarters:
Tests and conflict resolution, each Player and the GM has a standard deck of cards – This is nice and simple first the player and GM will build a pool of cards (for example lets say private Murphy of the 62nd regiment of foot has found himself guarding the daughter of the portugeese ambassador and wishes to speak with her, the player will use his skills, traits and reputations to build his pool, so lets say young Murphy has the following he can use He has 2 cards in charm (this is called a measure and is one of 4 main catagories Guts. Disicipline, Influance and Charm) he also has a score of 3 cards in courtesy and has one card in reputation ‘The Lady Roshine’ (the ambassadoes daughter), this gives private Murphy a pool of 6 cards for this test. The GM will create a pool for Lady Roshine maybe she doesnt want the smelly guard to talk to her. Once both sides have created thier pools and the stakes of the conflict have been set the GM will turn the top card of his deck over for all to see, this is the card all tests will be resolved against and is called the card of fate, pool cards are then tested against the CoF. If any of your cards is the same suit as the CoF thats a ‘success’, if any cards are the same number as the CoF thats a ‘critical success’, if a card is the same card as the CoF thats a ‘perfect success’ remaining cards are all deemed failures except the joker which can be any card you wish it to be. Once all cards are tested start with ‘perfect successes’ then move to ‘critical successes’ then to ‘successes’ so if private Murphy has a ‘critical success and the GM has only got a ‘sucess’ private Murphy’s player narrates the outcome within the stakes set out at the start, simple yet effective it works really well and its fast.

Bidmaron
January 3rd, 2011, 20:30
I have requested the ability to set images Using file nAmes rather than resourcesfrom code (which doesn't strike me as such a hard thing to implement), but it isn't high on fg2's priority list. Until we get that, the token technique is all there is.

drahkar
January 3rd, 2011, 20:38
Why not define them cards in framedef/template and then use createControl?

Bidmaron
January 3rd, 2011, 20:51
Well, I thought that currently the only thing you could template was a control. At least that's what the docs online say. It'd sure be nice to be able to template a window class. The problem with fg2 right now (or at least one of the problems) is that you have to specify all images as resources or you have to setup a window as the gamemaster using the image list. I don't know of a way to programmatically setup an image specifying an image file. If you are content using a framedef with a statically-sized image (no tiling), I guess you could get it to work if you setup the resources in an extension file for the card deck concerned. Guess that could work, just a little goofy to setup. Do you know anywhere that's being done now to model the effort from?

phantomwhale
January 3rd, 2011, 22:32
Phantom: I kind of figured that SW was off limits because it was a published ruleset. I'd like to try and see if the Cards would be able to develop its own way of doing the process so that it can be independant.


The actual code probably is off limits. The approach taken isn't.

tdewitt274
January 6th, 2011, 14:40
Quick status update. I did get some more done on the commands. I need to work on the /stakes, /draw, /discard, /fold, and /game code some more, but it works for what I'm using them for. I then it will be /pass, /check, and /change (related to /stakes) and the framework should be done.


Commands:

/ante [#]: Kicks an ante. First person is required to include a number.
/bet #: Sets the current bet.
/buyin #: Buys in the player with the amount given.
/call or /see: Calls the current bet.
/deal: [Under construction] Deals to all bought in and ante'd players up to the max for the game.
/deck: Populates the default deck.
/game [name]: Loads the game chosen from a list. Currently only 'Poker' and a default (leave the name blank).
/help: List of all commands.
/raise #: Takes the current bet and raises by the number given.
/show: Displays the current deck.
/stakes: [Under Construction] Shows the current stakes.
/shuffle: Shuffles the current deck.
/seehand: [Under construction] Reveals Player1's hand.

Future Commands:

/discard: [Under construction] Comma delimited list of cards to throw back.
/fold or /pass: [Under construction] Removes the player from play.
/check: Delay a betting decision while remaining in the hand (only if no bets have been made).
/change: Changes a value of the Stakes.

Bidmaron
January 8th, 2011, 08:17
tdewitt,
You've done some great work here, but I guess I thought the goal was to do it through a gui, not a slash command interface. Of course, your code can underlie the gui....

tdewitt274
January 8th, 2011, 14:04
Of course, your code can underlie the gui....
That's kind of the plan. If you can do it from the command line, you should be able to overlay a GUI to the process. All of the results are currently returned to tables so the GUI shouldn't be far off.

Some of the inital rumblings on the thread focused on a multi-use platform (tarot, runes, unconventional games, board games, etc). I think including the slash commands makes it more flexible for games that don't use the whole deck (ex, Savage Worlds, possibly Deadlands, etc).

I'm pretty close to releasing something. I'm having a little trouble with a debug function on the client side. I also want to give a little more thought to the way the packs are handled when creating the deck, it's pretty one sided at this time. I don't include the Jokers and want to see if it can be handled elegantly. And, I'll have to get rid of the code that shows cards/hands to everyone.

tdewitt274
January 9th, 2011, 02:23
Well, it seems that my approach was slightly off. I've been using variables to store the information while setting up the scripts. Note, variables don't carry over to the players when another is connected. So, I'll need to learn how to set up a database.

Oh well, there is a silver lining. I have right click menus! Forgive the mess...

Using the functions for the slash commands, I'm able to associate these with the righ click menus. The picture you see is actually a second level menu. I have an image for a "Dealer" that can choose a game, shuffle, etc.

cthulhugeek
February 1st, 2011, 05:35
Would be sweet to be able to play games like castle falkenstien using FG. I am a programmer, is there an SDK for FG II for those who want to add features? How would I start?