Tabletop Simulator

Tabletop Simulator

Not enough ratings
[Script] The Deck Builder
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
307.628 KB
7 Oct, 2022 @ 12:42pm
8 Jan, 2024 @ 5:16am
10 Change Notes ( view )

Subscribe to download
[Script] The Deck Builder

In 1 collection by Ediforce44
Basic Script Components
7 items
Description
The One and Only Deck Builder
This is a map to demonstrate a deck builder I created.
Some time ago I struggled with the problem of implementing a deck builder. After a little tests I found the best solution for me, which comes with little to zero lags.
I implemented it in the Isaac: Four Souls project I am currently working on. But I heared a lot of people have problems with the deck building in TTS because it is not very well supported.

Now I present what I think is one of the best solutions for building decks. My version is heavely based on the TTS cut() function.
This map will present 2 versions of the deck builder.
  1. The first version is pretty fast and builds decks out of so called Pre-Decks (later more)
  2. The second version is the same as the first version but you can add filters for each deck to exclude some type of cards. The second version is a little bit slower and creates short lags but nothing compared to the freezing, which appears if you draw each card separately to build the deck.



Scenario for the standard deck builder
The deck builder is build to work with so called Pre-Decks.
Pre-Decks are decks or single cards which exists before the deck builder is started. Each deck build by the deck builder consists of multiple cards from each Pre-Deck for this deck.
Each Pre-Deck represents a stack of cards from one specific card type.
A deck is defined by its ratio. The ratio is a table of numbers for each card type. The deck builder ensures that only this much cards from this type will be mixed into the deck.
Each deck should have its own Pre-Decks.

Scenario for filters
If you want to exclude some cards (for example in different game modes), you can do this by using the filter option.
Filters can be static or dynamic. You can set them at any time. The deck builder will then select only cards which pass your filter settings. Filters can be applied for each deck individually.
You can filter out cards by their tags or by their name, aswell as by certain variable values in their scripts.



Contents
You can find three checkers (red, white, black). Each checker contains a part of the deck building process.
  • RED: This script represents your setup script for the game. It is the Entry point to the deck builder and the exit point to which the deck builder is going to come back after it is done.
  • WHITE: This script handles and manages the Pre-Decks. You only have to do some slight configurations if you import it in your project.
  • BLACK: This script contains the main logic for the deck builder. In this script you can fully customize your deck builder. You will find some example filters and deck ratios.



How to implement this deck builder in your project!
  1. Save the white and black checker and import them into your project.
  2. Configure your deck builder (type in your Pre-Deck guids and the deck ratios and opitonal your filters)
  3. Add the call of the deck builder to your setup script and implement the callback function after the deck builder is done.

How we use this deck builder!
  • All the Pre-Decks are stored in a "Pre-Deck-Bag".
  • There is a Pre-Deck-Bag for each language.
  • If the player select the language, all Pre-Decks will be pulled out of the corresponding Pre-Deck-Bag and placed somewhere, where the player can't see them.
  • If the player start the game (for example throgh a click an a start button), the deck builder is called and will build the decks.
  • If the deck builder finished its job, it will call a function which deals cards from the build decks or reveal the first cards from some decks, etc.



So that's it. I hope you like it. Feel free to do what every you want with these scripts.
Please, give me some credits if you use them :D

Other Projects
5 Comments
Ediforce44  [author] 22 Dec, 2022 @ 2:00am 
True. I will see what I can do :D
theBishop 21 Dec, 2022 @ 7:15pm 
Record your screen, while recording your voice. Make a simple deck with ~5 cards as a demonstration. Then make another video that is more complex like the pre-decks. Upload them to a Youtube channel.

You could do the above in under two hours. Anything is better than nothing.
Ediforce44  [author] 21 Dec, 2022 @ 8:37am 
That would be a good idea. The only problem is that it is very time consuming :(
theBishop 20 Dec, 2022 @ 12:41pm 
This looks useful but hard to understand how to use it. Perhaps a youtube video demonstrating it's use would encourage people to use it and credit you for it.
Ediforce44  [author] 14 Oct, 2022 @ 3:49am 
Little notification: I fixed a little bug that I found. Otherwise this version should be final and won't change in the future, so you don't have to update your configured version if you used it.

But if these scripts will ever be updated (because of new features), I will make a version in which you can configure all your stuff in separate files. This means if the 2 main scripts from this mod will ever be changed you can replace them as a whole in your mod and won't have to do the configurations again.