Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: RPG card game  (Read 6951 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 12
    • View Profile
RPG card game
« on: March 16, 2015, 12:37:02 am »
Hi I'm lsmod,

as I'm  working a video game project using SFML I would probably ask soon for forum's help on some technical issues. So I think It would be better to introduce my-self before come-in with (a lot a of) questions.

So I'm a programmer for years and I decide few month ago to develop my own game. As I always wanted to do since I learn programming by my-self. I choose to use SFML because it got SIMPLE in it :) and also a good forum, some nice clear and concise tutorials, not to forgot "SFMF game development" book (which I need to finish reading but one thing at the time). And one very important thing it's free & opensource so many many thx

So what about the project:

It's a card game with some RPG in it (combat mechanics mostly). You know built your deck and go duel someone. BUT this one it's different (even if it don't exist yet except in my head). Yes different because it's:
- handraw graphics (personal and "artistic abstract style")
- never will be a pay to win (that fuck all the good card games IMO)
- hazard part it's gonna be small (no random cards in your hand and you waiting for the one you need)
- no complete informations (some of adversary cards will be face down)
- a completed game with a story/senario , hero quests, and many levels

I hope to make a complete game one step at the time.  Currently I have nothing to show except some drawing and test, code and more code. But nothing with an UI. I don't expect to finish it any time soon but to work on it every day (okay i meant every week).
Soon I would be able to test a real combat. I started to create a prototype with an UI know that I have solid combat mechanics develop. The goal of this prototype is to being able to test many cards and strategies to see what works, what's fun, what's not.
I would like to be fun, fast with many way to own your opponent. That to say strategieS and counter strategies. I played a lot off poker I dream to make a game so deep in mind level, that always left you wondering what if you have done something else. But not frustrating and not without fun in defeat (just a dream will see).

any way thx in advance for futur help, I hope to learn a lot and be able to contribute in return someday.

« Last Edit: March 16, 2015, 03:42:44 pm by lsmod »


  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: RPG card game
« Reply #1 on: March 16, 2015, 10:09:11 am »
Hi Ismod,

this idea sounds really cool. I´m thinking it should be a game like Blizzards Hearthstone, but without "real-money" payment? You say there will be a main store - so you pay for a booster-pack with in-game gold?

I hope to see more of this Project.  :D


  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: RPG card game
« Reply #2 on: March 16, 2015, 03:52:59 pm »

no it won't have a store (typing error I meant "story" not store  ::)). Yeah a bit like heartstone but more like duel of champions. It's hard to say until I test a real game. But really I don't want no store and/or booster pack. I was thinking loots from 1vs1 game and quests. And also open trade between players (like in diablo II).

Thanks for your interest. I will post more later on


  • SFML Team
  • Hero Member
  • *****
  • Posts: 9909
    • View Profile
    • development blog
    • Email
AW: RPG card game
« Reply #3 on: March 16, 2015, 04:01:36 pm »
If this is your first game, start with something simple first, just to understand all the aspects a game actually needs.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/


  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: RPG card game
« Reply #4 on: March 16, 2015, 05:55:39 pm »
thx for the advice it's good one. I understood long time ago that game development is may be the most complex field in programming. I learnt programming about 14 years ago because I wanted to create video games. But I quickly  realise that it's not for beginners even to make small games.
I created some board game (played with friends was fun). A decade ago I made some video game prototypes, a lot of projects that I gave up on years ago. I have finished a small video game (tamakotshi like in flash). Finally I started working as programmer but not in game development.

That to say I know my project it's really ambitious. That's why divide the project in small realistic steps to make many release who will add-in some aspect of the game the one by one. like this :
0) 1vs1 prototype (test gameplay)
1) 1vs1 game
2) 1vs1 game online
3) add-in loots and trading
4) tutorial and solo quests
X) full complete game online

My goal it's to make a complete game. But only by staying realistic about my resource in time and skills. So at some point I won't give up on the project because it's out of my reach. The "end game" it's my inspiration for know not my direct goal.
Also I'm making this prototype to test game mechanics because I would like to try something different than an game where you win when kill enemie's heroes (like hearstone or duel of champions). But it's hard to say if it's an idea who will works until I play a real game.


  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: RPG card game
« Reply #5 on: March 17, 2015, 08:06:06 am »
But really I don't want no store and/or booster pack. I was thinking loots from 1vs1 game and quests.
You mean that you don´t want a store anyway, right?  ;D

But how did you earn cards then? Only by defeating KI Champions? Because by trading cards with other players, they also need a source before  ???

Sorry for so many questions about this trading-systems, but im really interested in such a game system.  :)


  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: RPG card game
« Reply #6 on: March 17, 2015, 02:41:35 pm »
Well in the case of a card store he could setup an in-game currency that can be won win or lose in the duels themselves.  Another way would be too make it so you get random cards at the end of a duel for winning or losing.  The only thing that would change would be how many cards are won.  Now another thing he could do is let players make their own cards within some set limits and trade copies of them.  Say if a new card is detected it is added to the local DB on the player's end who doesn't have it but the number of copies they have of it is set to 0.  This way the card's information is recorded to prevent issues of new cards not working on the other player's end.  The maker of the card has as many as they want while anyone they give it to only gets a number of copies given.

As you can tell there are so many ways to do it, but I'd say starting with all cards available for testing might help since having a limited number in your trunk might cause issues when seeing if it works or not.
I have many ideas but need the help of others to find way to make use of them.


  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: RPG card game
« Reply #7 on: March 17, 2015, 03:52:13 pm »
But how did you earn cards then?
as StormWingDelta said, I was thinkings random loot at the end of duels (for loosers and winners). May be not after each duel. It's not define yet. And later on when duel and trading are working as quests rewards.

starting with all cards available for testing might help
that's exactly what I'm planning to do :)


  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: RPG card game
« Reply #8 on: March 18, 2015, 07:43:16 am »
Ah ok, thanks for explaining guys.
Apart from Hearthstone i haven´t any experience in RPG card games.

Can´t wait to see some pictures of the game :)


  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: RPG card game
« Reply #9 on: May 27, 2015, 08:30:39 pm »
hi as I'm closing in on finishing the game prototype. I would like to open the champagne to summarise to my-self what I have done so far (So It will be clearer for me what remain to do and what's to improve).

First as I said I'm making a game prototype to test various game idea. On paper ideas look nice but I believe it really need to be experienced by playing to see what concepts are good.

So basically I'm making a battle game 1 vs 1 with card as RPG entities. The Goals is to be the last standing. You can deploy max 30 card (8 max on your side of the board). When player have deployed/used all their 30 cards then it's the first to eliminate all enemies remaining cards on the board who wins.

Card are like RPG entities, with different stat and skills. Or a card it can be just like a spell.
- warrior entity with life, attack, shield (like an hero).
- heal aura (heal all card on the deck). in this case it has no attack and no life stat and would be destroyed at the first attack it get. That's why I consider It more like a spell.
With that in mind I had to organise my work.

Dev environment:

- Eclipse Kleper (love the "rename" refactoring function which I use a lot)
- gcc/g++ compiler (I had some problem to find the right version to work with SFML finally I use TDM-gcc-4.8.1
- SFML (of course)
- CUTE (for unit test) just like its simplicity
- metriculator (some eclipse plugin to count ligne of source code) not essential I just like to see my project advancement
- C++11 I'm new to c++. Long time I know the its syntax , but I never really got to dev in c++. So I jump into c++11. I knew it would be challenging but RAII idioms and smart pointer reassured me :)

The compromise:

I want to dev a prototype to try a game concept. So I have to dev some kind of engine. On one hand I don't want to throw of my work on the engine after I test my concept. On an other hand I don't want to get cut in game engine developing and forgot my first goal. So I try to make something flexible, but not to flexible because it's to much work and I may never use some of the functionalities. I want An engine rapidly release who will allow me to try different concept and somehow with a relatively clean design.
I manage to did it by focusing first on the functionalities that my prototype need and then how to make it more flexible. As I said it's a compromise and I think I lean toward  quality dev than to create a lot of functionalities. I get that know that I'm writing this. I have some functionalities yet to implement but I worked quiet a lot  on clean coding and test it.
I believe that what I dev would be use as base engine for the game. But also that if my concepts are not good what I have done won't be handy. Or maybe not I will see.

Dev steps & design:

1) I started by naively implement a card class, that could be seen as an rpg hero with life, shield, damage, element resistance (damage are of one of the four elements), chance of succeed an attack, and so on.

2) I separate the attack for the card class. Simply because I realise card don't have to got attack. So better to create an AttackSkill class. Therefore I did some other skill classes who play will with card's stats.

3) I create Interaction class for AttackSkill. Wish take an card and its AttackSkill and apply it to an other card. Then I finally get to my head that it's better design to separate stat from the action who manipulate then.
So I got:
- proprieties class (cards stats & skill stats) 
- interaction class (which use skill stat to modify taget card's stat)
HealSkill class {bonus_stat +10pv}
HealInteraction{healSkill* skill; apply(Card* target)}
Card {life_stat {0}; getLife();, setLife();}

4) I made some unit test ! And caught a lot of bugs :D

5) The event! All right card1 attack card2 I made it. But what about Card2 heal him-self after receiving damage? So I had to manage event.
What I did:
- EventHandler class (still empty class it was too hard to do :( No I'm just kidding, but it was challenging for me)
- SkillHolder every card got its skills in it. And there is one for each event: Holder* trigger_attack, trigger_defense, trigger_dead
- player action will call EventHandler trigger matching function. ex: card1 attack card2 -> EventHandler.attack(card1, card2) then EventHandler.defense(card2, cart1);
- then the event function check card.trigger_attack for skill to apply
- EventHandler apply the interaction to the card2 target, using card1 skill

6) What a mess ! So many skill, so many interaction wish are of different class type. I know I deserve it with my "go get it, think one step at the time method". Oh men! template class come to the rescue. One function to apply different interaction class type. C++ is so nice.

7) refactoring: Well all my interaction classes derived from the same base HealInteraction : Interaction, AttackInteraction : Interaction. It's nice because I need apply(), canApply(), remove() but apply  heal is really different from apply attack. So heritage was a good solutions.
My problems come here: skill are of different type (HealSkill, AttackSkill, ...) and interaction need access to skill's stat.
First idea (ugly but worked) I made apply() a pure virtual function and add-in member skill pointer to every skill child. But not in the Interaction parent class. As i said ugly but worked.
As you can see I need to improve in c++! Hopefully I found a better solution: parent Interaction as a template class. So now child derive from it. Like this: healInteraction : Interaction<HealSkill>, attackInteraction : Interaction<AttackSkill>
And so I did add-in a template member skill pointeur. T* skill; And get reed of my ugly design.
8 ) An other problem... In eventhandler when a event is triggered. I got many type of skill to check if they react and many type of interaction.
So I have to do Something like:
  void EventHandler::attack(card, target)
   { if(card.trigger_attack.haveHeal)
      applyInteraction<heal>(card, target);
      applyInteraction<Attack>(card, target);
It would have been ok if a had only one event, but I got many of them And really would like to do something like this:
         applyInteraction<card.trigger_attack.getTypeSkill)(card, target);
I tried those ideas:
-put my skills into a vector<Skill> (Skill is the parent class of HealSkill, AttackSkill...) Okay but I couldn't get access to child member without dynamic_cast wish made me make a giant list of if -> return to case zero
- use a tuple<HealSkill, AttackSkill> Problem : tuple.get<X> X is a compil time parameter I would have to write: tuple.get<1> tuple.get<2> tuple.get<x>, ... Same ****
- I add a class member with the type of the next Skill's derived class to access. It worked well to got my loop. BUT I run into a problem with template type deduction : it's made at compile time add my loop at runtime, so It could call the correct template function matching my current type -> return to case zero
...Meanwhile I received my new book "Modern C++ generic design by Andrei Alexandrescu". Who talks exactly about my problem (didn't know when order it)...
- Out of nowhere I got and idea (hiding the book it got nothing to do with it) : skills into a tuple and use boost::fusion::for_each on it who call a template functor for each element of my tuple!
Well that step took time and went back and forward but I learn a lot.

9) refactoring then rewrite from scratch my unit test (to much had evolve and the old one were, hmm... too old)

After all that I can say that I have learn a lot (C++ and software design). I enjoyed developing  that prototype more than anything a ever have developed. The C++ book came right on time and I will learn more from it.
About the prototype I still have some skill to add-in (Stun, resurrection and invocation) and work a little bit on the "UI design". Then I will finally be able to test concepts and learn from it to determine how the game will play.
« Last Edit: May 28, 2015, 05:53:12 pm by lsmod »