Others Ren'Py Need ideas/inspiration for card game in Ren'Py

Lou111

Active Member
Jun 2, 2018
543
686
Thank you for reading my post.
I'm having trouble coming up with ideas for a card game within a game that is currently in development.


The game will feature a collection-style system in which the player will encounter cards along the way, either as a quest/event reward or through purchase.
The card game will be largely optional throughout the game, but it will remain an important part of the culture regardless of participation.

Limitations:
As an amateur coder, AI functionality must be simple and straightforward.

Requirements (whether from my artist or the game's culture itself):
Cards will feature real-life models.
Cards will have rank system, i.e. D, C, B, A, S, and SS.

Preferences:
Cards should have traits (preferably body-type traits).
Cards of lower rank will remain relevant.


Ideally, I'll create a card game that is simple, addictive, and has a sense of constant progression. At the very least, this card game cannot be viewed as a hindrance or a task. I understand that the limitations I've presented make that difficult to achieve, which is why I'm here looking for inspiration to help bridge that gap. Ideas (regardless of complexity), opinions, and links to related concepts will be greatly appreciated.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,210
Limitations:
As an amateur coder, AI functionality must be simple and straightforward.
What is the real issue here, because it don't really goes with your:
Ideally, I'll create a card game that is simple, addictive, and has a sense of constant progression.
For it to be addictive, it need to be possible to beat your opponent right from the start, and not just by chance. Therefore it need to rely on card combination. And it's the same card combination that would carry the progression feeling, since new cards would imply new combination and more chance to win. But all this imply an AI-like that isn't that simple to implement for an amateur.

Actually, the most evolved card game I'm aware of on the scene is in Lust Hunter. But despite its apparent difficulty, once you get the right cards, a pack of 7 cards is enough to beat all opponents with a 99% winning rate.
This cover the sense of progression, but only until the moment you finally get that unbeatable combo. A combo that, by turning the game into an easy win, make it become something more boring than anything else.


Strictly speaking, making the AI-like part would be based on the algorithm principle.
For each cards on the computer hand, the AI would search for a path through the cards drawn by the player and the ones drawn by the computer, computing the cost of that path. Then, once all cards have their cost, the card with the lowest cost is the one to play.

The cost of each card is the combination of the cost of each card drawn by both the player and computer. So, something that, expressed through an if list would looks like:
Python:
if opponent defense > X: 
    card weight += 5        # The card would do some damage, but not all of them.
elif opponent defense > Y:
    card weight += 5        # The defense would absorb all the damage.
else:
    card weight -= 10        # The card would deal all its damages.

if opponent have that card drawn:
    if opponent have this card drawn:
        card weight += 100   # Because the combo provide the perfect defense against that card
   elif opponent have this card drawn:
        card weight += 10    # There's a defense again that card, but a weak one.
    elif opponent have this card drawn:
        card weight -= 100    # The card is the way to counter that combo.
    elif opponent have this card drawn:
        card weight -= 2       # Not ideal at all, but at least it can do something.
    else:
        card weight += 0       # it change nothing.
[repeat for all the cards drawn by player]

if the computer have that card drawn:
    if the computer have this card drawn:
        card weight -= 100     # Because it's the perfect combo
    [...]
[repeat for all the cards drawn by the computer]
but expressed in a more dynamic way, because having to take care of all the cards and possible combinations just through an if structure would be way too long and complex.


Basically you can probably have something more or less reliable through:
/!\ its a really rough algorithmic approach /!\
Python:
AI turn:

    cost = {}
    # Search your way through your hand.
    for each card in computer hand:
        cost[card] = card.cost( player_drawn, computer_drawn )

    # Order the costs by increasing value.
    orderedCost = sorted( cost.keys(), key=lambda k: cost[k] )

    # Play the card with the lowest cost.
    card to play = orderedCost[0]


compute cost( opponent, myself ):
    cost = X   # default cost

    #  Compute the cost changes due to the player cards
    for each card in opponent:
        cost += card.costAgainst( self, opponent )

    #  Compute the cost changes due to the computer cards.
    for each card in myself:
        cost += card.costWith( self, myself )

    # You can possibly extend this by predicting a future play
    # For this, compute the cost changes due to the cards in computer hand.

card.costAgaint( card, friends ):
    cost = X  # default cost

    if that card in friends:
        cost += 50        # it's a good combo
    elif that card in friends:
        cost += 20        # It's an average combo
    elif that card in friends:
        cost -= 20         # Oops, wrong play, those two weaken your hand.
    # You don't need to care about the insignificant cards

    if card in List of card I'm averagely strong against:
        cost += 10
    elif card in List of card I'm really strong against:
        cost += 50
    elif card in List of card I'm averagely weak against:
        cost -= 10
    elif card in List of card I'm really weak against:
        cost -= 50

    return cost
 
[same principle for costWith]
So, nothing too complicated, but also nothing effectively simple. But at least now you know what you are facing, and can decide if you can do it or not.
 
  • Wow
Reactions: GrooveDaddy

Lou111

Active Member
Jun 2, 2018
543
686
Your responses are always a joy for me to read.
What is the real issue here, because it don't really goes with your:
Lou111 said:
As an amateur coder, AI functionality must be simple and straightforward....
...Ideally, I'll create a card game that is simple, addictive, and has a sense of constant progression.
I didn't want to delay the game's development by attempting to accomplish something outside of my skill set when a simpler option of equal value was available. (I feel like the code you posted is right up my alley, for example). I can step outside of my comfort zone and pick up what I need, but I also don't want to spend too much time developing a card game that, in the end, may as well have been a stand-alone game on its own. I can understand some complex mechanics that will allow the player to freely play an in-depth card game, but developing an AI capable of making the same decisions? I'm not too sure. (I'm going to read the A* Search page you linked and then re-read your code, so this may change.)

And in the second line, I would like to emphasize the word "ideally" a little more. I wanted to include those words to spark discussions about simple concepts that promote addictive gameplay mechanics.

For it to be addictive, it need to be possible to beat your opponent right from the start, and not just by chance. Therefore it need to rely on card combination. And it's the same card combination that would carry the progression feeling, since new cards would imply new combination and more chance to win. But all this imply an AI-like that isn't that simple to implement for an amateur.

Actually, the most evolved card game I'm aware of on the scene is in Lust Hunter. But despite its apparent difficulty, once you get the right cards, a pack of 7 cards is enough to beat all opponents with a 99% winning rate.
This cover the sense of progression, but only until the moment you finally get that unbeatable combo. A combo that, by turning the game into an easy win, make it become something more boring than anything else.
This is a lot. I've never summed it up in such a way before, and now that you mention it, it ties in perfectly with the addictive gameplay I've previously encountered. In this game, I'd like to avoid the 99% win rate if possible. Perhaps using a 'deck strength' limitation, which is common in card-centric games...

(I'm downloading Lust Hunter...). I didn't think about using this game as a reference. The game I had in mind was a top-down card game, but I don't want to rule out any suggestions at this stage and will comb through it for inspiration.

Strictly speaking, making the AI-like part would be based on the algorithm principle.
For each cards on the computer hand, the AI would search for a path through the cards drawn by the player and the ones drawn by the computer, computing the cost of that path. Then, once all cards have their cost, the card with the lowest cost is the one to play.

The cost of each card is the combination of the cost of each card drawn by both the player and computer. So, something that, expressed through an if list would looks like:
Python:
if opponent defense > X:
    card weight += 5        # The card would do some damage, but not all of them.
elif opponent defense > Y:
    card weight += 5        # The defense would absorb all the damage.
else:
    card weight -= 10        # The card would deal all its damages.

if opponent have that card drawn:
    if opponent have this card drawn:
        card weight += 100   # Because the combo provide the perfect defense against that card
   elif opponent have this card drawn:
        card weight += 10    # There's a defense again that card, but a weak one.
    elif opponent have this card drawn:
        card weight -= 100    # The card is the way to counter that combo.
    elif opponent have this card drawn:
        card weight -= 2       # Not ideal at all, but at least it can do something.
    else:
        card weight += 0       # it change nothing.
[repeat for all the cards drawn by player]

if the computer have that card drawn:
    if the computer have this card drawn:
        card weight -= 100     # Because it's the perfect combo
    [...]
[repeat for all the cards drawn by the computer]
but expressed in a more dynamic way, because having to take care of all the cards and possible combinations just through an if structure would be way too long and complex.


Basically you can probably have something more or less reliable through:
/!\ its a really rough algorithmic approach /!\
Python:
AI turn:

    cost = {}
    # Search your way through your hand.
    for each card in computer hand:
        cost[card] = card.cost( player_drawn, computer_drawn )

    # Order the costs by increasing value.
    orderedCost = sorted( cost.keys(), key=lambda k: cost[k] )

    # Play the card with the lowest cost.
    card to play = orderedCost[0]


compute cost( opponent, myself ):
    cost = X   # default cost

    #  Compute the cost changes due to the player cards
    for each card in opponent:
        cost += card.costAgainst( self, opponent )

    #  Compute the cost changes due to the computer cards.
    for each card in myself:
        cost += card.costWith( self, myself )

    # You can possibly extend this by predicting a future play
    # For this, compute the cost changes due to the cards in computer hand.

card.costAgaint( card, friends ):
    cost = X  # default cost

    if that card in friends:
        cost += 50        # it's a good combo
    elif that card in friends:
        cost += 20        # It's an average combo
    elif that card in friends:
        cost -= 20         # Oops, wrong play, those two weaken your hand.
    # You don't need to care about the insignificant cards

    if card in List of card I'm averagely strong against:
        cost += 10
    elif card in List of card I'm really strong against:
        cost += 50
    elif card in List of card I'm averagely weak against:
        cost -= 10
    elif card in List of card I'm really weak against:
        cost -= 50

    return cost

[same principle for costWith]
So, nothing too complicated, but also nothing effectively simple. But at least now you know what you are facing, and can decide if you can do it or not.
I can't emphasize enough how much I needed to read your description of how the AI makes a decision in your example. Prior to reading that, my mind was unable to put the pieces together. Also, writing out the weights made it appear less intimidating.

I came here because the idea I had involved arranging cards on a board and creating fields of influence around them. You would then use the cards in your deck to combo off of them and/or disrupt the opponent's strategy to score points. Some cards perform better than others across the two roles. Higher tier cards would add more diversity to your deck, but they would also cost more. On paper, the concept appears to be solid, but it is also bland. In addition, creating an AI that takes into account fields, placement, and counter-strategies... I am not there yet. Finally, I wanted a placement-style game because one of the most appealing aspects is the design of the cards themselves; the artist has done an excellent job with them and having many of them on display could only be a benefit to the player experience.
 
Last edited: