Hello,
First post here so I guess a little introduction is in order. I’m french so I hope it won’t be too hard of a read. I use mainly java and some odd languages for research purposes (related to my job). Over the years I started a lot of game oriented projects but could never finish one. However I always felt like I learnt a lot doing so, and that’s good because that was always the main reason behind them.
This time I’d like to go all the way and picked a theme I already experienced with a couple of times: a collectible card game. I have a background, most of the rules (with a twist I like a lot) and some genetic based algoritms for a deck building AI I already tried with great success (but I’m biased of course).
But I’m no good at picking a good design. I could make it work, and I actualy did it to a certain extend, but I’m not happy with the result. Some pointers about what I have:
- A GameObject like class (wrongly named Entity) that other classes like Card and Player inherit from.
- Modifiable values are stored via maps (enums as keys) so I have one setter to rule them all.
- Previous point was done so mostly to allow an easy use of a recorder to store the changes and replay the games.
- To add content to the game (aka more cards), I make a new class that inherits Card and override methods like play() to specify how it interacts with the game elements.
- A factory to instantiate those.
And that covers almost everything data and control related, I’m not worried about the GUI part right now.
My bigger concern is that data and control are heavily mixed together. In a way tho, cards do define part of the control and it can be seen as data. I don’t want to limit myself to a set of parameterizable effects/actions. Another part I find ugly are those maps to store the values.
What I like is how easy it was to add the game recorder and to be able to specify almost any effect I can think of. However about that last point I still can’t redefine easily player specific rules, like “skip draw phase” and stuff like that.
I looked into entity systems (namely Artemis, hence why I registered here) but even though I like it a lot I’m pretty sure it’s not what I’m looking for … Again because my cards do have a control aspect that components aren’t really fitted to handle (as far as I understand). Again I have about as many Card.play() methods as I have different cards. Maybe I could still use such a system (one of my own though, learning purpose) for the model part (up to the recorder) and have the control within another layer. But I’d need help to figure things out.
How would you do (or did)?
- Lulero
ps: As it often does, writting this already helped a bit. But this post is probably full of missunderstandings, feel free to correct me. If I didn’t provide enough informations, by all mean ask.
