Ren'Py Help Finding CCG Engine for Renpy

legglas13

New Member
Jul 12, 2018
12
6
Hi All,

I've been seeing a lot of games posted lately with pretty similar CCG Deckbuilder elements (al la Slay the Spire), including ones that look like they use assets mostly from this site (Lust Hunter). I assumed that there would probably be a lemasoft cookbook entry or some similar guide on here for the code and card builder assets but I haven't been able to find anything.

I'm looking into incorporating that into a new project, but starting from scratch sounds a bit daunting. Please link any guides or assets you think would help.

Thanks
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
including ones that look like they use assets mostly from this site (Lust Hunter).
Hmm ? There's no such thing like "assets from this site". There's the pirated assets of course, but they are as much "from this site" than the more than 6,000 pirated games you can find here.


I'm looking into incorporating that into a new project, but starting from scratch sounds a bit daunting.
Yet I'm pretty sure that it's what they all did.
I'll not pretend to know all them, but I don't remember having seen two identical. And anyway they all rely on their own rules, what make the use of a framework relatively useless. Mostly it would be limited to a single screen, all the code depending of the rules, and therefore being unique.

Globally speaking it would looks like that:
/!\ WARNING /!\ This code is just a raw draft, it will NOT works as it
Python:
init python:

    # Player's deck
    class Deck( renpy.python.RevertableObject ):
        def __init__( self ):
            # Full deck
            self.original = []
            # Cards still to play for this party
            self.deck = []
            # Cards already played for this party
            self.played = []

        # Add a card to the desk
        def add( self, card ):
            self.original.append( card )
 
        # Remove a card to the desk
        def remove( self, card ):
            self.original.remove( card )
 
        # Get ready for a new party
        def reset( self ):
            # Reset the played cards
            self.played = []
            # Reset the cards to play
            self.deck = self.original[:]
            # Shuffle the deck
            renpy.random.shuffle( self.deck )


    # Cards
    class Card( renpy.python.RevertableObject ):
        def __init__( self, face, effect ):
            # Image for this card
            self.face = face
            # Code to call to "play" this card.
            self.effect = effect

    # One card effect
    def card1fx( player, opponent ):
        opponent.HP -= 1

    # Another card effect
    def card2fx( player, opponent ):
        player.HP += 1

default playerDeck = Deck()

# Create the cards
define card1 = Card( "image1.png", card1fx )
define card2 = Card( "image2.png", card2fx )

# build the player deck
label playerDeck:
    $ playerDeck.add( card1 )
    $ playerDeck.add( card2 )

label play:
    call screen cardGame( mc, badGuy )

screen cardGame():

    # 5 cards shown
    grid 1 5:
        for i in range( 0, 5 ):
            # Display the card
            imagebutton:
                idle playerDeck.deck[i].face
                # When clicked, call the effect code, passing the player and opponent objects
                action Function( playerDeck.deck[i].effect, player, opponent )
As I said, it's just a draft and it will not works as it. Among other missing parts, there's the opponent turn ; what is something important.
 

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
Renpy isn't ideal for card games, you would be better off with Unity.
The cards aren't dynamic enough to manipulate or animate and even some basic dragging is a pain to implement.
Sure you can implement point and click just fine but if you want anything more complex then that don't bother.
 
  • Angry
Reactions: anne O'nymous

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
The cards aren't dynamic enough to manipulate or animate and even some basic dragging is a pain to implement.
You should really start to read Ren'Py documentation.
 
  • Angry
Reactions: DuniX

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
Just because can do it doesn't mean it isn't garbage.
*sigh* Exactly like it's not necessarily garbage just because it's Ren'Py and you don't have a single clue about how to do it. Or not utter garbage because it's made with Unity, but by someone who absolutely don't know how to do it well.

Therefore, read the doc, and try it. For someone with your knowledge it's not difficult to figure out how to do. Or you can try the 14 years old and now totally outdated . In insist on the outdated part, there's now a whole to do all this without the need for an user defined displayable.
 

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
Therefore, read the doc, and try it.
I did try it, that's why I said its garbage from my experience.

The only thing dynamic about renpy is the screen language and that is still fairly limited.
There are things you can't mix, including draggables so you have to make all kinds of workarounds to get the effects you want.
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,490
7,035
The only thing dynamic about renpy is the screen language and that is still fairly limited.
Sorry, I'm going to agree with anne O'nymous and disagree with you. With , you can do just about anything you want to do in Ren'py, since you have low-level access to mouse events and to what is drawn on a frame-by-frame basis. Combine that with the fact that Ren'py now has a and , and you can basically do anything card game-ish that you could do in, say Unity.
 

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
With , you can do just about anything you want to do in Ren'py, since you have low-level access to mouse events and to what is drawn on a frame-by-frame basis.
Again just because you can doesn't mean it is a good idea.
It's not going to save you from the pain for working around the Screen Language and ATL.
If the "card game" worked by itself and was independent you would have a point, but you are still dependent on Screen Language and ATL and how it works together with the displayable.
Otherwise what? Are you going to implement your own Animation Language in Python that bypasses Renpy?
By that logic why don't you code your own engine from scratch?

Renpy is not ideal for card games, that's all I said, sure you can make the most basic stuff easily but everything more then that you are better of with Unity.
The only reason this is a debate is because anne O'nymous inserted himself to prove his hubris based on how much an "expert" he is.
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,490
7,035
Renpy isn't ideal for card games, you would be better off with Unity.
I will accept this opinion. However, I still disagree with your statement that it is "garbage."

The cards aren't dynamic enough to manipulate or animate and even some basic dragging is a pain to implement.
My point is that, with the features I quoted above, this sentence is just not true. Your insistence that "you're still dependent on screen language" is also not true, since you don't have to code animations or dynamic manipulations using screen language. As just one example, Creator Defined Displayables are not in any way restricted to just being inside screens.

Renpy is not ideal for card games, that's all I said
No, that wasn't all you said. Your use of the word "garbage" comes specifically to mind.

Look, I'm not trying to convert you from being a Unity-phile to a Ren'py-phile. (And, before you ask, I've used both extensively.) But the fact that it wouldn't be your first choice doesn't automatically mean that it's "garbage" or that anything you can do in Unity (card game wise) can't be done in Ren'py. Unity's a great package - don't get me wrong. And if you're more expert in C# than in Python, then it's definitely the appropriate tool for you.

Basically, my point is that your statements simply indicate that you don't, in fact, understand the power of some of the newer Ren'py features. And using the terms "hubris" and (quote)expert(quote) when referring to anne (who is an expert on Ren'py) strikes me as "I'm going to win my argument by insulting the other party."

Don't worry, I'm done.
 

DuniX

Well-Known Member
Dec 20, 2016
1,205
797
Your insistence that "you're still dependent on screen language" is also not true, since you don't have to code animations or dynamic manipulations using screen language. As just one example, Creator Defined Displayables are not in any way restricted to just being inside screens.
To me it's a more practical question.
If you look at a game like Cultist Simulator or Slay the Spire based on how fluid the cards animate and control, there is no way to get that even with CDD.
"Animations" in Renpy work mostly through ATL, and ATL works mostly through Screen Language(as interface) which is why I said that, CDD does not make that not the case.
You would need to hardcode things into the CDD and then make workarounds for the ATL, at which point you are going to have a mess to manage.
CDD's were never meant to be abused like that.
And using the terms "hubris" and (quote)expert(quote) when referring to anne (who is an expert on Ren'py) strikes me as "I'm going to win my argument by insulting the other party."
It's hubris precisely because he is an expert.
 
Last edited:

Symphatic

Member
Uploader
Nov 25, 2021
340
1,416
Since this is getting way off topic. anne O'nymous answered the way to do it in Python for Ren'Py. However, to add to what they said, every game has a different way of doing things. If you find a game you particularly like you can use it as a reference. You can also use generic frameworks as a reference. You can even use just the code Anne provided as a reference. Artists use references all the time and generally so do inexperienced coders.

You can make card games in almost any engine. Some languages are better than others in terms of what you want to do, but you can write a card game in almost any language.

RPG Maker MV/MZ (JavaScript)
I know for a fact you can even do games like Triple Triad (FF8) on RPG Maker / using JavaScript. This is compatible with the Tiple Triad plugin for MZ.

You also have a Core you can add onto MV made by Ateliar Irina (requires YEP plugins, and YEP Dragon Bones for animated cards) , , , & . There's also a sample project .

There's also an abandoned Alpha game called using similar stuff to Irina.

Unreal Engine 4/5 (C++)
You have some UE templates like , , and . I am sure you can find other blueprints, however, the support for 2D isn't very good as UE is primarily used for 3D games.

Unity (C# ?)
Same deal with UE. You can find various "simple" card games . There are also some others like , , , , & .

Ren'Py (Python)
Refer to Anne's post above.

Just remember all of the above make better references than they do a base, depending on your project of course.