Posted on October 28th, 2022 / S0kun
What goes into creating a new character and their abilities? The answer, lots and lots of numbers.
Today, we’ll continue our exploration into Chasm with a part 2 blog from Edison Scott, Character Engineer, dedicated to not only understanding the character, but also what literally makes him tick behind the game’s developments.
In MPQ, we essentially have a toolbox of Ability Effects Puzzle Pieces that do certain actions such as deal damage, create repeater tiles, mutate tiles, etc. We can tie those effects to various game events to trigger them, such as ability activated, on turn started, on tile matched, etc. Thankfully, to assist in adding a bit more dynamic effects to abilities, we can also store, compare, and perform basic arithmetic on some simple variables like integers (whole numbers), floats (decimal numbers), and tile locations. All character abilities in the game are created from clever combinations of these various ability effects and sometimes we even try to add new ones! But adding new effects requires new device builds, which must be done far in advance.
Chasm Abilities Breakdown
Chasm was a bit of an ambitious character to implement ability-wise: 3 passive abilities, 2 of which feature very clever uses of combining available ability effects within the ability system in such a way to match the desired outcome. Chasm also required new ability tech in the form of the Abyss tile. This new tile’s addition to the game needed to precede the character to make sure the build was approved on all platforms in time for the release of the character.
For Walking Abyss,we don’t technically have a great way to automatically check AP against a character’s strongest colors, nor do we have a way to get a character’s weakest color. But we can get a character’s Nth strongest color (N being any number from 1~6). So essentially we need to check each color, limiting by N (1~6 for strongest, 6~1 for weakest), against the opposing team’s AP, making sure they have at least 1 AP in that color. Then once that color is determined for each team, drain the AP and multiply that amount by the damage to be dealt to determine how much total damage each character takes.
Stare Into the Void was thankfully a quite straightforward ability to implement because we have easy ways to grab specific tiles from the gameboard and then count how many were grabbed. We also have an event that is fired when a character is downed, so we just have it check on Chasm. Once that event is received, we grab all the abyss tiles on the board, count how many are found, and if we find enough: destroy them all, revive Chasm, stun the enemy team, and finally heal chasm. Thankfully, Stare Into the Void is nothing too exotic compared to some abilities/characters.
On the other hand, Empty Inside was the “exotic” ability that took a little bit of thinking to figure out how best to approach the desire for a ramping match damage increase based on AP. We landed on using Average AP to denote a team’s overall AP pool, and ramping the match damage between a minimum and maximum damage multiplier value. Essentially, the ability boils down to 2 interpolations:
– An inverse interpolation for the average AP to determine where it is in the ramp of 0 ~ <Max AP Variable> to get our <AP Interpolation Value> to use in our damage ramp
– A simple interpolation between our <Min Damage Multiplier> and <Max Damage Multiplier> controlled by the <AP Interpolation Value> we just gained to get our overall damage multiplier
The <Max AP Variable> also had an additional stipulation that it would increase per web tile on the board. Since it was already a variable in our algorithm,that wasn’t an issue thankfully!
As far as the math goes, since we only have basic arithmetic on hand to mutate our variables, we had to apply the ramps like anyone would on paper:
Simple Interpolation (Determine Value):
(Max – Min) * Interpolator + Min = Value
Inverse Interpolation (Determine Interpolator)
(Value – Min)/(Max – Min) = Interpolator
So in our first inverse interpolation of the Average AP:
Value = is what we determined Average AP to be for each team
Min = is 0 in this case, the minimum AP we want to consider for the ramp
Max = is our Maximum AP we want to consider for the ramp, so it’s our Max AP value + 1 for every X number of web tiles
Interpolator = is our goal for this equation to use in our next interpolation to determine damage
Our second interpolation for determining current Match damage multiplier:
Min = is our minimum damage multiplier
Max = is our maximum damage multiplier
Interpolator = is our Interpolator we gained from our first inverse interpolation of the Average AP
Value = is our damage multiplier we will then apply to chasm’s matches
Chasm Broke Everyone else
So the main issue that caused Chasm to break everyone else is that most characters use the Battle Started event to perform needed initializations of variables for their abilities. If they didn’t perform their initializations, many oddities can result. Chasm just so happens to also use this Battle Started event to stun the entire enemy team and in some cases potentially his own team if he is up against another Chasm. Stuns prevent the activation of abilities, even through events unless they are specifically marked to ignore stuns. So if Chasm’s stun was fired early before other character’s got their Battle Started event, it would essentially block them from firing those initializations.
To get around this, all affected characters now save a variable out when they run their initialization and check at the start of each turn for that variable. If the variable isn’t the correct value (meaning the initialization didn’t run), the character runs their initialization then instead.
Phew…. I hope you’re still with us after this explanation of our computation acrobatics! As you can see, there are a TON of variables that goes into the development of a new character. One tiny variable can literally break the game in ways we hadn’t originally anticipated.
We hope this insight into how we approach development in MPQ has been something new and interesting. If you liked what you learned today, please let us know and we’ll see about creating more content like this that does an even deeper deep dive into our game’s development.
MARVEL Puzzle Quest is available on the App Store, Google Play, Amazon Appstore and Steam. Click the PLAY NOW button to start your puzzle battle!