Is Deck building possible?

Anyone know how to make a deck building system
Or forming a list and then reading that list through the game in a cycle. (Clash Royale style)

I don’t know where to begin, but if someone else has done this, i’d love to look.

2 Likes

I haven’t done this, but I believe I could know out how to… I’d rather not make an entire system to get a solution tho

2 Likes

Totally fine, was more hoping someone knew a game that already had it, So I could just look.

1 Like

Gods of Five is a deck-builder

Code isn’t as clean as it would normally be due to the time span of the jam, but it should still be cleaner than most. (But there is also some extra code due to other systems)
It’s pretty easy to do as long as you know how to use lists well

Feel free to @ me if you have any questions.
I’m planning on completely redesigning the system as well, so I’d be open to discussing that as well if you wanted.

4 Likes

I’d say if your redesigning from the ground up, it’s probably easier if I follow that. I’m in no rush. So I’d be super grateful if you could take me through that process.

1 Like

A basic idea of the system:

Each card has its own id number

Message “AddCard” will add the number inputted (the card’s id) into a list of ids.
Message “SubCard” will find the id from the list of ids, and then remove it from the list.

the list of ids should be a global for easy access.

This helpful, quick questions though

  1. Can you limit the amount in a list, 20 numbers max?
  2. Is there an easy way to cap the amount of a certain number, like 4 of each card max?

Yeah that’s all possible.
Btw, what type of cards are you making? I was mostly going to be resigning the card effect part and just clean the drawing part a little bit.

—-

Setting the max to 20 is pretty easy, just do
List(all) —> List Count —> Filter
Equal to 20 means don’t allow cards to be added.

For capping the cards at 4 each, there are specific ways to do this. How are you adding the cards to the deck? I’m assuming your using one object that just adds a card ID to a list

Yeah I would just reuse one object for every ID, click the card add one of that to the list.
The cards are just a placeholder, I just need a deck building system. Making a list of 20 things, and allowing limited multiples of the same things. I’ve just never tried a system like this before.

This should be what you need. The system is very simple and pretty much has the bare minimum, but does everything you need effectively (in the “!Bundles” object)


I’m assuming you’re spawning the cards the players can use, so the system uses Starting Value for the cards.
If you want an expression to spawn the cards in whatever grid size you want I also have a bundle for that (was used in Gods of Five as well as my other project)

1 Like

Should this be a separate object than the cards to select from?
There’s no save or global so I figured every object would have it’s own list.
This is still a little confusing, But I think I get it mostly.
Also when you remove a card when it’s at it’s cap it end up going past the cap. I lowkey have no idea what’s going on, the number just spikes up.

Huh let me check. I didn’t do a ton of testing, just assumed it would work by looking at it (a terrible way to do this, I just do it sometimes because normally if there is an issue for me it’s a very quick fix, but for most people do not do this, properly test things).

Ok fixed some small issue, should work fine now. The “Add Card” is in the card object that you would use to normally just add cards to the deck (once again, I’m assuming you’re spawning these in and using starting value)

The Deck bundle is in the deck controller or whatever you have for that. That bundle is not in the cards.

Tell me if there are any other issues. Gtg rn, but when I get back I’ll talk about a save system, it’s a really simple change to add it in.

Alright, so for a save system, you need to think about what is getting saved.

  1. The deck. This is a pretty easy thing to save, it’s literally just a single Save set to a Number List
  2. The cards. So this is needed so that you don’t add 4 of a card, reload the page, and then another 4 of the same card. You can’t just save the number that is in the deck because would require tons of saves, which is just an ineffective method.
    What needs to happen is this.
  • Save the Card ID + Amount

So that would look like 12/3 or 8/0, etc. The first number is the card ID, and the second is the amount in the deck. This is then saved to a Text List.
You then separate these values on loading and use that to set everything. I’m assuming you’re ability to use lists like this isn’t great (frankly I could count the people on one hand who are decent at lists), so I can develop this system for you if you need and then explain it.

Also just realized I didn’t give an explanation of how the system of add cards and removing them from the deck work, so I’ll do that later as well if you haven’t already figured out the system

Is it fine now? I also changed the code in the “Add Card” bundle as well before

1 Like

I think my removal system is just different than what you had intended.
Do you know a way to check a list for how much of a certain number there is?
I’m going to use that to limit how many of each card in a deck, since I’d only need to use the one save for every card.

I was thinking of just using one save for every card as well, but I’ll design a system for getting the number of repeats for a card

Is it complicated?


My goal was just to add the repeats to that number, so it would be checked constantly for the filter.
And also this way I can display how many of each are in the deck, for the deck list.

So I’d use my original thing for removing the cards and whatnot, and finding the cards should be pretty easy. Let me make it and then I’ll explain how it works

Also are you making it so you can have multiple decks?