Archived

This topic is now archived and is closed to further replies.

petway56

Implementing a deck of "Action" cards

Recommended Posts

I was curious as to what you guys see as the best way to implement a set of action cards. These would be cards that have normal features like title, description, etc but they can be played and an action would occur. For instance you have a card when played it would then send the user to an appropriate routine where the user would then be able to select an opponents territory to have the action occur at, obviously the specifics of the action are irrelevant. I was thinking along the lines of having a graphic for each card and a data file both with the same name. The data file would contain the name of a member function that is associated with the appropriate action. Then grab that data either when loading the game of when playing the card. Is this way off? Is there a better, safer, more efficient, blah, blah, blah, way to implement this? One problem I see is I would need to incorporate taint checking when reading data files to be safe. Otherwise the data files could be modified in a bad way. The other solution I could see would use the same two files but instead of simply using member function names I would create a scripting language. This seems to be the ideal solution but as this is my first game I don''t know if I want to spend weeks on that part (Would be good to learn though, and would let people create they''re own card sets!!!) I don''t know, what do you guys think?

Share this post


Link to post
Share on other sites
hmmm...
Well, i found that although it seems to be more efficient to hard code things, if you are dealing with small amounts of data, the best route is to go with a file containing every card type.

A good example of this is the rules.ini file in the Command & Conquer series. Then just use that to decide what the action is.

Share this post


Link to post
Share on other sites