Objectives
- Create a tool that allowed our developers to rapid prototype the pack opening algorithm.
- Create a tool that allowed our developers to change the algorithm.
Design
Elements:
- Cards: The list of cards to be released in the Set.
- Sorted into columns based on Card Type and Rarity.
- The Pack Algorithm: The percentage used to calculate the chance of populating a Card Pack with a card of that Card Type and Rarity.
- Needed to create blocks of cards within the Card Pack
- Meant to guarantee a specific amount of each Card Type and Rarity would spawn in each pack.
- Needed to create blocks of cards within the Card Pack
- The Pack Contents: The Cards that are selected for a Card Pack.
- The Black Areas either:
- Provide the number of Cards of a specific Rarity and Type for the maximum number for RNG functions.
- Converts a field in the Pack Algorithm for the script.
- The Button: The GUI that activates the Booster_Pack_Opening.gs script.
- The Script uses the Pack Algorithm to calculate how many of each card type and rarity are to be in the pack.
- Starting from the Standard Rarity, the Script determines which column it will pull the Card name from.
- The Script then pulls the number of cards in the chosen column(s) and uses that number as the max value in an RNG function.
- Once the RNG function is complete, the Script looks up the card that correlates the generated number with the row in the selected column and puts that value (Card Name) into the Pack Opening section.
- This process is repeated until all Fields in the Pack Opening section are populated.
Scripts used
Thought Process
When we were beginning the develop the in-game store and the player’s inventory, we needed a prototype the Pack Opening Algorithm using a tool that allowed us to change the variables but was robust enough to be used over and over again for the next set of cards. We know it would be a bad idea to create a physical version of the pack opening system because it would be massively time-consuming to use and record results. Since our company was a virtual one, we also needed to make sure every developer, where ever they were, could access the algorithm for testing and that they could see what variables used to make the algorithm so they can be transferred to the engine.
I discovered as I was working on the script that I could use the sheet to calculate formulas and store variables instead of creating Arrays or Functions in the script itself. The final calculations could then be pulled from the sheet by the script to determine which card was to be used. Since this was my first time using Google Sheets and Scripts, it was groundbreaking. I could simplify my code and have the sheet do most of the heavy lifting for calculations. It also meant that once the final algorithm and first card release were determined, anyone could change the card names in each column and then be able to test how well the set works in the pack opening.
Hindsight now tells me that this kind of work could be done in any program using arrays and tables but I feel this method is very useful for testing various other things in a game than just a pack opening. If we were to add more UI elements using Google Drawings, one could test entire user interfaces and combat systems. It is a very useful tool.
Things I would change
- Add this tool the Crafting System tool: Considering that the Pack Opening and the Crafting System go hand in hand half the time, being able to populate a pack, select a number of cards and disenchant the selected card, and reveal the materials from that selection would be a great addition to both tools
- Able to change the categories and what fields they reference: This would be a useful expansion to the tool and would make the Sheet more malleable in case we want to create different types of packs.
Postmortem
What went right
- Discovered how easy it was to create a tool using google sheets
- Created a reference for programmers to help with the implementation of the algorithm.
- Created a new tool in a relatively short period of time
Challenges
- Initial Design of tool
- Learning the basics of Google Scripts functionality
- Redesign based on Programmer feedback
What I learned
- Google Script Functionality Basics
- Improved Logic development
- Found a new tool to help create prototype UX designs