playMaker

Author Topic: Best approach to a card game with playmaker?  (Read 5351 times)

norman

  • Playmaker Newbie
  • *
  • Posts: 5
Best approach to a card game with playmaker?
« on: July 21, 2015, 08:01:03 AM »
Card game is a bit generic, I'm talking about something similar to Hearthstone and Magic: The Gathering where there are many cards that each possess unique functions and interact with other cards in special ways.

I haven't seen a whole lot of discussion on this topic so I'm asking you guys what the best approach to this would be with regards to programming for the cards. Would you create a separate prefab for every single card and build individual FSMs for them? I'm not looking for a shortcut, just want to make sure I'm not overlooking anything.

Thanks!

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Best approach to a card game with playmaker?
« Reply #1 on: July 21, 2015, 09:31:33 AM »
I'd look into GoogleFu and ArrayMaker.

norman

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Best approach to a card game with playmaker?
« Reply #2 on: July 21, 2015, 09:39:06 AM »
Terri,

Thanks for the reply. A card database will be great for things like card text, images, and generic values. And arrays will be useful for the player's hand and other game zones. My question is more about the large variety of unique card elements. Here's an example:

Card #1
Ability: When this card is played, deal 3 damage to target card or player. If you have Card #3 in play, deal 4 damage instead.

Card #2
Ability: When this card is played, draw a card for each other Card #2 you've played this turn

Card #150...

As you can see, this quickly gets out of hand so simply placing all of the abilities in a database and updating a single card object doesn't quite feel doable. I could be wrong here, though.

Has anyone tried to tackle this with playmaker?


EDIT: Upon further inspection of GoogleFu (this is G2U now, right?) it looks like this is actually a good starting point. I'll keep my original post in tact to show how quick I was to jump to conclusions (aka being an idiot). Thanks again :)

EDIT2: Would this be better than G2U? https://www.assetstore.unity3d.com/en/#!/content/4334

From the G2U description:
The Editor Extension works as a pre-build step, so your application never has to contact Google itself

Not being able to update the data seems like a big drawback that SQLiteKit addresses.

Even still, I'm not quite sure how to go about making these cards all interact with each other without a unique FSM for each card.
« Last Edit: July 21, 2015, 09:48:04 AM by norman »

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Best approach to a card game with playmaker?
« Reply #3 on: July 21, 2015, 10:00:58 AM »
Yeah G2U is what I meant. Not sure what you mean by update the data, you need it to update at runtime?
One drawback for G2U from what I've tried is that the generated Playmaker actions can't handle arrays.

I can see what you mean about how to handle the different mechanics though, not sure what the best approach would be.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Best approach to a card game with playmaker?
« Reply #4 on: July 21, 2015, 10:03:50 AM »
The task of using 3rd party tools for a unique and specific task in your game is indeed challenging. For instance you can use the G2U database to contain all of your card information, then you can use Playmaker to interact and perform logic based on that data but that is where you have to start designing good systems that will scale well and be easy to maintain.

After you know the two can probably do what you want you have to start thinking about how. For instance your card information is in the database and you have a card which is going to react to what was played on the same turn. Well, first you have to know what cards were played that turn so you need to keep an array of references to the database when a card gets played and clean it every turn. You also need a list of cards that are on the board currently, which is another reference array.

After you get those arrays in place its just a matter of asking those arrays for the references to the database and comparing it to your card's conditions, like having it check the PlayedThisTurn array and multiply something based on the count of them in that array.

There are some videos of Blizzard guys talking about how they approached the systems at gamedev/blizzcon conferences, you should check them out.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

norman

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Best approach to a card game with playmaker?
« Reply #5 on: July 21, 2015, 10:09:57 AM »
Thank you Lane,

That's really helpful. I'll go dig up some of those videos and then put some more thought into the database structure. Even with a separate "abilities" table I imagine it's going to get out of hand quickly with hundreds of unique abilities but if it were easy it wouldn't be fun!