PDA

View Full Version : Custom Playing Cards



Mgrancey
October 20th, 2013, 07:05
Right, started on part of creating an extension, but unsure what to do as code. Extension is for Savage Worlds, creating custom playing cards for different settings. As far as images go, I started with Deadlands Reloaded all that is left is to export images and name them, but will eventually make one for each.

I am guessing that all would initially need done is to create a bit of code that redirects which folder it draws the card images from. After that I am unsure on whether it would be better to simply make each set a different extension or to add to the preferences (or somewhere else) a selector of which card set you would prefer.

I have some experience programming, but am rather unfamiliar with LUA and FG structure.

MODERATOR: Moved to new thread.

Trenloe
October 20th, 2013, 10:52
Are you looking to change the normal playing card deck images?

If so, which images are used are specified in the \graphics\graphics_cards.xml file in the base SavageWorlds ruleset.

For example:

<root>
<icon name="AceClubs" file="tokens/cards/Ace of Clubs.png" />
<icon name="AceDiamonds" file="tokens/cards/Ace of Diamonds.png" />
<icon name="AceHearts" file="tokens/cards/Ace of Hearts.png" />
<icon name="AceSpades" file="tokens/cards/Ace of Spades.png" />
<icon name="BlackJoker" file="tokens/cards/Black Joker.png" />
<icon name="CardBack" file="tokens/cards/ct_card_place.png" />
...

Your extension could simply contain a modified \graphics\graphics_cards.xml file that points to different image files (tokens) to use for each card in the deck. Then include a new directory in the \tokens directory within the extension that contains the modified token files.

Here is the current location of the standard playing card tokens in the Savage Worlds ruleset:

https://dl.dropboxusercontent.com/u/39085830/Screenshots/SW%20Card%20Tokens.JPG

So, your extension would really just need a directory holding all of your new card tokens and the modified \graphics\graphics_cards.xml file that is modified to point to the relevant new tokens.

This is the most straightforward way of doing theme changes and would require that each different card "theme" would be in a separate extension, only one of which would need to be activated before loading the campaign.

Mgrancey
October 20th, 2013, 13:16
I had found the folder holding the cards and their images, but was unsure about if there was anything extra that was needed for the code inside the extension. So I just need to make a copy of the original "graphics\graphics_cards.xml" file and edit it the links so they simply point towards the new images?

If so this will be fairly easy, real easy if Notepad++ would quit being so fussy.

Would it possible for you to edit this thread and add a poll for other settings that people would like see done first after Deadlands Reloaded?

Trenloe
October 20th, 2013, 13:48
Would it possible for you to edit this thread and add a poll for other settings that people would like see done first after Deadlands Reloaded?
It's probably best for you to start a new thread with a poll - I'm not sure all of the options you want in the poll so it would be better for you to create a poll with the options you want, plus this is a bit of a technical thread about how to use custom cards so best to keep a poll and discussion about that separate.

Mgrancey
October 20th, 2013, 15:56
Then include a new directory in the \tokens directory within the extension that contains the modified token files.

Is there a particular way this should be done? I was just going to do a module with the tokens added then extension points at them, but it doesn't seem to be finding them.

Debinani
October 20th, 2013, 17:18
Does your extension.xml file have a pointer to your overridden graphics_cards.xml file?

Trenloe
October 20th, 2013, 20:03
Is there a particular way this should be done? I was just going to do a module with the tokens added then extension points at them, but it doesn't seem to be finding them.
Anything contained in a module has to be referenced as <item name in module>@<module name>

For this extension I really wouldn't recommend using card tokens from a separate module. This would mean that the extension won't work at all without the module being installed as well. If you plan on distributing the extension then this will avoid a lot of "my extension doesn't work" posts be users who haven't installed the 2 required files to 2 different directories.

Also, as Debinani says, files in an extension that are being used need to be activated in the extension.xml <base> section.

I've written a quick example extension for you that replaces the Ace of Clubs card with a Test Card image - all contained within the same extension. See the attached file:

5319

Andraax
October 20th, 2013, 22:24
You can actually just put the contents of the graphics_cards.xml file right into the extension.xml file.

Trenloe
October 20th, 2013, 22:38
You can actually just put the contents of the graphics_cards.xml file right into the extension.xml file.
You could, but then that doesn't really help people who may look at your extension to understand what it is overriding from the standard ruleset. Also, if the extension is broken by a future FG ruleset upgrade (or someone else's extension) then having the changes/files used matching the normal ruleset will help people see where changes were made and so know where to look for fixes. Just having a long list of specific XML changes/additions/overrides in the extension.xml file will work, but won't help others coming after in understanding how it all hangs together and making it easy to keep the extension up-to-date and enjoyable by the community long after the original owner has moved on.

Mgrancey
October 20th, 2013, 23:18
so I can put the new card images just in a tokens/<folder> as part of the extension. That was what I wasn't sure about. Thanks. I already had the graphicx_card.xml working since the old cards weren't showing up.

Thanks for the LUA code to announce its use as well.

Trenloe
October 20th, 2013, 23:39
so I can put the new card images just in a tokens/<folder> as part of the extension.
Yep, makes it all nice and self contained. :)


Thanks for the LUA code to announce its use as well.
No worries - I find this very handy to know if the extension is actually loading and for GMs to confirm what version they are running. You can also add a nice little logo to this announcement by adding the logo="<FG graphic resource reference>" to the msg local variable. The message data structure is detailed here: https://www.fantasygrounds.com/refdoc/Comm.xcp

For example, the following will add an icon to the message with the resource name "swex_logo" which is defined in graphics\graphics.xml:


local msg = {sender = "", font = "emotefont", icon="swex_logo"};

phantomwhale
October 21st, 2013, 01:10
Cool idea - I tried to improve the cards a while back for Deadlands, but my graphics skills are quite limited, esp. given the small pixel size of the card graphics.

Look forward to seeing this :)

Doswelk
October 21st, 2013, 14:59
There was one SW ruleset that changed the card size wasn't there?

Was it Shaintar?

Might be worth a look at to give you more pixels...

Mgrancey
October 21st, 2013, 17:21
I only have the Deadlands Ruleset, so I can't say what else it might be.