Jump to content

  • Log In with Google      Sign In   
  • Create Account

trading card game skill system


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
17 replies to this topic

#1 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 07 July 2012 - 07:45 PM

Hi,

So I'm starting to create a simple 'trading card game'.

I have no issues with the simple 'attack damage' reducing players health, but how should I implement a skill system?
For example a card cost 2 mana. That card has a skill which says if you play 1 more mana you can draw a card.

How to implement this? Also how to store these skills for later use?

I mean I'm still wondering how I should save my cards. XML isn't really secure but can be easy to test out stuff.
So whats your opinion on this?

Kind regards

Sponsor:

#2 Canvas   Members   -  Reputation: 240

Like
0Likes
Like

Posted 08 July 2012 - 06:02 AM

I dont fully understand the you play 1 more mana, do you mean if you play the card which is 2 mana and play another mana which is a total of 3 you can draw another card?
Well to be honest each player could have a int called mana, this variable can be public or private its your choice, and every turn mana is += to the increaseMana. to check for the mana you would do a simple if statement, in this if statement the "cards" for the game will be stored inside a vector (kinda like a arraylist)

[source lang="cpp"]if(mana smaller Or equals To cards.at(52).returnManaCost){ return true;}else{ return false;}[/source]

if it returns true, you can then create a method that will do the card power, if its false do nothing, if you need anymore help just post again

Edited by Canvas, 08 July 2012 - 06:03 AM.


#3 Moonkis   Members   -  Reputation: 273

Like
0Likes
Like

Posted 08 July 2012 - 06:15 AM

I'm quite sure he meant that each card has a specific "Effect" and in this cards case, lets call it "X" costs two mana too play normally but it inherent this effect that if you pay the normal mana-cost AND the extra mana of one ( Which is a total of 3 Mana ) you may play it AND in addition draw a card. Much like Magic the Gathering, Yugioh, Pokemon ect

Those kind of systems are quite complex, most of them use some kind of scripting system for the card-effects making it flexible and simple, and not requiring to hardcode every card.

#4 samoth   Crossbones+   -  Reputation: 4791

Like
0Likes
Like

Posted 08 July 2012 - 06:22 AM

Kind of off-topic, but be aware that the gameplay of "trading card game play with goal of reducing the life points of other players to a level below one" specifically with "spells [...] that utilize the energy to enable a player to attack" is patented by Wizards of the Coast. It's probably not exactly the kind of thing one would like to implement before 2017.

#5 AlysiumX   Members   -  Reputation: 152

Like
0Likes
Like

Posted 08 July 2012 - 06:45 AM

Kind of off-topic, but be aware that the gameplay of "trading card game play with goal of reducing the life points of other players to a level below one" specifically with "spells [...] that utilize the energy to enable a player to attack" is patented by Wizards of the Coast. It's probably not exactly the kind of thing one would like to implement before 2017.


God I hate patents, that is such a stupid concept.

I do wonder though what you would have the change to have a similar effect in a game. I mean the wording you have is

"trading card game play with goal of reducing the life points of other players to a level below one"

I mean where is the line drawn? If I create a card game where players aren't "trading" cards, or player have an object is heath point which I am trying to reduce below 1 point?

What if I just don't call it a trading card game or life points, or my life points do not have levels.

#6 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 08 July 2012 - 07:11 AM

@Canvas:
It's as Moonkis suggests, each card will have a list of effects (usually 1 to 2 different effects) which on their turn have a cost.
So you pay mana for your card, when that card is into play, you can play it's effects optionally.

@Moonkis:
Well that all depends how a card is saved. If its xml I thought of doing something like this:
<?xml version="1.0" encoding="UTF-8"?>
<creatures>
<creature name="Skeleton">
  <description>This is a skeleton</description>
  <damage>3</damage>
  <health>2</health>
  <cost>2</cost>
  <type>ground</type>
  <effects>
   <effect name="Lightning">
    <target>opponent</target>
    <skipturn>false</skipturn>
    <damage>2</damage>
    <cost>2</cost>
   <effect>
  </effects>
</creature>
<creature name="Slime">
  <description>This is a slime</description>
  <damage>1</damage>
  <health>1</health>
  <cost>1</cost>
  <type>ground</type>
</creature>
<creature name="Pinguin">
  <description>This is a pinguin</description>
  <damage>0</damage>
  <health>3</health>
  <cost>1</cost>
  <type>flying</type>
  <effects>
   <effect name="Heal">
    <target>self</target>
    <skipturn>false</skipturn>
    <damage>-2</damage>
    <cost>1</cost>
   <effect>
   <effect name="Push">
    <target>target</target>
    <skipturn>true</skipturn>
    <damage>0</damage>
    <cost>1</cost>
   <effect>
  </effects>
</creature>
</creatures>

But there are 2 issues I know of:
  • All possible effects (what target you can choose, how much damage, how fast, how much cost, ....) should be implemented in each single creature, whether the effect is doesn't do damage, doesnt target anyone, you always need to implement everything.
  • This isn't safe, everyone can alter an xml file.

@samoth & AlysiumX:
Well I'm not sure about if the combination of the elements you stated is patented. I thought they may only patent the assests and name.
Offcourse if the gameplay is identical thats a different story, But let's say I combine this with the importance of how you position your cards in front of the opponents and with a use of a hero card. I suppose it wont be justified then. And even so, It's not like this game will ever be popular :D

#7 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 10 July 2012 - 03:17 AM

Hoping for an opinion on my reply to Moonkis answer.

regards

#8 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 13 July 2012 - 07:20 PM

Hoping on an answer :)

Regards,
Goowik

#9 Dragonsoulj   Crossbones+   -  Reputation: 2113

Like
0Likes
Like

Posted 13 July 2012 - 08:37 PM

If I understood what you needed right, then what samoth suggested:

Kind of off-topic, but be aware that the gameplay of "trading card game play with goal of reducing the life points of other players to a level below one" specifically with "spells [...] that utilize the energy to enable a player to attack" is patented by Wizards of the Coast. It's probably not exactly the kind of thing one would like to implement before 2017.

would be partially what you are looking for. You will have to keep a "pool" of usable energy in some variable, and reduce it whenever they decide to use the effect (or keep it but do a check for cards that benefit from adding to this pool when the energy is added to it).

#10 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 14 July 2012 - 12:16 PM

Yes indeed. I don't have any issues programming that part (the "pool").

But as stated i'm not sure how to retrieve these skills and cards. As of now, I have an xml file and a parser.
Unfortunatly this isn't safe in my opinion. So any advice on that matter would be welcome :)

#11 Dragonsoulj   Crossbones+   -  Reputation: 2113

Like
0Likes
Like

Posted 14 July 2012 - 02:25 PM

You should probably iterate through cards in play to see if any of them have this ability when more energy is added to the pool. That is if these are passive abilities. If these are activated ones where you pay with the pool, then that is more of an event and would be based on the player choosing to activate it.

#12 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 16 July 2012 - 05:50 AM

I'm sure if you got my question :)

I don't have problems with using the skills now, but I need help saving them.
As stated I have a partial solution using xml... But I'm not sure about it's safety (where members might be able to modify em).

Regards

#13 Dragonsoulj   Crossbones+   -  Reputation: 2113

Like
1Likes
Like

Posted 16 July 2012 - 07:06 AM

Let the server hold the dominate data. Should they play an ability, regardless of how you have it saved (XML could work), check on the server to see if they had that card in play and could play it. Then allow the move to be made.

#14 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 17 July 2012 - 12:39 AM

k thx, so I checked around a bit on how files are manipulated on a server.
But I seem to only find chat servers in java.

Are there specific terms I should be looking for?

#15 Dragonsoulj   Crossbones+   -  Reputation: 2113

Like
1Likes
Like

Posted 17 July 2012 - 01:31 AM

The thing is server side code isn't really affected by the client. The client sends requests for data (and can get/post data) to the server, but the server's code remains it's own. You program it to decide what to use and what not to use. Look up server scripting. That may help.

What I am saying is the server's code is what should be in control. If someone sent data saying they have this really powerful card, but the server knows they do not have it/do not have it in play, it can be the judge and deem that action null and void.

#16 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 18 July 2012 - 01:32 AM

@Dragonsoulj: thanks, now Googeling time :)

#17 Dragonsoulj   Crossbones+   -  Reputation: 2113

Like
1Likes
Like

Posted 18 July 2012 - 02:07 AM

You are welcome. After scouring the forums for the article I was thinking would help you and turning up empty, I think I will put it like this:

If someone wished to cheat and you ran most of the game code on the client side (player side), they could modify what gets sent to the server and gain an advantage. If most of the game code is run on the server (and the deciding factors about valid moves are made there), then you maintain the control. Depending on the size of your project, it may be best to only let the client choose actions (based on data you send them, ie cards in hand, cards in play, possibly a life total, etc) and then process them on the server (check for that validity, run the functions that take care of what happens, such as card A damages card B, player draws a card, and so on). If I am not mistaken, you should be able to use Java to handle both sides of the game, since Java does have server capabilities.

This link looks promising: link to get you mildly started.

Since the server would be sending out that XML file you mentioned, it could retain that data and should the client send back data that doesn't match up with that file's contents, you could do anything from send a message calling them a cheater (hilarious but not advised) to just stating an error has occurred and the client needs to reconnect.

As for your googling terms and such, "Java Server Pages" may help. I haven't done much Java programming (only had a class of it), so I'm not fully sure of decent resources to direct you to. Since you seem okay with writing the client side of things, your server code shouldn't look much different. You won't have to have any graphics or visual output since it is sending information. I'm not sure how you will handle games (holding the data while a game is in play), but using a database and having the Java code on the server access it may be the best.

I think your data flow would look something like this:
Client Java requests game data -> Server Java requests current state from DB -> DB sends data requested -> Server Java processes what's going on and sends data -> Client Java displays current state and lets player make decisions -> Server Java processes decisions -> DB is updated -> Server Java sends new current state to Client Java.......until the game ends

#18 goowik   Members   -  Reputation: 129

Like
0Likes
Like

Posted 18 July 2012 - 06:04 AM

Amazing! Thanks for the help :)

Can't wait to start coding. I shall create another topic when everything is done (code-wise)
As graphically it might take me a loooong long time.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS