Showing posts with label sandbox. Show all posts
Showing posts with label sandbox. Show all posts

25 May 2018

Balancing in Terraria: The Is-State (Part 2)

A few days ago I made a blog post where I went through the mind and thoughts that go and might have gone through the discussion of balancing. We came up with how we wanna put our classes. Now it would be interesting how far we are off. To determine this we have to analyze Terraria's balance.

Analyzing the Balancing

The factors we looked at when balancing were
  • How is the class played
  • How much defense should it have
  • How much damage should it have
So let's look at the defense and damage that Terraria provides us.

PyPlot of Terraria's defense per tier per class
To do this I looked at the defense of each armor for each of the four implemented classes and plotted these numbers using Python and the MatPlotLib module. It does not seem to plot but the x-axis shows the tiers I used. These tiers are: 0 - fresh game; 1 - brain of Cthulu / eater of worlds defeated; 2 - Hell reached; 3 - cobalt mined; 4 - Mythril anvil; 5 - Adamantite forge; 6 - mechanical bosses defeated; 7 - chlorophyte farmed; 8 - Plantera defeated; 9 - golem defeated; 10 - lunar event + Moonlord defeated. To run a little over the numbers the end-game armors that are craftable using Luminate once the end boss the "Moonlord" has been defeated have 78 defense on the melee armor, 68 defense on the range armor, 46 defense on the magic armor and 38 defense on the summon armor. generally, you can see the trend to be that the relation melee > range > magic > summon can be found here again. Which goes perfectly with what we assumed to be the case.


The next information we need to look into would be the damage. Now calculation the damage is a bit tough due to the following reason:
  • Weapon damage numbers are affected by weapons bonuses
  • We have to calculate in critical strike damage and critical strike chance
  • Some items hit multiple times
  • There are buffs provided by the armor set bonus that affects the values
  • Items may deal a lot of damage but have a huge use time or cooldown
Due to all these factors, we need to sit down and actually test the items. Though this has proven to be difficult too due to these reasons:
  • Attacking a target dummy may not provide buffs
  • Target dummies are not affected by homing attacks
  • Target dummies are not attacked by minions
And yet this is our best bet.

Preparing and Running the DPS Test

To prepare the DPS tests I downloaded a mod called CheatSheet, to allow me to get any item in the game without farming it first. I've created a new character and a new map and gave myself the best items available at that moment to my knowledge. I must also admit that I used the star cannon and the coin gun (with gold ammunition). Tests that can be done on a target dummy were done so. I'm assuming only one target dummy that is hit with no rebound. We're assuming a single target flying boss for these. I know technically there should be extra tests for multiple target and etc. but this should do for a simple comparison since single target DPS is required for the most bosses. any other tests for minion masters and magic buffs were done on bosses with only one hitbox. Additionally, I only changed armor and weapons as well as specific ammunition and necessary accessories like the mana flower or multiple worm scarfs (to negate boss damage). The damage number was guessed given the number shown by the in-game item "DPS meter". An approximate number should not do well then comparing the exact math but for a graph to look at it's enough.

PyPlot of Terraria's damage done by classes per tier
Thus due to the circumstances, the damage numbers may run wild if you try it yourself but it should be near with a few exceptions. Anyways as you can see in the graph we have a relation of magic > range > melee = summon.
In comparison our idea of balancing was magic > summon > range > melee. Now we were right with magic being top, though summon damage is much lower than range or melee in the actual game. I must say that I did not calculate any other items. This was just the plain minion damage. If the minion master would use the other classes items his damage would increase but even then it would not be higher than range damage.

Generally, though all the classes seem to be very similar during the progress for the tiers only splitting significantly after the Moonlord. The only difference is the range class which has a huge damage boost when using the star cannon, which requires farming stars during the night and the coin gun which in the damage tests consumes your gold. both these resources should be easily achievable when the time is put into it. Honestly, I am disappointed by the early mage damage and the overall summoner damage in comparison to the survivability.

Conclusion

So, in the end, it turns out we were right with the defense but wrong with the damage.
Now due to the lack of defense on some classes and the low damage output of them, it doesn't surprise me anymore that I preferred to play tanky melee all the time. You deal almost the same amount of damage compared to the others. Of course, there's no 20% more damage potion for melee or there is less damage increasing accessories for melee, but with that defense difference, I don't know.

I guess in our modding plan we need to mush the damage of a few classes. :P


22 May 2018

Balancing in Terraria - Part 1

Balancing in video games is a delicate topic. I've been playing Terraria lot lately - especially modded. I've also started to create a mod with a friend of mine and we're planning on adding new classes and new end-game progression, which requires balancing as well.

First: What is Terraria?

Before going into details let's inform everyone what Terraria is. I don't want to go deep into detail on this one so let's fill you in this way: Terraria can be considered a 2D version of Minecraft in a limited world with a higher focus on equipment progression, much more underground layers and an adventure type of feel with a few elements of hack and slash sprinkled in. At least that's my definition of Terraria.

Basically you start off in a world with a copper pickaxe, short sword, and axe and you have to get new resources, defeat bosses to get better equipment, like mining utilities, armor, weapons and so forth, which increase your stats like maximum health, mana, damage, critical strike chance, critical strike damage, attack speed, life regeneration and more. Of course, you can build houses and other stuff though more enemies are traveling the world than in games like Minecraft, so your building may be interrupted by a horde of zombies and flying eyes at night or slimes at the day.

The Classes

Classes in Terraria are not chosen at the character creation. Instead, they are determined by the items, armor and other equipment you use. Playing Terraria you may come across three to five classes. These classes are categorized by the damage types and the boost given in the game.
  • Melee Damage
  • Range Damage
  • Magic Damage
  • Summon Damage
  • Thrown Damage
Though, you may find some inconsistency between classes. This is because the summon class was added later in development and the thrown damage class was discontinued or abandoned. The reason for the latter is the similarity to range. The former is noticeable as there are hardly any - if at all - summon items in the early game.

Balancing Procedure

So we have five classes now and the easiest way to balance these would be to make them all equal. Ah, that would be too simple. I said balancing is a delicate thing. If you make every class equal, good job you balanced it mathematically, but it's no fun. Games are all about fun, even if it's in weird ways sometimes. Well, our classes should be different. Going by common logic and our three main classes we have a melee that most likely needs to be near enemies and bosses most of the time a ranger that stays at a distance and has to aim whilst consuming ammunition and last but not least a mage or wizard that uses mid to far distance high damage weapons whilst consuming a rechargeable resource.

Applying the Definition

Step 1: Create a Basic Relationship of Defense

By the definition of our melee class, they'll need a lot of defense as they're near the opponent and most likely to get hit. In comparison, the magic and range classes can avoid any contact with the opponent if their maneuverability is good so they don't need that much defense. So, let's check our current state.

Defense: Melee > Range = Magic
Damage: Melee = Range = Magic

Step 2: Build on the Basic Relationship

Another thing we defined is that magic damage is the highest of all in nearly all games, unfortunately, this comes at a cost. For a mage or wizard to be strong they need to be able to use their spells and mana most efficiently. This requires certain clothing, that is light and can be easily imbued. At least that's a common belief, so, let's go with this! We increase the damage of the magic class, decreasing the defense at the same time to keep it balanced.

Also, we're putting range above melee as range has it harder to hit the enemy, due to aiming.
 Our new state is:

Defense: Melee > Range > Magic
Damage: Magic > Range > Melee

Keep in mind this is just an approximation. Even though balancing via formulas and calculation isn't all, it still helps a lot when balancing details.

Adding the Other Two Classes

Step 3: Adding Our Thrown Class

Don't forget about the thrown and the summon class! These are very specific so we have to go with what is in Terraria to get an idea of how they were planned or implemented. The thrown class uses consumables that can be thrown and ammunition consuming items to throw a gravity affected object. Additionally, there are thrown weapons that have been assigned to the melee class instead like infinite daggers to throw, lances and boomerangs and similar. Something noticeable here is that all thrown items do not allow for a distance that's as far as the range class. This limit plays a huge role. We're dealing with a mid-range class. As such they need either more damage to compensate for damage taken than the range class or more defense. Giving them increased damage instead of defense allows for a hit and run styled gameplay that may match something like a ninja, so let's go with that.

With our relationship updated:

Defense: Melee > Range > Thrown > Magic
Damage: Magic > Thrown > Range > Melee

Step 4: Adding Our Summon Class

The way the summoning class has been introduced into Terraria makes it tedious to balance. A summoner uses the same resource as a mage but only once per summon - on the same note: Summons have no time limit, they age until you die or dispel it by right-clicking. They can summon up to 9 or 11 minions depending on the platform you play on and whether or not you use buffs. The problem here is the balancing of the armor. Let's illustrate the issue mathematically...

Natural Diminish Returns on Summoner Minions
x-Axis: Number of MInions
y-Axis: Damage increase in %
If you have a summon weapon that deals 24 damage and you summon one minion you deal 100% damage. That's the base damage. If you summon another minion you have two that both deal 24 damage so in total 48. That's 200% - your damage has been doubled. Now with the next minion, you deal an additional 24 damage, that's 3 * 24 = 72 damage. This is 300% of the damage compared to one minion but it's only a damage increase of 50% since we had 48 damage with two and got only half, 24 damage, with the third. 

This behavior should be familiar to people who know this or read this blog for a longer time. The behavior is called Natural Diminishing Returns. Basically the more you get the harder it is to keep on doubling the effect. I'm not going into detail on this here, but the graph to the left shows the behavior.

By the way, the point where the increase is half of the 100% damage you should check if you find any damage bonuses that give higher damage increase. For example, if you have four minions your next minion will increase your damage by 6.25%. Some armors give nearly or more than that. 

Another factor is that while the minions do the job the summoner can use other weapons in the meantime. This further increases the damage. At the same time since those minions are taking care of the enemy automatically, the summoner can focus on dodging and avoiding attacks. Thus they don't need as much defense as the magic, melee, ranged and thrown classes need. Additionally, due to the advantages, I mentioned here the damage should be far lower per single minion. The total damage should be lower than the magic class, as they aren't forced to embrace the enemy, but with the low armor, it should be higher than the rangers. Also, the minion attack range plays a role here. From what I've seen in Terraria it is about mid-range.

Phew, so, this gives us this relationship:

Defense: Melee > Range > Thrown > Magic > Summon
Damage: Magic > Summon > Thrown > Range > Melee

Preview

Now we've got the basic relation between defense and damage of the classes done. In the next post, we're going to compare the actual in-game defense and damage to check how the balancing has been done in-game and where breakpoints and power spikes are hidden. Additionally, we're gonna compare and assume where the thrown and beginning of the summon class should be.

Until then, GreenyNeko, out.



23 January 2018

Minecraft: Player Velocity

Still, remember Minecraft? The blocky game that sold minions? I've decided to do some theorycrafting on a different game this time. Just to throw something into the mix. Since I've been very hyped about velocity in the past days.

The Same Like Before

No! Let's do it differently! Well... we're still forced to do the calculation the same basically. The easiest way to determine the velocity is by using the formula in physics. Velocity equals the distance done per second. So the easiest way would be to determine the distance and the time and calculate velocity that way. I still wanna do things differently than before so instead of using my stopwatch I'm using Minecraft's features.

Getting the Value of the Variables

This is some common knowledge but if you didn't know yet you know now. In Minecraft, each block has a size of 1-meter times 1 meter. Using this we can easily determine the length of a distance by counting blocks. It's as easy as it sounds. For the time we're gonna do something different. The best way to get the time is by using the in-game time system. Minecraft has a day and night cycles that are 20 minutes long or 24000 ticks. Using the time command we can determine the current amount of ticks of the day:
  /time query daytime  
However, this will probably return some number between 0 and 24000 depending on what time of day it is. So we need to reset this count to a value that makes it easy for us to calculate the difference. Of course, we could use the query command twice and subtract to get the value but that makes things more complicated. Using this command we can reset the ticks of the day back to 0:
  /time set 0  

Building the Experiment

The next step is building the experiment. For this, we will build several blocks in a straight line and place redstone signals to the start point of the measurement and to the endpoint of the measurement. I did this for a normal line for us to walk and run on and another one for minecarts on a boosted railroad. counting the blocks between both results in 41 blocks or 41 meters in my case.

For our detection mechanic, we're gonna use a classical tripwire trap using string and tripwire. Once something walks upon it these tripwires will set off a redstone signal. We're going to use this signal to power the first command block that is going to set the time to zero ticks. At the end of the path, we place another one of these that will send a redstone signal to the other command block which will query the current time. This way we can determine the time it took us from the first tripwire to the second tripwire.

For the mine carts, we're going to use a detector rail instead. Detector rails send off a redstone signal when there's a  minecart on them. Just like the tripwires, the first detector rail will send a redstone signal off to the first command block resetting the number of ticks to zero. Another detector rail at the end will send off a redstone signal to a command block that will query the current amount of ticks that have passed.


And Now The Best Part About Experiments

Nothing is better than executing the experiments. Even though it's more fun when things blow up.
So for our player movement and riding movement, we simply run over the first tripwire until we reach the other tripwire. So let's see how long it takes me to walk this. It took me 195 ticks to walk this. How much time are 195 ticks? Using the Minecraft Wiki we know 1000 ticks equal to 50 seconds. That means 1 tick is 50 / 1000 = 0.05 seconds. So in our case 195 ticks are 195 * 0.05 = 9.75 seconds. So we did 41 meters in 9.75 seconds. That's a movement speed of  41m / 9.75s = 4.21 m/s.

Next up let's run our stretch. This time I got 150 ticks. Going through our calculation again we have 150 * 0.05 = 7.5 seconds. So we did 41 meters in 7.5 seconds. Now we're running with a  41m / 7.5s = 5.47 m/s.

Let's Move On With Riding

First the most fabulous of all the ridable animals. The Pig. Get a pig, put on a saddle, get out the stick with a carrot and off we go. This amazing gracious animal maxes out at an unbelievable time of 346 ticks. That's a whole 346 * 0.05 = 17.3 seconds. So the pig puts on a surprising amount of 41m / 17.3s = 2.37 m/s.

Let's better go into the opposite direction of the movement speeds. Spawning a horse and taming it we can run our stretch taking a time of mere 73 ticks or 73 * 0.05  = 3.65 seconds. That's a whole 41m / 3.65s = 11.23 m/s.

Now it also would be interesting to know if the other horse types have the same or nearly the same speed so let's check them out.

Going with a mule the time I reached was 127 ticks or 127 * 0.05 = 6.35 seconds.  So the mule did me a 41m / 6.35s = 6.46 m/s.

The donkey gave me a time of 114 ticks or 114 * 0.05 = 5.7 seconds. So it did a 41m / 5.7s = 7.19 m/s.

I also figured out pressing the run key must do something on mounts and well... the times are the same. So aside from changing the camera view and looking fancy holding the run key does not increase your speed at all.

Last Animal: The Mine Cart

What do you mean the mine cart is not an animal? I bet one can somehow craft together a theory explaining mine carts to be animals, but that's not our topic. Let's check out our minecart track, time and speed. I've built some more boosters before the first signal for the mine cart to reach the maximum speed before the first detector rail. So I'll take back at the beginning and place the cart there. Let's see what the times gonna be.


It's 105 ticks. That's 105 * 0.05 = 5.25 seconds over a distance of 41 meters. We got 41m / 5.25s = 7.81 m/s.

Bonus Experiment: Ship

Decided to add an additional bonus experiment. The concept is the same as without first track but on water now. 


We have to start a little earlier than our first checkpoint to reach maximum speed before. We need to do this to prevent the acceleration to inflict an error on our time. I made sure it's again 41 blocks so let's see what the time is.

It's 106 ticks. Nearly the same as the mine cart. That's 106 * 0.05 = 5.3 seconds over a distance of 41 meters. So that's 41m / 5.3s = 7.74 m/s.

No, mph?

Yes, no mph. Instead, you get this bonus experiment with the ship. If people really, really want me to do mph here I'll do it but for now, bare with what you get. It's not that hard to be like "7.74 m/s in mph" on google. :P



05 December 2017

Purpose of Life Defined by Genre

The philosophical question of "What's the purpose?" has been asked for thousands of years. But maybe we can answer this question by looking at genres of media created by us which matches real life the best. Any media that is created by us is categorized by genre. From books to videos, to games.

So What Genres Are There?

For books there is:
Satire, Drama, Action And Adventure, Romance, Mystery, Horror, Self help, Health, Guide, Travel, Children's, Religion, Spirituality, New Age, Science, History, Math, Anthology, Poetry, Encyclopedias, Dictionaries, Comics, Art, Cookbooks, Diaries, Journals, Prayer books, Series, Trilogy, Biographies, Autobiographies, Fantasy...
For movies there is:
 Film, Horror, Action, Drama, Thriller, Adventure, Romantic comedy, Animation, Western, Fiction, War film, Film noir, Science fiction, Family, Romance, Documentary, Music, Historical period drama, Biographical, Disaster, Crime, Slasher, Melodrama, Fantasy, Art, Chick flick, Black comedy, Heist, Mockumentary, Anime, Superhero, Spy, Comedy horror, B movie, Coming-of-Age Fiction, Screwball comedy, Peplum, Silent, Parody, Mystery, Spaghetti Western, Neo-noir, Experimental, Indie, Comedy, Musical, Action/Adventure, Bollywood, Satire...
And for games it is:
Action: Platform, Shooter, Fighting, Beat-'Em-Ups, Stealth, Survival, Rythm; Action-Adventure: Survival Horror, Metroidvania; Adventure: Text adventure, Graphic adventure, Visual novels, Interactive movie, Real-time 3D adventure; Role-playing: Action RPG, MMORPG, Roguelikes, Tactical RPG, Sandbox RPG, First-person party-based RPG, JRPG, Choice oriented, Fantasy; Simulation; Strategy, Sports; Idle Games...
 And that's just a bunch, there are probably more.

Which One Matches Life?

So, which of all these matches life? Coming to think about it. Doesn't life include all or like a lot of those? We all have been scared by our child's fantasy back when we were young. We all enjoyed laughing together about a joke. We all have seen or learned about the history and much more. So we're not making progress here. Let's take a different approach to this.

What's the purpose?

Each genre follows a certain purpose. They might want to tell a story in a certain staging, criticize humanity and morality, get your adrenaline rolling or getting you to think about things. One genre that's particularly interesting here is a sandbox. Why? Sandbox games have no purpose! Wait. A game with no goal? How does that even work? Oh, it works, and it works well. If you have ever heard about Minecraft it's a sandbox game aside from having achievements and bosses that guide you. Additionally, if you've played it, you probably already know that at some point the only way to go on is to create your own goals and additional rules, creating challenges, getting creative and life is similar to this. Of course, you're guided by the school system, application system followed by working at a company. However, you're not forced to go this way or do this, you can do what you want. But it may not go the way you want and you might have a bad time. In the end, you can create your own goals and challenges in real life and Minecraft alike and you might have consequences respective to your behavior in both as well.

So Life Is a Sandbox Game?

Alright, life's a sandbox game, guys! Hold it! Not too fast! You can't say for sure it is. Philosophy lets us think about how or why things in life are as they are as well as allowing you to live by it. (like "Hakuna Matata" for example)

From the definition of the word philosophy:
"the study of the fundamental nature of knowledge, reality, and existence, especially when considered as an academic discipline."
"a theory or attitude that acts as a guiding principle for behavior."

So What Can I Take From This?

If you're seeking the purpose of life. Instead of falling into despair seeking to make your purpose, make your own goals. In the end, it's your life and you should be able to do whatever you want. However, keep in mind the rules still apply just like in sandbox video games and you're not the only player. The result is to play with everyone together supporting each other's goals and finding compromises when not getting along too well.

Or maybe this all doesn't matter because we all unconsciously fabricate life together as we experience it. But that's a different topic entirely. :P

About Me

My photo
I'm a M.Sc. Games Engineer and I created this blog to share my ideas, theorycrafting, thoughts and whatever I'm working on or doing.