Artemos

allomancy
Making a Mistborn Video Game in Unity – Physics & Math of Allomancy

34 posts in this topic

Edit 3:

Here's a quick look into my most recent progress - labels over targets, a more detailed HUD, and several physics tweaks.

I'll edit what I can from the original post, but there's a lot of physics discussion in the replies that I highly suggest you read.

Jofwu and I've discussed other possible relationships between Force and Distance, and there's a bit of a strange one that he came up with a while ago:

  • Allomantic Force ∝ e ^ -d/D where d = distance and D = 16
    • When the target is right next to the Allomancer, e ^ -d/D approaches 1 and the AF approaches its maximum.
    • When the target approaches an infinite distance away from the Allomancer, e ^ -d/D approaches 0 and the AF approaches 0.

This strategy looks very similar to the linear relationship but avoids its icky discontinuity at the max range of the push. I like it a lot.

For comparison, you can see all three Force-Distance relationships together here.

Edit 2:


Following Jofwu's footsteps, I had a conversation with /u/Phantine on reddit and am reconsidering how distance affects the Allomantic Force. I was originally confident in an inverse square relationship between Allomantic Force and the distance between the Allomancer and target, but through testing, a *linear* relationship has better handling and feels more reminiscent of Allomancers' movements in the books. I've added both as options in the game:

  • The Allomantic Force is proportional to the inverse of the square of the distance between the Allomancer and the target
    • When the target is right next to the Allomancer, the Allomantic Force approaches infinity.
    • When the target approaches an infinite distance away from the Allomancy, the Allomantic Force approaches 0.
  • The Allomantic Force decreases linearly with the distance between the Allomancer and the target.
    • When the target is right next to the Allomancer, the Allomantic Force is at its maximum.
    • When the target is at the max range (arbitrarily at 50 meters), the Allomantic Force is 0. 

 I've also added the option to control the strength of your push through two control schemes:

  • The player sets the *percentage* of the maximum possible force they can push with, or
  • The player sets a *constant force* to try to push at, if possible.

Edit 1: 

If you want to play the current build of the game, you can find it here on my GitHub.

Aside from that, I've looked back at [8], @digitalbusker's post and see I misunderstood it a bit. I've re-read it and realized that I agree with it much more than I thought I did originally. In one paragraph, they said, 

Quote

If you'd like a pseudo-concrete framework for thinking about this, imagine that the blue lines you see while burning Steel are tangible to the things at either end of them. Normally they are happy to simply change length to remain in contact with their endpoints, but when Pushed or Pulled, an Allomancer pours some Investiture into them and makes them grow or shrink with some amount of power. The line doesn't care where its center winds up, or how long or short it winds up being, it just knows how hard to push, and the end that resists less will be moved farther than the other.

This sounds just like the Allomantic Normal Force idea I used in the game. If you push on a target and the target can't move, the target pushes back on you as if there were a long, tangible line between you and the target. In this way, the ANF does work somewhat like an elastic collision.

I did some more testing in the game and anything that involved directly manipulating velocities of the target or Allomancer worked poorly. I feel like sticking to forces rather than energy is the right way to go.

 


Table of Contents

I: Introduction
    I-a: My intent
    I-b: Current game progress & Videos
    I-c: Referenced forum posts
    I-d: Definitions
II: Force, mass, and acceleration of a push
III: Anchors and the pole analogy
IV: Math
V: Summary & Final points


Part I: Introduction

Over the summer I’ve been rereading Mistborn and have been thinking about the mechanics of Allomancy. I decided to have a go at recreating the physics of Ironpulling and Steelpushing in the Unity physics/game engine. I don’t intend on actually creating a game to sell (that’d be a bit illegal), so this is mostly an endeavor for personal fun. What follows is my current progress on the game as well as my current thoughts on the math and physics of Pushing and Pulling.

Part I-a: My intent

My goal is to take what Brandon describes in his books and do my best to create a working model of them in the Unity engine. My purpose in posting this here is to record my thoughts so I can be internally consistent, encourage discussion, and improve the game’s mechanics with your suggestions and criticisms.

I don’t expect to perfectly recreate Allomancy as Brandon describes it in the books because there are some things with little connection to real-world physics (such as Feruchemical weight). I’ll try to give the pros and cons for all my decisions. If you disagree, tell me! I’ve been in my own personal bubble while making this, so I’d love some external input.

Part I-b: Current game progress & Videos

So far, I’ve implemented most of the physics and fundamentals of Ironpulling and Steelpushing. Here are some short videos:

  • The setting: The sandbox I use for testing is based on Luthadel. There are metal poles stuck in haphazardly-placed buildings, and a few windows with metal frames/latches. At the intersection are metal objects of various masses, including coins, ingots, and 16-ton steel blocks.
  • Blue metal lines: When the player (the grey sphere) begins passively burning metal, they see blue metal lines pointing towards nearby metal sources. The wider the line, the heavier the metal, and the brighter the line, the closer the target.
  • Basic pushing/pulling: The player can “target” a metal. They can then push or pull on that metal. They can increase or decrease the strength of the push, as indicated by the wheel near the bottom. They can target multiple metals simultaneously (as indicated by the bright blue number beneath the wheel).
  • Pull targets vs. Push targets: The player has separate targets for pulling (indicated by blue) and pushing (indicated by red). When the player pushes or pulls with specified push targets and pull targets, the player only pushes on the push targets and only pulls on the pull targets. If the player only has pull targets or only has push targets, they can push and pull on any target.
  • Pushing/pulling with coins: The player can throw, drop, and pick up coins. The number in the lower right corner indicates the number of coins in the player’s pouch.
  • Flying around Luthadel: It’s a bit tricky, but the player can fly between buildings by pulling on metal latches and pushing on coins.

Some things are still a bit buggy, namely the camera, coin physics, and width of the white part of the blue/red line pointing at a target while pushing.

Part I-c: Referenced forum posts

Many of the ideas used in the calculations come from the work previous Sharders have done on making sense of Brandon’s magics. Here are some that I used, which I recommend to anyone interested in the physics of Allomancy:

When I use specific ideas from these threads, I’ll mark it with a [#]. Other threads I found interesting:

Spoiler

Part I-d: Definitions

Key statements are italicized. Key terms are written in bold for their first appearance.

  • Push – unless I specify otherwise, I’ll simply say “push” instead of “push/pull” to refer to the math of both steel and iron. It’s a lot easier to read while still means the same thing. All physics and rules of a pull are the same as a push, just in the opposite direction.
  • Target – the metal that an Allomancer is currently pushing on. Coins are often a target.
  • Distance – the distance between an Allomancer and their target.
  • Anchor/anchored – a target is an anchor if it does not move. A lamppost, a coin stuck on the ground, and a metal roof would all be anchors. Note that the metal is the anchor, not the nearby wall/ground/stone. A target is unanchored if it is moving freely with no resistance. A target is partially anchored if it meets some resistance but is not fully anchored (i.e. a coin skidding on the ground).
  • Allomantic Force (AF) – the force that an Allomancer directly exerts on a target while pushing. Equal in magnitude to the force that the target directly exerts on the Allomancer while pushing. The Allomantic force does not change if the target is anchored or unanchored.
  • Allomantic Normal Force (ANF) – the force that is exerted on an Allomancer or target as a result of the opposing target or Allomancer's push or pull by the surrounding ground, walls, etc. I'll discuss this down below. Essentially, it's what makes anchored targets give that extra strength to your push.

Now, let's jump into the physics of Allomancy.


Part II: Force, mass, and acceleration of a push

When Allomancers in the books refer to “weight,” they almost always mean mass. [1] Let’s ignore Feruchemical weight for now.

When an Allomancer pushes on a target, the Allomancer exerts a force on the target that is equal and opposite to the force that the target exerts on the Allomancer.

It’s F = ma, it’s Newton’s third law, and if anything else were the case, the physics of Mistborn would be far too distant from our world for a good simulation. This explains one of the core features of pushing and pulling: If you push on an object heavier than you, you will accelerate more than it (and vice-versa).

You push on a coin out in front of you. The force is the same between you and the coin, but the coin has less mass, so it accelerates more than you. The coin goes flying, but you hardly move. Likewise, heavier objects (like cars) have more mass than you, so you accelerate more than them.

The previous statements are most apparent with an Allomancer and target in free-fall or space, where the Allomancer and target (such as a coin) won’t be anchored by anything (such as the ground). When the Allomancer or target are anchored by a wall or the ground, things get complicated.


Part III: Anchors and the pole analogy

In the books, if an Allomancer is falling through the air, throws a coin downwards, and starts pushing on it, the Allomancer doesn’t feel much while the coin is falling through the air and unanchored. The Allomancer pushes on the coin, but their acceleration from the push is not enough to stop their fall. Once the coin hits the ground and stops moving, the Allomancer suddenly “can get a stronger push” and decelerate more strongly.

Here is my interpretation: Pushing against an anchored coin on the ground has a similar effect as holding a long pole and physically pushing against the ground.

The Normal Force due to the Allomantic Force (Allomantic Normal Force, or ANF) that the ground/wall/etc. exerts on the target is transferred to the Allomancer.

If you held a long vertical pole and pushed down on the ground, the ground would push back on you and the pole. If you tried to push the pole into the ground, the ground would resist, and you could climb upwards relative to the ground. Allomancy mimics this effect. When pushing on the coin, it is like you are physically connected to the coin. If something resists your push, you experience that resistance. It's just like you're literally pushing against the coin with your fists. If the coin's in the air, hardly anything happens. If the coin's on the ground, the ground resists.

I drew some free-body diagrams that hopefully help explain what I’m saying. In these, an Allomancer and coin are falling down. The Allomancer is pushing on the coin.

Let me discuss two of the other theories as to how Allomancers get stronger pushes from anchored targets:

  1. When the coin is airborne, the allomancer is only pushing on the mass of the coin. But when the coin is anchored to the planet, they are also pushing on the mass of Scadrial/the ground around the coin, which causes the Allomancer to accelerate more. [not a quote, but the concept taken from 1]
    • I’ll get into how mass affects the force later in the math section, but I want to now make something clear. With my interpretation, Allomancers push on the mass of metal, not the combined mass of metal and nearby non-metal (the planet). When pushing against an anchored coin, the Allomancer is only indirectly pushing on the ground – they are pushing on the coin, which pushes on the ground, which resists back on the coin, which resists back on the Allomancer – similar to holding a long pole and pushing on the ground.
  2. An Allomancer’s strength is the amount of kinetic energy they can add to the system of the coin and allomancer. When the Allomancer pushes on an unanchored target, that kinetic energy is distributed between the two, proportionally to their masses. But, when the target is stationary, their velocity is zero, so all of the kinetic energy is given to the allomancer (and vice-versa). [paraphrased from 8]
    • I like this explanation. Honestly, I may agree with it more than with my own ANF theory. I tried it out, but it was a lot more difficult programming-wise than the ANF idea. Unity has easier force manipulation than energy manipulation, so I framed my theory using that. Energy is just force with extra steps. (See Edit 1)

I’ll talk more about the Allomantic Normal Force and partially-anchored targets after the math in Part V.


Part IV: Math

Now, I’ll introduce the formula that I used to calculate the Allomantic Force. After that, I’ll describe each of the terms in detail.

Allomancy is a lot like magnetism, so let’s start by looking at the formula for the magnetic force between two poles. In Allomancy, the “two poles” would be the Allomancer and target.

Magnetic Force = Constant * q1 * q2 / r2

  • Constant – some constant that depends on the medium between the poles.
  • q1and q2 – the magnitudes of the magnetic charges of the poles.
  • r – the distance between the poles.

The greater the charges, the greater the force. The greater the distance between the two poles, the weaker the force – and through the inverse square relationship, greater and greater distances cause much weaker and weaker forces.

Now, the Allomantic Force:

Allomantic Force = A * S * b * c1 * c2 / r2 (See Edit 2/3)

  • A – some constant. This depends on how all pushes and pulls are described in the book and can be increased/decreased for overall stronger/weaker pushes.
  • bBurn rate. See below.
  • SAllomantic Strength. See below.
  • c1 and c2 – the Allomantic Charges of the Allomancer and target.
  • r – the distance between the Allomancer and target.

Burn rate – the rate at which an allomancer burns their metals. For my purposes, burn rate is a range between 0 and 1, where 0 is “not burning at all” and 1 is “pushing as hard as you can,” possibly without flaring. I bound this to the triggers on a gamepad and to the scroll wheel on a mouse, which allow me to variably control the strength of a push using the burn rate.

Allomantic Strength the most magic-y of the all the components of the force. Some Allomancers are naturally stronger than others, perhaps by sDNA. Allomancers get better with training and experience. These factors get bundled into the Allomancer’s Allomantic Strength. The Allomantic Force is not proportional to the Allomantic Strength (see [3]). Rather, the Allomancer’s maximum burn rate is proportional to the Allomantic Strength. In this way, Allomantic Strength acts as a sort of limiter. Stronger Allomancers must be able to burn more metal faster for a stronger effect. I won’t incorporate this in-game.

Allomantic Charge – Analogous to magnetic charge. Contributes to the Allomantic Force. A property of both metals and Allomancers.

I recommend now reading [1], which has a very interesting theory on this. I’m not adhering to it completely, though.

An Allomancer or target’s Allomantic Charge is a function of its mass.

To make the mass relationships of Mistborn work, we need to satisfy a few factors:

  • The more massive a target is, the stronger a push an Allomancer can get off of it. The less massive a target is, the weaker a push an allomancer can get off of it.
    • “[Wax] shot outwards in a grand arc above the city, flying for a good half a minute on the Push off those enormous girders” (AoL ch 1 pg 34) [3].
    • “…the lamp was a good anchor -  lots of metal, firmly attached to the ground - capable of pushing [Wax] quite high” (AoL ch 1 pg 32) [3].
    • Both of the targets in these quotes are equally anchored, but the girders are much more massive and provide a stronger push.
    • I don’t have any direct quotes, but we know that Allomancers get less of a push from coins than they do from, say, enormous girders.
  • The “heavier” an Allomancer is, the stronger their push.
    • This argument comes from Feruchemical weight, not mass, but it nonetheless impacts Allomancy in the books, so I should bring it up here.
      • While tapping weight, Wax thought, “with this incredible conflux of weight, his ability to Push grew incredible” (AoL) [2].
    • I can’t quite remember the context or quote, but I recall that one of Kelsier’s surprises about Vin was her Allomantic Strength/Charge was large “for her size,” implying that smaller/less massive Allomancers usually have less charge.
    • It’s symmetrical with the target’s mass impacting the Allomantic Charge. It’s intuitive and makes sense.
  • There should be some soft maximum cap and minimum cap to the force.
    • If an Allomancer pushes off of an absolutely massive multi-ton solid block of gold, they shouldn’t be pushed into the stratosphere. Likewise, coins are very light relative to lampposts and roofs, but they still provide a reasonably strong push.

This leads me to the most disgusting part of the math. What exact relationship do the masses have with the force?

  • The relationship can’t be zero. If this were the case, mass would have no effect on the force, which I argued against. Also, an Allomancer could push on a “metal” with a mass of 0 and still get a push, which doesn’t make sense.
  • The relationship can’t be linear. If this were the case, a target 10 times as massive as another would provide 10 times a push as the other, which doesn’t appear to be the case. If an Allomancer pushes first on a 30g coin and then on a 30kg metal block, the Allomancer would receive 1000 times more the force from the block than the coin. In the books, Allomancers push off of girders and roofs which are much heavier than 30kg, but they certainly don’t describe such a massive difference in forces from coins. That’s duralumin-levels of strength.

I’ve tried out a lot of relationships. Logs, sum of logs, product of logs, and roots. Eww.

My solution was to take the root of the masses of the Allomancer and target. Specifically, the, ah, sixteenth root. It provided a good combination of strong-enough pushes from light coins and weak-enough pushes from very massive targets that felt most similar to the books. The number 16 was arbitrary. I figured I might as well use Scadrial’s base number for legitimacy. If I used a more elegant root (i.e. the square root), coins provided practically no force, and massive targets still pushed to the stratosphere. Higher roots “level the playing field” more than lower roots.

c1 = sixteenth root of (m1)

c2 = sixteenth root of (m2)

  • m1 – mass of Allomancer
  • m2– mass of target

Because of how roots work, we can also say that c1 * c2 = sixteenth root of (m1 * m2).

Regarding the maximum to the force that an Allomancer can get from an extremely massive target: The heavier and heavier the target, the less and less the increase in force. No pushes to the stratosphere.

I’m not actually sure if this is the case with roots, but it felt like it was: the lighter and lighter the target, the less and less the decrease in force. Coins are very light, but still provide a significant push.

In the end, I’m not actually trying to figure out how mass affects the force in the books. I am fairly confident Brandon didn’t consider the exact relationship while writing the books. I’m just finding ways to emulate it in a physics engine.


Part V: Summary & Final points

And here’s the final, composed formula for the force an Allomancer experiences while pushing:

Force on Allomancer = Allomantic Force + Allomantic Normal Force = Allomantic Constant * Burn rate * sixteenth root of (target mass * Allomancer mass) / squared distance between Allomancer and target (See Edit 2/3) + Allomantic Normal Force

  • Burn rate is between 0 and 1. A Burn rate of 1 gives the maximum Allomantic Force.
  • When target mass is 0 or the Allomancer mass is 0, the Allomantic Force is 0.
  • The closer and closer the target is to the Allomancer, the greater and greater the Allomantic Force.
  • Like other normal forces, if the target isn’t fully anchored (e.g. a coin sliding across the ground, or a thin metal rod that bends as you push on it), the Allomantic Normal Force ranges from 0 to the Allomantic Force, depending on how anchored the target is. This means that an Allomancer pushing on a perfectly anchored target will be pushed back with twice the force as a perfectly unanchored target, assuming they have the same distance.
    • This last bit about the distance is key. If an Allomancer is falling through the air and throws down a coin, the coin quickly falls further and further down. The Allomantic Force quickly becomes very small. Only once the Allomancer falls further and is near the coin – now anchored to the ground – does the distance stay small enough for the Allomantic Force to be large enough for a long enough time to scale a building.
    • Friction (and air resistance) can also be a normal force, in this context; any (normal component of a) force that resists the Allomantic Force can be an ANF.
    • Gravity, too, can be an ANF. An allomancer hovering in the air (whose push cancels out gravity) exerts an ANF equal to gravity back to their target.
    • Theoretically, the Allomantic Normal Force could be greater than the Allomantic Force if the target accelerated in the opposite direction of the push. If you pushed (not pulled) on a target, and the target moved towards you (e.g. a very determined Steel Inquisitor, resisting your push and walking towards you), that normal force would push on you harder. This could result in “pushing matches” between Allomancers who try to move towards each other for even stronger pushes.
  • Allomantic Normal Force works both ways. If the Allomancer is anchored (e.g. braced against a wall), the target will experience an Allomantic Normal Force.

Other details:

  • There are two main coins in Mistborn: Imperial boxings (gold) and clips (copper or bronze). In real life gold coins are usually around 30 grams, but I’ve experimented with increasing their mass by about 10-100 times for the game. Currently, I’ve kept them as 30g.
    • When pushed with any reasonable force, 30g coins instantly fly off of the screen like bullets. There’s no user feedback that they pushed on that coin, other than, “that coin no longer appears to exist.” If you drop a coin from the air, it is on the ground by the next frame. Coins are sometimes described as behaving like bullets, but I don’t like how that works in the game. With heavier coins, you can see the coin after you push on it, but it still moves very quickly.
    • Another option (which is the one I’m using in the game) is to simply cap their maximum velocity. I’ve left it at around 120m/s, which feels good. That’s about 1/3 the speed of sound. It causes some problems with calculating the Allomantic Normal Force from the target, but those have been resolved with coding (more or less).
    • The image on the coins in the game is taken from Shire Mint.
  • Fun fact: Unity doesn’t let you modify force vectors individually, which makes this a bit hard. You can only add forces/accelerations/velocity changes one at a time, then they are all applied to the object at the end of the frame. Calculating the Allomantic Normal Force is absolutely disgusting. See my code on GitHub, if you’re curious.

I hope you all enjoyed the read! Please discuss this and give your opinions on the physics and maths of Allomancy. Specifically,

  • Are there any more elegant relationships between Allomancer/target mass and Allomantic Force that you think I should try?
  • Does anyone have any esoteric knowledge of Unity’s Rigidbody/Force systems that you think could be helpful?
  • Any general ideas for the game? Any suggestions from what you can see in the videos?
  • Any spelling/formatting issues with the post?

Thank you.

 

Edited by Artemos
Added updates to front of post
14

Share this post


Link to post
Share on other sites
24 minutes ago, Calderis said:

This thread by @Pagerunner and it's doc may help you out.

 

That was one my favorite posts. I definitely agree with his final point that Allomancers can only define the percentage of their maximum Push strength. The burn rate, directly controlled by the player, ranges from 0% to 100% to give the same effect.

0

Share this post


Link to post
Share on other sites

Aw, yes, I love me some math. I unfortunately don't have time to dig into it all right now. But, in case you haven't finished the Impossible Physics thread, I don't think I updated my first post to include a later development we worked to. I changed my mind to: force is inversely proportional to relative velocity (as opposed to an arbitrary cutoff where you can't push beyond a certain speed). So you can ramp the coin up pretty quick, and then the force drops to almost negligible before it has enough time to push back on the Allomancer.

But I kept it all to variables for a reason - I don't have the patience to actually come up with coefficients and exponents. So, more power to you, and best of luck! Looking forward to seeing more about it as you progress.

0

Share this post


Link to post
Share on other sites

Thanks! Making the force inversely proportional to the target's relative velocity feels too complex for what (in my mind) should be similar to magnetism, gravity, or any other force ruled by an inverse-square law. The relative velocity idea sounds like it would mimic the books pretty well, but without context I can't think about it further. Do you have a link to the post?

0

Share this post


Link to post
Share on other sites

This is amazing, the amount of work you put into this is incredible. Is there any way you could let some of the shard demo this with out breaking copyright laws? 

Also, how do you think that emotional allomancy would work in a video game? I am not much of a gamer or a programmer, but I am excited to hear what your plans are. Thank you for your great contribution to the Shard.

0

Share this post


Link to post
Share on other sites

What exactly are the laws you would break if you sold it? Do you just need to ask Brandon or is there something I haven't thought of?

0

Share this post


Link to post
Share on other sites
47 minutes ago, Ark1002 said:

What exactly are the laws you would break if you sold it? Do you just need to ask Brandon or is there something I haven't thought of?

There's already been an officially licensed  Mistborn game in development. There's been very little news about it, so it probably won't be happening for a few years, if ever. It would be illegal because Mistborn isn't my property, and trying to profit from it would be a breach of copyright. This is just a fan game, so if I ever release it, it would be for free.

10 hours ago, Gasper said:

This is amazing, the amount of work you put into this is incredible. Is there any way you could let some of the shard demo this with out breaking copyright laws? 

Also, how do you think that emotional allomancy would work in a video game? I am not much of a gamer or a programmer, but I am excited to hear what your plans are. Thank you for your great contribution to the Shard.

I could probably put up the current build of the game up for download through my Dropbox. It would be nothing more than a physics demonstration, but I do think many people would still be interested in that. I'll see what I can do.

Regarding emotional allomancy: Some facets of Allomancy work better in the medium of a game than others, namely iron/steel, pewter (as a health/armor system), and tin (think like Witcher senses). The Mental metals would be interesting, but I don't know how I'd implement them. The easiest thing to do would be to make the player a coinshot/lurcher hybrid with only Ironpulling and Steelpushing. I think adding any other metals might be too ambitious.

Thinking of the Witcher reminds me of the Axii sign, which could provide a similar effect - Soothing or Rioting enemies to distract them, delay them, or turn them on their allies (in the case of Koloss and the like, or with duralumin).

0

Share this post


Link to post
Share on other sites

My brother played around with a very similar, but much more limited idea for one of his classes. The big challenges, as I recall them, were the physics of Steelpushing and Ironpulling (which you are already aware of) and how they work in Unity, and the visuals - how do you picture things like emotional Allomancy, for example. It's a big undertaking, but you've got some thinking done, which is good. I would only advise you to start small and see how the scope shapes up.

0

Share this post


Link to post
Share on other sites
13 hours ago, Artemos said:

Thanks! Making the force inversely proportional to the target's relative velocity feels too complex for what (in my mind) should be similar to magnetism, gravity, or any other force ruled by an inverse-square law. The relative velocity idea sounds like it would mimic the books pretty well, but without context I can't think about it further. Do you have a link to the post?

I don't remember where the conversation went down - looks like it wasn't in the thread, but it might have been on Discord (where the conversation started) or possibly on Reddit. Technically, my original idea had force as a function of velocity - it was just a step function, transitioning from 1 to 0 when velocity reached the maximum. Making it an inverse relationship (which is more qualitatively so; not necessarily 1/x, but even a decreasing exponential would fit), something continuous, makes for a model with no on/off oscillation at the 'maximum velocity,' which I found a lot cleaner.

0

Share this post


Link to post
Share on other sites
18 minutes ago, Pagerunner said:

I don't remember where the conversation went down - looks like it wasn't in the thread, but it might have been on Discord (where the conversation started) or possibly on Reddit. Technically, my original idea had force as a function of velocity - it was just a step function, transitioning from 1 to 0 when velocity reached the maximum. Making it an inverse relationship (which is more qualitatively so; not necessarily 1/x, but even a decreasing exponential would fit), something continuous, makes for a model with no on/off oscillation at the 'maximum velocity,' which I found a lot cleaner.

Yeah, having a discontinuity in the force formula was something I wanted to avoid at all costs. I think the coin's distance from the allomancer accounts for the dramatic decrease in force, rather than its high velocity. Pushing on an anchored coin keeps it close to the allomancer for a reasonably long time, while pushing on an anchored coin will quickly become very distance from the allomancer. In the first case, the coin has a low/zero velocity, low distance, and high force on the allomancer, while in the second case, the coin has a high velocity, high distance, and low force on the allomancer. The distance between the coin and the allomancer already accounts for the difference in forces between an anchored and unanchored coin.

Sorry if that's a bit wordy. In the original post, I say,

Quote

This last bit about the distance is key. If an Allomancer is falling through the air and throws down a coin, the coin quickly falls further and further down. The Allomantic Force quickly becomes very small. Only once the Allomancer falls further and is near the coin – now anchored to the ground – does the distance stay small enough for the Allomantic Force to be large enough for a long enough time to scale a building.

Does that make sense? The 1 / r relationship provides a similar effect as an inverse relationship with the velocity.

1

Share this post


Link to post
Share on other sites

For things like emotional allomancy, have you thought of using a mechanic that is more like a force field that you can narrow to one person or leave on for a large group of people?

0

Share this post


Link to post
Share on other sites
1 hour ago, Gasper said:

For things like emotional allomancy, have you thought of using a mechanic that is more like a force field that you can narrow to one person or leave on for a large group of people?

Haven't thought about it. For pushes and pulls, I plan on eventually recreating Wax's steel bubble, with which the player can apply a weak push or pull to all metals around them. As of now, targeting multiple metals gives the player a weaker push for all of them (pushing on 3 targets gives 1/3 a push for each, giving a net force that is equal to pushing on 1 target with 100% of the force). If I did implement emotional allomancy, I would probably use the same strategy: your maximum Sooth strength is at 100% on one target, at 1/2 strength on two targets, or at a weaker strength for a general "bubble" of soothing.

 

2 hours ago, Argent said:

My brother played around with a very similar, but much more limited idea for one of his classes. The big challenges, as I recall them, were the physics of Steelpushing and Ironpulling (which you are already aware of) and how they work in Unity, and the visuals - how do you picture things like emotional Allomancy, for example. It's a big undertaking, but you've got some thinking done, which is good. I would only advise you to start small and see how the scope shapes up.

The physics where definitely difficult. The basics of pushes and pulls weren't actually all that hard (Unity's physics are good enough for that), but the getting the Allomantic Normal Force (and the Kinetic Energy idea I mentioned in the post) to work was much more complex. My final strategy was to go frame-by-frame, comparing the target's actual acceleration to the expected acceleration it should have experienced from the Allomantic Force. The difference between the two is sent back to the Allomancer. Essentially, the force that the target experienced to resist the Allomantic Force is sent back to the Allomancer. I hope that makes sense. I'll probably document all this better in my code soon.

0

Share this post


Link to post
Share on other sites

It's quite hard to get a hang of controls.

I will keep trying. But in meantime, have you thought about making a tutorial or - if it's too much work - adding a simple textbox reminding of what's what?

0

Share this post


Link to post
Share on other sites

Have you checked the README? I wrote all the controls there. But yes, I'll add tutorials and improve the controls in time. It's very bare-bones at the moment.

Today I've been trying to make the player control the magnitude of the force of the push, rather than the percentage of their maximum push. It feels a lot more intuitive and easier to control, but still has a few kinks to work out. I'll probably commit it tomorrow.

0

Share this post


Link to post
Share on other sites

Mental allomancy could have some interesting combat applications for a game. I'd be thinking something like the rage/pacify spells from Skyrim.

As to the rest, wow. This is genuinely amazing. Keep up the good work mate, I can't wait to see what else you come up with.

0

Share this post


Link to post
Share on other sites

@Artemos Did you give any thought to my e^-r concept for range? Assuming you saw it. It's probably unnecessarily complex for a game. I think Phantine felt it was unnecessarily complex for an equation. :)

But it (1) avoids the issue of 1/r^2=infinity at r=0 (e^0=1) and (2) doesn't require a max range, which feels kind of clunky to me for "scientific" equation. Practically speaking, it can be made very similar to a linear relationship, depending on how you scale it. Just doesn't have a limit, and gives more weight to closer ranges. For example, something like e^(-r/20) gives you something practically similar to the 50-r that you're currently using... just a bit below the line until 40m and still at about 10% at 50m. Effectively 0 around 80m or so.

I'd be curious to see how that feels versus the linear or inverse square relationships. :)

0

Share this post


Link to post
Share on other sites

Here's an graph of the three models for distance layered over each other. Indeed, the exponential looks a lot like the linear relationship, but doesn't equal 0 at the max range, which I like.

18 minutes ago, Jofwu said:

But it (1) avoids the issue of 1/r^2=infinity at r=0 (e^0=1) and (2) doesn't require a max range, which feels kind of clunky to me for "scientific" equation. Practically speaking, it can be made very similar to a linear relationship, depending on how you scale it. Just doesn't have a limit, and gives more weight to closer ranges. For example, something like e^(-r/20) gives you something practically similar to the 50-r that you're currently using... just a bit below the line until 40m and still at about 10% at 50m. Effectively 0 around 80m or so.

(1) I don't really think this is an issue. Look at magnets, which also obey an inverse square law and have the same "1/r^2 -> infinity as r -> 0" property. The Allomantic Force will never approach infinity in the same way that the force between magnets will never approach infinity. You can hold them close together, but unless you have a hollow magnet, their centers of mass won't overlap, and the distance will never get near zero. Still, it does get extremely high, which is a flaw with using it for Allomancy.

On a somewhat related note, I subscribe to the theory that Allomancy doesn't actually push and pull from the center of mass. Rather, Pushes and Pulls operate like gravity and magnetism: Each tiny bit of the Allomancer has a mass/charge that pulls on each tiny bit of mass/charge of the target. In sum, it looks like the Allomancer's center of mass is pulling on the target's center of mass.

(2) A hard, exact, max range definitely bothers me. There's no force field in the real world that at 49.99 meters "has a nonzero force" and at 50.01 meters "has a zero force". I really want the force to approach zero, not equal zero, at the max range.

18 minutes ago, Jofwu said:

I'd be curious to see how that feels versus the linear or inverse square relationships. :)

I'll put the formula in the game and get back to you on how it feels.

0

Share this post


Link to post
Share on other sites

Yeah, no technical issue with an actual r=0 case, but just the practical issue of very high values relative to some short distance away.

I see you made use of that "16" factor again. Love it.

Concerning center of mass... Yeah, I mostly agree. I think Brandon imagined something more like center of mass, but practically speaking that just doesn't make sense. You can't apply a point force on somebody in real life; you have to distribute it across... something. The biggest problem with the "gravity" approach is that characters describe whiplash. So I've kind of been working under the assumption that the "Allomantic charge" isn't evenly distributed throughout the body. Trying to tackle that in more detail is getting into the weeds perhaps. :)

I don't really like the Allomantic Normal Force concept, but I guess if that's the clearest way to make the actions seem natural then it's the way to go.

I'm curious though. Did things not work out as u/phantine predicted without ANF? His idea relied too much on force dropping off with distance faster? Seems like coins accelerating to 120 m/s in one frame should give a lot of recoil.

0

Share this post


Link to post
Share on other sites
29 minutes ago, Jofwu said:

The biggest problem with the "gravity" approach is that characters describe whiplash. So I've kind of been working under the assumption that the "Allomantic charge" isn't evenly distributed throughout the body. Trying to tackle that in more detail is getting into the weeds perhaps. :)

I think it's similar to the popular topic of Kaladin nearly blacking out/experiencing whiplash while Lashing. If these magics existed in the real world, the whiplash wouldn't exist. All your internal organs would experience a uniform acceleration/change in acceleration, but it just feels intuitive for the body to experience whiplash and that's how Brandon wanted it to feel. And yes, that's definitely getting into the weeds.

29 minutes ago, Jofwu said:

I don't really like the Allomantic Normal Force concept, but I guess if that's the clearest way to make the actions seem natural then it's the way to go.

I'm curious though. Did things not work out as u/phantine predicted without ANF? His idea relied too much on force dropping off with distance faster? Seems like coins accelerating to 120 m/s in one frame should give a lot of recoil.

Ehh, that quick recoil of the coin would exist with or without the ANF. If anything, the ANF would increase it as the coin is resisted by drag.

Without the ANF (or at least some system that gives the player a stronger push from an anchored target), pushing overall feels much less impactful, especially when bracing yourself against a wall and pushing against something.

Honestly, it is hard to tell if anchored pushes are stronger because the distance stays smaller than that of unachored targets or if it's caused by the ANF. It's certainly possible that the distance is all that matters. I'll add an option in the settings to enable/disable the ANF.


What follows is me completely misunderstanding you and writing out a whole dang response to something completely irrelevant. Oh well. Not gonna delete it because I spent so much time in it and there's still a few interesting tidbits. Here's me arguing against an inverse relationship between force and velocity:


The ANF is definitely the cleaner calcuation-wise and works well in-game.

The velocity strategy was much more difficult to program effectively and had strange edge cases, such as when you begin pushing on any target that isn't moving (anchored or not).

  1. A coin is sitting on ice. Its velocity is 0.
  2. The Allomancer begins pushing on it.
  3. The coin is not moving, so it receives a lower percentage of the push than the Allomancer.
    1. Specifically, it would receive none of the push because its velocity is 0 (using a some kind of simple relationship).
  4. The coin receives a lower percentage of the push, so it accelerates less.
  5. It accelerates less, so it has a lower velocity.
  6. etc. etc. etc.

Already from (3.), There's a sort of feedback loop that occurs whenever a target is stationary. If a target isn't moving, it mustn't need any of the push, so it doesn't accelerate, regardless of how anchored it is. You'd have to "push on it a little" to see if its velocity changes, then move it back to where it was and give it an appropriate percentage of the force. It's a lot more complex than the Allomantic Normal Force.

In other words, you would have to be constantly checking if the target's velocity is where it's at because it is anchored/partially anchored or simply because you haven't pushed on it hard enough yet.

I know that there are solutions to this and it would be possible programming-wise to create this effect. But, the simple fact that you would have to program edge-cases for this feels unnatural.

The reason I like the ANF is because it mimics physically pushing on something in real life from a distance with a pole. You push on the pole, which pushes on the target. If the target can't move, the target resists the pole's push, which resists back to the Allomancer.

  • If you're falling down and you jab the pole downward and it just slices through the air, you'll accelerate up a little, but hardly enough to slow your fall.
  • If you're falling down and you jab the pole downward and it hits the ground, you'll slow, then stop, then begin climbing up.

It's a lot more elegant (in my opinion) than making the force a function of velocity/relative velocity.

1

Share this post


Link to post
Share on other sites
4 minutes ago, Artemos said:

think it's similar to the popular topic of Kaladin nearly blacking out/experiencing whiplash while Lashing.

This only happens with sudden and extreme changes in direction under multiple lashings, and actually makes sense when taking momentum into account. 

In the vast majority of instances its just a direction change in the way someone falls. 

0

Share this post


Link to post
Share on other sites

@Jofwu I added the option to disable the ANF as well as the exponential relationship. Check it out, if you want.

Edited by Artemos
Hit submit by mistake, earlier.
0

Share this post


Link to post
Share on other sites

 

5 hours ago, Artemos said:

The velocity strategy

Misunderstanding or not, it was interesting to read what you worked through!

I assumed at first you were referring to Pagerunner's thing, where velocity is part of the equation, but this sounds different. Almost opposite? If you're looking at relative velocities I don't see why you need to keep track of where the velocity is coming from or whether one thing or the other. 

If I recall, I think my concept using his idea was that the equation would have an "e^-v" term since it works very similarly to distance. That way you get 100% force when the Allomancer and coin are stationary relative to one another. It diminishes as the coin accelerates away. Then it hits a wall, velocity is suddenly zeroed out, and force instantly jumps from some lower level back to 100%. Practically speaking, I don't know how computationally intense that would be... to keep track of the velocity of every metal object relative to the Allomancer. And I don't know that it would yield results that feel right.

I can't put my finger on why ANF bothers me. I'll have to think about it.

I haven't had a chance to test the game out, but I'm really itching too now. :D

5 hours ago, Calderis said:

This only happens with sudden and extreme changes in direction under multiple lashings, and actually makes sense when taking momentum into account. 

In the vast majority of instances its just a direction change in the way someone falls. 

This is not the right thread to debate it, and I don't know that you want to go down that road. But I feel quite strongly that isn't how it works. Gravity, including sudden or rapid changes, can't be felt. The only case where you feel something with Lashing is with the air resistance produced. The simplest issue you deal with is that at terminal velocity under multiple Lashings (no sudden changes here) you feel the full weight of those Lashings by means of strong wind blowing against you. Lashed 5 times and currently at terminal velocity? It feels like wind is blowing against you so hard that you're being accelerated by 5Gs.

0

Share this post


Link to post
Share on other sites
3 minutes ago, Jofwu said:

I assumed at first you were referring to Pagerunner's thing, where velocity is part of the equation, but this sounds different. Almost opposite? If you're looking at relative velocities I don't see why you need to keep track of where the velocity is coming from or whether one thing or the other. 

If I recall, I think my concept using his idea was that the equation would have an "e^-v" term since it works very similarly to distance. That way you get 100% force when the Allomancer and coin are stationary relative to one another. It diminishes as the coin accelerates away. Then it hits a wall, velocity is suddenly zeroed out, and force instantly jumps from some lower level back to 100%. Practically speaking, I don't know how computationally intense that would be... to keep track of the velocity of every metal object relative to the Allomancer. And I don't know that it would yield results that feel right.

After I realized that I misunderstood you, I didn't put much effort into making it make sense. Regardless, the exponential relationship with velocity sounds very interesting. I'll try it out eventually. I won't be able to work on the game over the weekend, though.

 

The way I was originally thinking of the relationship between force and velocity was sort of like this: There is a finite quantity of kinetic energy that can be added to the target-allomancer system each frame. The distribution of this energy depends on their velocities, so if the target and allomancer weighed the same and accelerated equally they would each receive 50% of the energy. If one had a velocity of 0, it would receive 0% of the force and the other would receive 100% of the force. That was what I tried to explain in that comment, and it would be difficult to implement. The exponential relationship certainly sounds a lot more reasonable.

 

It also wouldn't be that computationally intensive to keep track of every metal's velocity. I know that because... I already do that. It's actually part of how the ANF is calculated. I'll probably edit the original post or comment the code to explain the specifics.

0

Share this post


Link to post
Share on other sites

Sounds awesome.

And I finally got a chance to play around with this. It's a BLAST! Really well done so far. :)

The controls aren't easy to grasp... but it's so much more intuitive than I would have guessed.

Do the buildings have less friction or something? Seems like it's harder to jump from a Pushed coin on top of them. Also, is it possible to target more than one thing for a Push or Pull? Thought I saw that in one of the gifs, but I can only seem to do one for each.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.