Sign in to follow this  
goowik

trading card game skill system

Recommended Posts

goowik    129
Hi,

So I'm starting to create a simple[i] 'trading card game'[/i].

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.

[b]How to implement this? Also how to store these skills for later use?[/b]

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.
[b]So whats your opinion on this?[/b]

Kind regards

Share this post


Link to post
Share on other sites
Canvas    246
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

Share this post


Link to post
Share on other sites
PureSnowX    275
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
AlysiumX    152
[quote name='samoth' timestamp='1341750137' post='4956910']
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.
[/quote]

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.

Share this post


Link to post
Share on other sites
goowik    129
[b][i]@Canvas:[/i][/b]
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.

[b][i]@Moonkis:[/i][/b]
Well that all depends how a card is saved. If its xml I thought of doing something like this:
[CODE]
<?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>
[/CODE]

But there are 2 issues I know of:[list]
[*]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.
[/list]

[i][b]@samoth & AlysiumX:[/b][/i]
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

Share this post


Link to post
Share on other sites
Dragonsoulj    3212
If I understood what you needed right, then what samoth suggested:
[quote name='samoth' timestamp='1341750137' post='4956910']
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.
[/quote]
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).

Share this post


Link to post
Share on other sites
goowik    129
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 :)

Share this post


Link to post
Share on other sites
Dragonsoulj    3212
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.

Share this post


Link to post
Share on other sites
goowik    129
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

Share this post


Link to post
Share on other sites
goowik    129
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?

Share this post


Link to post
Share on other sites
Dragonsoulj    3212
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.

Share this post


Link to post
Share on other sites
Dragonsoulj    3212
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: [url=http://pirate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/lecture18.html]link[/url] 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

Share this post


Link to post
Share on other sites
goowik    129
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this