So I'm creating a trading card game (much like Magic: The Gathering, with different gameplay mechanics).

To test I usually create cards on the fly, but now it's time to create a database.So I first thought of simply setting up a xml file which contains all cards and an object file of players with their decks and cards.

Problem though, it's not quite secure to save it locally.So I was thinking of creating a server which keeps tracks of all cards and players.

The server would later be used to create rooms where players could battle each other.

But I'm not sure where to start.So I have a few questions on this matter:Is xml advised? Let's say I have around 250 cards. An example of xml would be:

If the game is online-only:- Player connects to the server- Server sends Player's account's cards (use anything you want, others may help you more on this)- Player plays- Player buys/wins a new card- Server updates Player's card- Server sends Player's account's cards- Player sees his new cards

The player never sends "card list info" to the server. So no hack's allowed there.

If the game is offline-only:- If the player wan't to cheat, he will cheat one way or another, make it fun care about other stuffs and get it done.

@_Al3x: Btw, if I use an online version only, should I check each second whether the user is connected to the server or not?The only thing that comes through my mind is a separated thread that checks the connection. But isn't that abundant (not sure if using the right word here)?

@_Al3x: Btw, if I use an online version only, should I check each second whether the user is connected to the server or not?The only thing that comes through my mind is a separated thread that checks the connection. But isn't that abundant (not sure if using the right word here)?

There's old and easy to grasp way of creating a new Thread for every player or you can read about java.nio (java new IO) which came in java 1.4 and learn about the idea of "Channels". Java NIO makes extensive use of low level hardware/OS specific networking thingies and to really get an intuition on how it works you'd probably want to read about it.

Im terribly sorry for this late response. I totally forgot to enable notification when a reply has been sent.

So the idle part can be fixed by a simple turn timer (of about 30 seconds). Problem however is I'm still new to netwroking and all example I seem to find are just text thats being sent.

So should I read out my xml files and send the content? One issue i can think of is that the total amount can exceed a few Mb's.I suppose this should be done using some loading 'pattern' using different threads.

Sigh, the longer I think about this project the more difficult it gets.

Sigh, the longer I think about this project the more difficult it gets.

If the rules even begin to approach the complexity of M:tG, the networking is the really easy bit.

BTW your XML snippet looks a bit denormalised. How many of an effect's parameters will vary between uses? Some effects might have variable target constraints; some might have variable costs; and some might have other parameters (e.g. damage, secondary cost, number of cards returned to hand), but you only really need to configure the variable parameters on a per-card basis.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org