topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 5:20 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: PythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12  (Read 46587 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I've now uploaded a rough version of my Open Source Python library/helper code for very rapidly prototyping card game images for playtesting, PythonProtoCards.
It includes my sample "CodyCards" game and sample use of the code to generate the cards for it.

Download from: https://www.donation...er/pythonprotocards/

Release history:
  • v1.5.1 - 9/9/12 -- improved layout of large blocks of text; fixed bug when displaying text with linebreaks
  • v1.4.1 - 4/5/11 -- added corner circle text helper function, and used it from sample CodyCards
  • v1.2.1 - 3/25/11 -- improved transparency effects, improved full page bleed layouts
  • v1.0.1 - 3/13/11 -- first release

The PythonProtoCards library provides classes and functions that are useful for rapidly prototyping *printed* card games.

The library makes it possible to programmatically create lots of cards quickly. It helps you divide up work into different steps, so that you can manually create and edit game piece data or automatically generate it programmatically, and then generate printable images for this card and piece data. The data file format is designed to be very easy for humans to edit, but also parsable by code, which can load the data, modify it, and write out newly modified files, almost like a minimalistic database. This makes it easy to programmatically modify or add to existing data files that will also be hand edited.

The focus here is on very rapid prototyping (rather than pixel-perfect laytout control) so you'll find things like functions for automatically scaling text and images to fit within specific regions, text-wrapping, etc.

By interfacing with the Python Imaging Library (PIL), the PythonProtoCards classes can quickly generate large numbers of nice looking card images, and even lay them out for printing on card template sheets.

See the samples/codycards directory for a sample card game and scripts to create cards programmatically, and sample images

Please note this is an early release intended for programmers. I would very much like to extend this work to a full-featured tool for game designers, and even extend it to support online playtesting. If you are interested in seriously funding such work, please get in touch with me.

codycards.jpg

Let me know if you find it useful!



Non-core-python requirements: PIL image library

« Last Edit: September 10, 2012, 03:59 PM by mouser »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Interesting!

I'm going to see if I can generate a couple more aces to keep up my sleeve.

Do you (does anyone) plan to create a DonationCoder card game?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Do you (does anyone) plan to create a DonationCoder card game?

Open up your eyes.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Do you (does anyone) plan to create a DonationCoder card game?

Open up your eyes.

 :-[

Actually, my eyes are open but I have to keep looking away in order to boost the thermometer.

Ampa

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 592
  • I am cute ;)
    • View Profile
    • MonkeyDash - 2 Player strategy boardgame
    • Donate to Member
Oooh - looks interesting.

I have never used Python but may have a look as this develops.

When prototyping games I have always laid out cards on a portrait page 3x3 as I then get 9 per page rather than 8. Just a thought!

I would dearly love to see a good card prototyping environment developed, and would even lend a hand if I could. I most recently looked at NanDeck, but was quickly turned off as it seemed rather clunky.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I have always laid out cards on a portrait page 3x3 as I then get 9 per page rather than 8. Just a thought!

youll see that the library is very generic about laying out the cards.. its easy to adjust.

that's really the point of this library -- it is code to make it easy to custom code your own quick custom card generation routines, without spending time on the low-level details.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #6 on: March 25, 2011, 12:04 PM »
New version uploaded.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #7 on: March 25, 2011, 12:15 PM »
This version includes as a sample the scripts and images for generating your own deck of CodyCards, as well as a complete instructions for playing the game.

I will be having some game decks printed and given away soon for fans of Cody.  :up:

For those interested in printing your own cards, I have successfully used PlainCards stock:
http://plaincards.com/Playing.html
« Last Edit: March 25, 2011, 12:26 PM by mouser »

Gothi[c]

  • DC Server Admin
  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 873
    • View Profile
    • linkerror
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #8 on: March 25, 2011, 12:23 PM »
As having played fun games made with this library, I can only recommend it! :)

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,778
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #9 on: March 28, 2011, 10:31 PM »
Just curious: Is there a reason why you don't put the source on one of the better-known online open source repositories? Github, Bitbucket.org, SourceForge, code.google.com, etc.?

Also, what license is the source for PythonProtoCards released under?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #10 on: March 28, 2011, 10:38 PM »
Is there a reason why you don't put the source on one of the better-known online open source repositories? Github, Bitbucket.org, SourceForge, code.google.com, etc.?

i'm a believer in the idea that there should be one official home for things.. and since my home is on dc, that's where this lives.

Also, what license is the source for PythonProtoCards released under?

You've caught me -- i don't know yet, i need to figure out what open source license fits best.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #11 on: March 29, 2011, 11:07 AM »
here's a cleaner image of the proofs for sending the cards to be professionally printed -- gives you a better idea of what the library can super easily generate without any effort on your part:

codycards2.pngPythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12

ps. I created a separate thread to discuss the CodyCards game itself.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #12 on: March 29, 2011, 01:35 PM »
I'm a little alarmed to see a blood-thirsty Cody ensconced with all that weaponry!
Now I know why you claimed that it is a killer game.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #13 on: March 29, 2011, 01:39 PM »
cody is a pacifist thief in this game -- all the attacks are directed at him.

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,778
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.2.01 - 3/25/11
« Reply #14 on: March 29, 2011, 02:12 PM »
cody is a pacifist thief in this game -- all the attacks are directed at him.

A pacifist thief who attacks anyone who innocently knocks on his door. :huh:

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
It was suggested that the CodyCards could use the numbers values repeated in the upper left, so i added a helper function for this into the JrPythonCards library:

Defense_5_Poison Gas.png

New version has been uploaded.
« Last Edit: May 05, 2011, 05:05 PM by mouser »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.4.01 - 4/5/11
« Reply #16 on: July 31, 2011, 11:52 AM »
Anyone tried this yet? Any feature requests?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.4.01 - 4/5/11
« Reply #17 on: September 09, 2012, 09:43 AM »
You can see my latest use of the library in my Culinary game here.

Note: As of September 9th, 2012, I have made some updates to the python code to better support large blocks of text like you see in the Assignment cards.  Download has been updated.

Example of support for larger blocks of text, with nice wrapping, autosizing, and formatting:
assigncards.jpgPythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12
« Last Edit: September 09, 2012, 11:14 AM by mouser »

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,859
    • View Profile
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12
« Reply #18 on: September 09, 2012, 02:04 PM »
That's a much more elegant way to do things than the Quark Express template I once created to do something similar back in my graphic design days. :Thmbsup:

Ever consider doing a design analysis of how you created your codebase for this, and possibly turn it into a tutorial series or book? Learning something like Python by doing a working project with it would be a nice thing to see. That's always been a problem with most coding instruction IMO. You learn a lot of great stuff. But you're often left wondering what to do with it once you have learned it. Because it's one thing to learn all the the pieces and code small parts. But it's quite another thing to then be able to pull all those pieces together into an actual project or a full blown app. Most coding instruction teaches you how to do something. But it's not too often that it shows you why or where or when to do it.

Who knows? Maybe DC could even start it's own book series. Why should O'Reilly get to have all the fun? (Or make all the nickles?)
 :)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12
« Reply #19 on: September 09, 2012, 02:30 PM »
Appreciate the idea, but Python is not my strongest language and there's nothing very special about the codebase.

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,859
    • View Profile
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12
« Reply #20 on: September 09, 2012, 03:14 PM »
Appreciate the idea, but Python is not my strongest language and there's nothing very special about the codebase.

Understood. But it doesn't need to be particularly special. Or about Python per se.  All it would need to illustrate is how a code project/app gets designed and put together.  :)

But never mind. I was just thinking out loud anyway. ;D

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12
« Reply #21 on: September 10, 2012, 04:24 PM »
A different approach but related to programmatically generating lots of card designs is Nandeck, also free.

zaq.tech

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12
« Reply #22 on: October 30, 2012, 03:54 PM »
Hi Mouser,

Congratulations from Brazil to this very nice LIB and for the work you are doing here.

I am using your Python Lib and as I am a noob python programmer I have this question for you:

How can I set the upper Text to not be in UPPERCASE? I've tried some changes, but I can't still handle it.

Thanks in advance and keep this great job up.

Zaq.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12
« Reply #23 on: October 30, 2012, 05:16 PM »
Finally the first user of the library!  :)
Welcome Zaq.

Ok so I'm assuming you are using one of my sample scripts as a starting point.  In that code look for a call to .upper() and remove that.  That's the call that is uppercaseing the string.

So for example in samples\codycards\2MakeImages.py,

change:
   title = pobj.get_propertyval("title","")
    title=title.upper()

to
   title = pobj.get_propertyval("title","")

zaq.tech

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: PythonProtoCards - Prototype Card Game Images - v1.5.01 - 9/9/12
« Reply #24 on: October 30, 2012, 05:28 PM »
Thank you mouser.

You have no idea what many things you can do with your LIB.

I got excited to learn Python just because your Library.

I have some good ideas to use  your library.

My first is to help children to learn alphabet. For example: one card I will put the letter "T" in other I will write the word "Tree" and say to children:  "T" as in "Tree", and so on...

Other nice thing to do: memory game. Print twice the card in a good paper and play with kids too.

I am studing a lot your website. Everyday I read things here I got more impressed with the great work you all are doing. I hope soon have time to share some things and projects with the members.

Thank you again mouser.

Zaq.