Jump to content
  • Advertisement
Sign in to follow this  

Trading Card Game Scripting?

This topic is 3412 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright so I've been developing my browser-based trading card game and so far I got the database setup, user registration/logging in, and a chat system with updating player lists etc... So now it's time to start work on the actual game mechanics, which has run me into a slight speed bump. I'm trying to think of a good design to program the individual cards. The server end is done in Java. I don't really want to hard code each individual card as that would be a hassle in the future when making changes (having to recompile). So that would mean I would have to use a scripting language, but what scripting language and how should it be 'woven' into the main game loop? The main issue here is that I've never programmed around a scripting language before, so it's hard for me to design a game incorporating one and for see any problems. My idea is to expose some kind of 'event' system to the scripts that the scripts can 'register' to that are called at appropriate times, so like: Events (parameters) Card Drawn (Player, Card) Card Played (Player, Card) Skill Used (Player, Skill) Start Turn (Player) End Turn (Player) Start Counter Phase (Player) End Counter Phase (Player) So the game just begins and Player 1 plays a card (Do 4 damage every time opponent draws a card), the script engine kicks in, loads the cards script and registers it into any events that are applicable for that card (Card Drawn). Now player 2 goes, he draws a card, the Card Drawn event is then triggered, and passed to all registered cards. Now this is where I get confused, how does the script interact with the variables in the main game? (In this example player 2's health, but I might have other things like "Destroy a random card in play") I'm not sure exactly how to manage the interaction? Also this model is very limited, how could I do something like "If your health is less than 20, this card can be played at no cost"? I guess I could do a Playing Card event and load card scripts at beginning of match instead of when they are played?, but that could kinda get ugly if the number of events keep building up like that, but who knows, might be the best solution. Anyone have any advice? Thanks in advanced.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!