Not All Ores Are Created Equal
I’ve been playing Terraria for about a decade now. And despite playing this game for as long as I have, I constantly learn new facts and mechanics about this game. And recently, while scrolling through the Terraria wiki, I learned something I hadn’t known about in the most unlikely of places. Oes. Now, in Terraria, there’s a whopping 21 ores in the game with the general progression looking a little something like this. And if you’ve ever played Terraria before, you’ve probably picked up by now that certain ores are interchangeable with others, but both cannot generate in the same world. for example, copper and tin, iron and lead, silver and tungsten along with gold and platinum and free hard mode along with the three tiers of hard mode ores, but we’ll be getting back to those later in the video. While I’ve always known that different ores are interchangeable with each other, I never really thought about how the game decides which ores it should generate with. I mean, it can’t be a coin flip upon generation since the same world seed will always have the same preh hard mode ores. So, how does the game do it? Well, with math, of course, but not any math equation. this math equation. Okay, so this equation may be a bit confusing and maybe even a little intimidating considering that there’s not only several really large numbers in a handful of letters, but an entire word smack dab in the middle. But if you take a moment to just take it all in, it’s really not all that bad. So, let’s break down this equation in a way that makes it more digestible. First things first, let’s understand what these terms mean. In this equation, S simply stands for your world seed, an integer between 0 and 2 bill147,483,647, otherwise known as the upper end of the 32-bit integer limit. Next up, F and C are just constants taken from this table for each ore. So if you want to know if your world will have copper or tin, you just substitute 1 bill582,116,761 in for F and 626,863,973 for C. Okay, now that we’ve covered the first three terms, let’s talk about mod. Now in mathematics, mod stands for the modulo operator, which essentially pays zero attention to the quotient in a division problem and focuses solely on the remainder. For example, 5 mod 2 would be equal to 1. Since 2 goes into 5 twice, leaving one behind as the remainder. So in our equation, you would divide the number inside the parenthesis by 2 bill147,483,647, which is again the 32bit integer limit. And if the result is greater than 1 bill73,741,823, then the equation is true. Meaning the world will generate with the default or respective to which constant values you used. Meaning that if you want to know what all four ores your world is going to have, you’re going to have to do this equation four separate times. So, let’s do a quick example. Right now, I’m about to create a new world with the seed being 1 bill253,841,412. And if we plug this number into these four equations, solve inside the parenthesis, and then divide this number by 2 bill147,483,647 in order to find the remainder, which by the way, I use calculator.net’s big number calculator to do this. we get the following result. When deciding whether we get copper or tin, we get a mod result of 1 bill523,755,990, which is larger than 1 bill73,741,823, meaning we’ll have copper. For iron or lead, we get 1 bill675,418,331, meaning we’ll have iron. For silver or tungsten, we get 2 billion 31,225,615, meaning we’ll have silver. And for gold or platinum, we get 1 bill885,650,630, meaning we’ll have gold. And sure enough, when we join the world, we have exactly what we predicted. Now, even though the game isn’t actually flipping a coin to decide which ores will generate in each world, because again, the results are directly dependent on the world seed. You still have essentially a 50/50 chance to get any of these eight ores in any given run. However, despite these ores being interchangeable with each other, they aren’t actually treated equally to one another, as the alternate ores will always be better than the default ones with armor giving more defense, weapons more damage, and tools overall being more powerful. But these are just the ores from preh hard mode. So, what about the hard mode ores? Well, first of all, unlike the prehard mode ores, the ores that generate from breaking alters isn’t predetermined when creating a world, but is actually a 50/50 chance in the spur of the moment. However, once your world is blessed with any of these ores, you will not be able to get the opposite ore to generate. So, if you get cobalt, you will not be able to get palladium. Also, much like the preh hard mode ores, certain hard mode ores are better than their counterparts. However, the most interesting thing to me isn’t any of these details, but rather the generation process. Now, as we all know, breaking alters upon entering hard mode will cause three tiers of ores to generate. However, the amount of ore that generates isn’t random, but rather the game uses yet another calculation. this one being well a little complicated. But All right, so just like the previous calculation, which looked a little daunting at first glance, this one can be rewritten in a way that makes it more comprehensible. So let’s understand what’s going on here. First off, we have the world size. And to calculate the world size for this calculation, we’ll be dividing the width of a TRA world by 4200. So for a small world, this number would be 1. For a medium world, 1.524 and two for a large world. Next up, we have the ore tier. This, of course, being the three tiers of ores that you can get from breaking altars. However, instead of starting at one for global and platium, the order goes 0 1 and two. Next, for the division section, we have what appears to be the number of altars destroyed divided by three with the result having one added afterwards. However, that’s not the case as these brackets aren’t actually parenthesis, but rather a floor function, meaning the value inside will always be rounded down to a whole number. So, if this value was not.33, as it would be should only one ultra be broken, the value would be rounded down to zero. But if the number was not 666, such as the case as two alters being broken, it would still be rounded down to zero with the plus one added afterwards. Lastly, we have the factor with this number being taken from this chart right here. 1.05 for cobalt, one for myithil and adamanti each, 0.945 for palladium, and 0.94 oracical and titanium. And once you plug all these numbers into the equation, we can see the number of ore veins that generate for each ore. But wait a second, why are the number of veins different for each ore, even if they’re from the same tier? Well, looking back at the factor variable, we can see that palladium or Kelkum and Titanium, the alternate ores, have a frequency 10% less than that of the default ores. Meaning that if your world has the alternate ores, you’ll have 10% less ore than a world with cobalt, mithril, and adamantite. However, since the alternate ores are also the stronger ores, this honestly seems rather balanced, all things considered. So yeah, ore generation in Terraria is strange. It’s complicated, involves a ton of math, and we almost never consider what’s going on behind the scenes. And honestly, I think that’s one of the positive aspects of a game like Terraria. Have the players be immersed in the world in action and have the game run seamlessly in the background so as to not break the immersion. And as a content creator, I respect that as I try to do the same thing with my videos. All the cuts from scene to scene, the change in music, the animations, and sound effects. If you do a good enough job at the end of the day, nobody will notice a thing since it all feels so natural. But anyway, that’s all I really wanted to talk about today. Just a wacky game mechanic I recently learned about and thought was interesting enough to make a video on. I very much for watching and I’ll see you in the next one. Bye.
Ore generation in Terraria is very strange- so today I decided to dive into this mechanic to see just how the game decides which ores to generate with, along with why and how certain ores are better than others from the same tier.
If you like this video, I’d highly appreciate it if you were to subscribe, along with turning on the notification bell so that you’re notified whenever I post another video.
————————————————————————————————————————–
♦DISCORD♦
If you are interested in joining my community Discord server to interact with the community, ask me questions, or just to hang around, please join using this link:
https://discord.com/invite/3v7AYDQcKk
————————————————————————————————————————–
►MEMBERSHIPS◄
While I don’t want to beg for any donations, if you want to help fund these videos, please consider becoming a channel member on either YouTube or on Patreon*
YouTube Memberships: https://www.youtube.com/channel/UCNYeCLwdCGRFujb0m85-l6w/join
Patreon: patreon.com/Crispylink
————————————————————————————————————————–
40 Comments
Very well made video. not too long and well explained. Thank you. definitely subscribing!
Really interesting video! caught my attention wish you luck 💥
Funny you say that titanium is better, because i like adamantite's more because of the set bonus.
I like frogs. Not all frogs, but some frogs. They're pretty cool I think.
I would very much enjoy a series of stuff like this
6:58 except that titanium armor is weaker than adamantite… 🙁
yer like heppe but terraria?
mrth
going to show this to my brother tomorrow morning because hes doing maths at college meanwhile i got a C in my maths gcse and the only part of this video i understood was like and subscribe. goodnight
PLEASE do more like this. As someone who only does hard shit in video games, I love challenge runs. But I also love math, and technology, and these videos really make me happy. Your a great YouTuber, keep it up
It's worth noting that in addition to the 1.2 hardmode ores being rarer in generation than the 1.1 ores, most of the recipes involving their requisite bars are also 1-3 bars more expensive. I personally think this difference is particularly stark with Mythril vs. Orichalcum, since the anvils have equal value and the Orichalcum armour is very hard to call better than Mythril. You invest (albeit marginally) more time mining for a worse result, arguably.
why is there 3 seconds of subtitles at the start
Also the hook is "not all ores are created equal" yet we dive straight into random math about how they get picked and conclued that it's a seed determined 50/50….. which is about what i would expect and it makes the video rather boring. Maybe a better way to present it would be to START with hardmode ores and saying that you get less of "new" hardmode ores, then explaining why, then looking at regular ores, and then finishing the video? idk.
fantastic
this was a very good video. I enjoyed it well.
When discussing math, once you explain WHAT a number is, you can call it by a name instead of saying it's full value lol. Or alternatively, if you have a reason to say full numbers, give that reason at the beginning of the math. like "I'll be reading out the numbers in full, because blah blah. Okay let's get started."
mrth
Wait i thought it depended on which corruption you're doing
Hey, what's the outro song you use? I can't seem to find it anywhere. Thanks
I’m pretty sure Crispy Link has a chance to spawn a lava block when you mine it
It may have been easier to explain the ore selection equation as just being pretty much a really complicated way of checking if the result is odd or even.
there is exception of drunk world which has all the ores available
their amounts and ratios is a different thing
Minerals
4:20 Based use of the squash from PvZ 😎
This was cool to learn✨
After watching, I gotta say, Indeed not all ores are created equally
First video of yours I’ve seen and honestly really interesting
According to the thumbnail there’s a 0.99% chance you won’t get either ore
nice
Who woulda guessed I've be learning math in a terraria video. I mean it's better then the shit they put us through school for.
mrth
it should be noted that looking at the numbers in base 10 like that is wrong. you need to look at them in base 16, aka hexidecimal
i dont feel like checking but i imagine whats going on there is `random() > (0x7FFF_FFFF + ore_bias)`, where random produces a number between 0 and (1^32)-1
which is essentially the same as asking "is this random number between 0 and 1 greater than 0.5 + ore_bias "
so. a slightly unfair coinflip
cuul
Nice vid
Really well done video, really puts ore generation in a more digestible way for people who aren't programmers.
As a bonus, heres an extra fact about hardmode ore generation:
For drunk worlds, when smashing an altar, the chosen hardmode ore of the previous tier will be flipped to the other ore. This allows all hardmode ores to be obtained in drunk worlds.
Although, due to an oversight in the code, this isnt what happens for adamantite/titanium.
The adamantite choice from altars is cycled every altar smash. This means when breaking any altar in a drunk world, it flips the adamantite chosen for the world rather than only when cobalt is broken.
Since it takes 3 altars to cycle back to adamantite, the ore generated will always been the opposite of the last. But when talking to the guide after smashing an altar giving the mythril ore generation and no mech bosses have been defeated as well, this means the guide will talk about the adamantite ore generated last, rather than the ore coming up in his help text.
All info is based on the following methods (for modders/programmers wanting to see this in the game's code):
WorldGen.SmashAltar(int, int)
Main.HelpText()
Very "classic game theory" vibes. Is that the inspiration? If yes, then a very fair one and a good video in this style, really!
Mayo
This is an interesting video, but I do feel it could have been condensed all the way to 6:41, which is where the actually new information is. Still, I have to commend you for pronouncing every single on of the numbers. Full commitment to the bit on an almost completely useless topic, which is my FAVORITE type of video
I am genuinely amazed by the seamless crisp editing on this video and the beautiful builds and theme are mind blowing!
sick video it reminds me of video game
mrth
a general difference between hardmode ores is that one set of them is just plain stats bonuses, plain and simple weapons and gear
with some classes caring a lot more about that then about the wackier effects
like ranger for example does care more about raw stats of adamantium then titanium giving them a bunch of orbitting shredding shards
I clicked on this video expecting yet another explanation of why some ores are better than others
I came out confused by numbers which I cannot understand
10/10