MV Card Battle Plugin (WIP)

By far my largest project ever, must have been my card game. This is an enormous project, which is all about growing your card-deck and defeat growing enemies.

Now, I am working on making this whole project into a plugin, which would help others make a card game themselves. And I like to keep you guys updated on the progress.



In this post you find:
  1. This is not an RPG!
  2. A little history behind the plugin
  3. About the (intended) possibilities
  4. Features already present
  5. Features I can easily create
  6. Features I might struggle with
  7. Check out the demo!


1. This is not an RPG!
Of course, I know RPG maker is meant to make RPG's with, but it can do so much more, if you're a little creative. This system is for a card game. There is no exploring, no dialogue, no treasure hunting and no battle. Although, it totally is possible to make it look like an RPG, as I did in my demo, it is not possible to use this as a mini game inside an RPG. So even though the character can walk on the map and talk to other NPC's, the actor doesn't really have any stats behind his avatar.
This system will actively use the stats of actors/party, items, skills, weapons, armors and enemies all to make the game run well. And because all those aspects are already used by this system, they can't be used for anything else. Also the way ATK, DEF, MAT, MDG, AGI, LUK MHP and MMP are used, is completely replaced with stats for cards. Although HP is still HP...

With this plugin, you will be able to turn RPG maker into a CCG Maker (Card Collecting Game). The kind of games you can create with this, are much like Hearthstone, Yu-Gi-Oh and Pokemon. I am not suggesting you should remake those games, which I would advice against, but it is the type of game you should look at when you want to know what kind of game this plugin is (or should be) able to create.

I aim to make the system the same as the evented version which has been completed for about 2 or 3 years now. However, the user of the plugin would be free to choose their own board-layout, their own rules and their own win conditions. By default the player wins, if the opponent runs out of cards before the player does.

I like to state it once more: This is not a minigame, to be used inside an RPG! It won't work. You can fake it, like I did, but you can not add this to an existing game. This is for new games to be build around this plugin.

The plugin is far from plug-and-play. You need to set up a board, and you need to create graphics for that board (unless you want to use the default one), you need to set up all the cards, and you need to create all the graphics for those cards.


2. A little history behind the plugin.
I like to make systems and for a long time I loved making them by using events. I just loved to push the limits of what RPG maker can do by default. Which is way more than it was meant to do.

In the past I have made complete systems for a chess game*, a tic-tac-toe game, a clock and calendar system, a farming simulator, and a board game. This board game was going to have a small scene based on cards you could draw from a stack, when landing on a certain type of tile.

I never liked the way that scene was played after drawing a card... I wanted to make it so that the card would trigger a little card based battle. First I took the easy way out, and I downloaded a plugin. It worked great, but it wasn't my own work, which bothered me. Soon enough I found out that the plugin was straight-up a copy from a mini game in final fantasy. So this plugin was an absolute no-go for me.

I opened a new project and I started experimenting with script calls to move pictures around on the screen. And with variables, lots and lots of variables. My math is my strong suit, so that works in my favor, but the amount of formula's became larger and more complicated.

I got completely sucked into this and I totally forgot this was supposed to be a mini-game for the board game. Instead it was growing to be the size of a hearthstone-like game. The gameplay is not the same, but you do collect cards by winning matches, and win matches by playing the best collected cards.

When I had this whole system running, I had about 200 cards, used over 100 variables and completely took over enemies and skills, which were unused in the board game anyway. But what was supposed to be a minigame, now took 15 to 60 minutes to complete. That is horrible, when 3 other players wait their turn.

So this card game never became a mini game in my board game, but instead it became my main project. I have versions of the game where you just play match after match until you lose 3 matches, which will end the run. I also have a version of the game where I did attempt to make this part of an RPG. Which turned out great, actually, but the RPG was nothing but a way to send the player from one battle to the next. The story did allow me to place at least the opening battles in the right order, so the player gets a few easy battles before it gets harder.

However... It is really time consuming to both maintain the RPG and the card game simultaneously. In my case this meant the story took hits because I payed more attention to the card-game than to the story. And that is where my project stranded.

I restarted it a few times, to improve a few things in the system, allowing me to create more card-types, and use more detail in my cards. Once I restarted to create a graveyard, where all defeated cards go, so I could create skills that revive those cards.

But I never got to the point again, where I had something to show, which actually would be better than what I had before. And I knew why... Everything I add to the game, means doing many, many calculations. Specially to make the AI react to it in a challenging way. So, I thought: "What if I put all those calculations in an external file?"

And that is what I did. I set up a large list with things I need to call upon a lot, and then I learned how to use those in a script call. But I didn't stop there... I started to make plugin commands for the most common sequences I use in the card game.

Now I know how to do that, I feel like I can do a lot more... So, I want to make the whole game run on plugins. Every event and every common event, should show pretty much only a few plugin commands.


3. About the intended possibilities
This is what the plugins should be able to do:
  • Drawing cards from a deck, move them into your hand
  • Move cards from "Slot" to "Slot"
  • Make one card attack another card
  • Have cards trigger a skill
    • when played
    • when attacking
    • when being attacked
    • when being destroyed
    • at the start of each turn
    • at the end of each turn
  • Remove defeated cards from the field (And optionally move them to a graveyard)
  • Unlock new cards after defeating a battle
  • Spend gold to copy cards
  • Upgrade the card when you have more copies than the max
    • By default, when obtaining a 3rd copy, they merch into card of a higher tier.
    • By default there are 5 tiers: Poor, Uncommon, Rare, Epic, Legendary.
  • Set and check a win condition
  • Use enemies in the database as default stats of a card
  • Use actors in the database as current stats for cards in play
  • Use skill to refer to skills and skill types
  • Use weapons to refer to a skill the player can use once per turn
  • Use armor to refer to passive effects
  • Control the way the player selects a card to play
  • Last, but certainly not least: Control the AI.
For those paying attention, you might notice I do not use items to refer to anything. And that is right. However, items can be useful when eventing the game as an end-user, they are not assigned to anything (yet). I like to use items to collect junk items, which can be sold for gold, which can be used to buy/upgrade your cards. But maybe the end-user has a different idea how to use items.


4. Features that already exist
Note that I first write this post in an early stage of developing. 80% already exist inside my head, but to make it all a reality, is a time consuming job. So this list might still be a lot shorter than the to do list... For now.

Existing features:
  • It can make a card show at 100% size (which is about 3x the size it is shown during the game) at the center of the screen. This is useful when the player wants to see the details of a single card, or when the card is just unlocked. It will move in the picture from the top, stays there till the player gives input, and then it moves out of the frame again.
  • It can make a card show at 100% size like above, but it starts back side up, and flips around reveling the card.
  • It can make new cards appear on the table or in your hand with the right coordinates, and have all the stats set up from the database.
  • It can move existing cards move on the table or in your hand with the right coordinates, and have all the stats copied from their old position to their new position. (So, the stats we use during the game are not bound to the card directly, but to the slot they are placed in. When the card moves, the plugin moves the stats with it.)
Those are mostly visual changes so far, other than copying over the stats. And it doesn't seem like a lot, but... This is 90% of the game, just moving cards around. 😛 If you could see into my game, you'd see that everything I did, contains the functions above. Whatever happens in the game, it always includes either showing a card on coordinates, it moves a card around, or it removes a card.


5. Features I (think I) can easily create
Of many features I have a good idea how to do it, specially since I've already evented most of it before. And those events have been more and more existing of JavaScript script calls anyway.

I think I can easily make those without too much trouble:
  • Draw a card from a deck. A card Id will be randomly taken from an array, and the plugin will add the correct stats to the card.
  • Have cards attack each other. This alters their stats (at least lowers their health) and might trigger a follow-up skill.
  • Have cards trigger skills. Each skill type has a different way of being triggered. This can be when a card is played, attack or destroyed, among a few other skill types. 2 cards can have the same skill on a different skill type.*
  • Unlock a new card. Cards are only unlocked once, and will always be new to the player. Those are by default unlocked when defeating an opponent.
  • Copy cards and upgrade them. Only cards that are unlocked can be copied. When you obtain more copies of the same card, it will be upgraded to a new tier.**
  • Start a random song from a list preselected by the end user at the start of each new game. It fades out when the game is won or lost. (There is no draw. You win,or you lose.)
(* For example, one card has a skill type that triggers when played, and the other card triggers when it is destroyed, but both skills do 3 damage randomly split among enemy cards)
(** Okay, this I do not look forward to. I remember this being such a struggle the first time around... It sounds so easy: When you get a third copy, replace all 3 with 1 upgraded copy... Well, it was not easy at all.)


6. Features I might struggle with
There are a few features which were created in the original project using a plugin. There are also features that were a hell to create with events even though I knew exactly what I was doing. Those might be reasons why some features might be harder to recreate than others.

Those might be a challenge:
  • Selecting a card. In the original project I used a few yanfly plugins to make this happen:
    • a plugin that allowed me to trigger an event by clicking it with a mouse
    • a plugin that allowed me to adjust the size of an event, so the whole card (3x4 tiles) becomes clickable
  • AI. If you hear how I made the AI, you will understand what a hell it is... I have set up conditions, checking each card the AI can play, against each card the player has on the table, and bind a score to this. the card-target combination with the highest score will be played by the AI. Those checks include the following in the scores:
    • Does the playing card survive the attack?
    • If so, how much HP is left after?
    • Does the target survive the attack?
    • If so, how much HP is left after?
    • If not, how much overkill did I do (large overkill is a waste of a strong card.)?
    • Does the card have a skill type, if so, which?
    • If so, is it a healing skill or a damaging skill?
    • And who does it target?
    • Does the target have a skill type, if so, which?
    • If so, is it a healing skill or a damaging skill?
    • And who does it target?
    • What is your power?
    • What is your enemy's power?
    • etc etc etc
The list is actually longer than that. And it took me ages to get those scores right, so the engine would actually be able to play a smart game... But in the previous versions, I had 2 skill types... Now I have 6 and counting... And I have to do it all in javascript. 😛

This AI, is probably the hardest thing I do this year. Maybe besides learning how to play the piano on a keyboard. 😛


7. Check out the demo!
You're curious, are you? You skipped everything I wrote and went straight to the bottom to check out the plugin... 😛 Ah, I can't blame you. I might have done the same thing.

Well, I got bad news for you. The plugin isn't playable just yet, because it doesn't exist yet... Mostly... And yet you can already play the game I'm going to make with it. And which hopefully you can make with it, too! What?!? How can you play the game if the plugin does not yet exist?

Well, the game I can show you is actually not made with my plugin, but is evented by me. The plugin I try to create is going to do exactly what the game already does, and more. So yes, you can actually play the card game right now. In fact, I would love it if you would...

Once the plugin is actually functional, I will replace the link with a version that actually uses the plugin. And when the plugin is completed, I will probably try to sell it to you. So get hooked, get hyped, get addicted to this card game. It's okay, your next fix is on its way. 😉
Process is slow, but... I got scaling of cards automated to fit the slot they are placed in.

Before, all card on the table had to be the same size. (37.5% by default)
Cards that are shown individually were always shown at 100%, and still are.

For my own personal project, this was an issue, because the layout I want, requires more space. And even when using a 1920x1080 pixel game window, I would not be able to use more than 22 tiles vertically... So I wanted to make the cards in the players hand smaller...

This meant I had to make a huge adaption to the plugin, but since I wasn't that far in yet, I thought it was best to adapt it now. So I did.

This could now be the layout of a board, for example:
1720712991246.png

In this setup, Blue means Player Slots, Red means Opponent Slots. Circles are for boss faces, boss powers and boss equipment. Everything rectangle is a card.

In this case, the play field is 39x22 tiles big. That is the maximum amount of tiles you can have in a 1920x1080 screen. Actually, the max is 40x22, but I choose 39, because then I have a centered tile.

Each card used to be 3x4 tiles, which is exactly 37.5% of a actual card size. Now, cards on the table still have 3x4 tiles per card, but the cards in the hand, have 2x3 tiles, which turns out is the perfect size to show the card at 25%. There is always a few pixels left around the card, so that the proportions don't match up doesn't matter, and is invisible for the player.


Just to show what a difference this actually is..., here is an example of a card at full size, 37.5% and 25%
1720713765148.png

(This card is made for my own game, which I will use this plugin for myself. Background is from RTP, character comes from the Medieval set by PVGames.)

So, even though process seems slow, the steps I make, make a huge difference in what the end product will be... I hope...

Spoiler: Wanna talk about this some more?
If you did read this whole piece, you probably find this interesting, right? Cool! Me too. And I like to talk about this as well. In the weekends, I try to stream on twitch. I would like to have a guest during my next stream, who would like to discuss the plugin, what is can do so far, and what it should do, during the stream.

You do need a discord account and I like to record a test call first, just to make sure our mics are both coming in at the right volume and stuff like that.
For those who think this project was abandoned: No it is not.

True, I get side-tracked a lot, but this is actually considered 1 of my 2 main projects.
I don't post a lot about it, but I did make a lot of progress.

I did change a card layout, at first. I used RTP images, to create a set of cards to tast the plugin with. I actually created multiple sets, but this is the one I go with for now:

Card1.png
Card2.png
Card3.png
Card4.png


Just to show you the first 4 cards. The icons on the upper-left corner are from Avery's iconset, which is a redraw of VX Ace RTP, the rest is made with RTP.

When the cards are played, they will look like this:


Battler1.png
Battler2.png
Battler3.png
Battler4.png


The game can be designed win different ways, with the plugin I attempt to create. I have experienced with multple layouts, and found this the best one:

1734880860219.png


I also made a little in-game tutorial explaining the rules. This might seem like everything is created yet, but that is far from the truth.

1734880966050.png
1734880973420.png
1734880988884.png
1734880994801.png
1734881004192.png
1734881012379.png
1734881020448.png
1734881026151.png
1734881031681.png
1734881037616.png
1734881043651.png
1734881049824.png


This is just a layout I created with the system. The next game with this system might look nothing like this one.

You might have noticed the weapon and armor slot being empty, but this is because I didn't create any cards for that just yet. This will happen soon.

Everythings seems to go fast now, and hopefully soon I have a playable demo.
really ambitious and interesting project. I hope it's going well!!

Original thread: https://forums.rpgmakerweb.com/threads/card-battle-plugin-wip.169980/