Actually you can download endorphin lite edition for free. There's a thing called BALANCE. It balances! But yea, there is some kind of cheat 😀
create a character that behaves like a human being
General DiscussionFinally things are simpler and one has not to read the entire library of the orthopedic school.
As first step I wanted to make the body in the "Biped Test" to stand in its feet and this was my question.
So, after I commented out the for (i = 0; i < 32...) section of the BipedTest.h, I created a mouse joint
at the high of the head of the body.
That's it.
Now my next step is to make the body less elastic but I think this is not going to be that difficult.
Anyway, thanks to all box2d-fellows who answered to my question for the interesting approaches.
As first step I wanted to make the body in the "Biped Test" to stand in its feet and this was my question.
So, after I commented out the for (i = 0; i < 32...) section of the BipedTest.h, I created a mouse joint
at the high of the head of the body.
That's it.
Now my next step is to make the body less elastic but I think this is not going to be that difficult.
Anyway, thanks to all box2d-fellows who answered to my question for the interesting approaches.
So you'd like him to hand stupidly or behave like a human being?
This is pretty interesting. Has anyone come across any good tutorials/resources for making "simple" balancing bipeds in 2D?
I guess hoisting would help alot like Boris said. If you don't mind cheating.
I guess hoisting would help alot like Boris said. If you don't mind cheating.
BorisTheBrave wrote:
2D does make things easier
Not really, how are you going to flip your ragdoll body when your character is trying to move in another direction? In 3D It's easy.
hatu wrote:
This is pretty interesting. Has anyone come across any good tutorials/resources for making "simple" balancing bipeds in 2D? I guess hoisting would help alot like Boris said. If you don't mind cheating.
Something that works pretty well is to only half-cheat: instead of using fake stabilizing constraints on the ragdoll's position, stabilize only the orientation of one link (i.e add a soft motor that tries to keep the torso's angle constant). This way if you motorize limb movement, the ragdoll will stand/walk realistically (i.e the movement of the legs will cause feet too collide with ground and push off, etc). We posted a video of this on our blog: http://www.metanetsoftware.com/blog/?p=508
The next step is to add some logic controlling the stabilizer so that bipeds can fall over, etc. instead of being upright all the time. This is something we're still working on 🙂
Neosano wrote:
BorisTheBrave wrote:
2D does make things easier
Not really, how are you going to flip your ragdoll body when your character is trying to move in another direction? In 3D It's easy.
Agreed, changing facing direction is a non-trivial problem in 2D, at least if you want the movement to be physically-plausible (or smooth so that it behaves well with the simulator); such movement requires/implies 3D which is what causes complexity when you're trying to keep everything in "pure flatland" 🙂
Possibly this is why rectangular and circle-shaped characters still dominate in 2D physics-based games, such shapes are very easily "flipped". For some reason this is often overlooked, but simple mirroring/flipping just doesn't work with large arbitrary-shaped characters! There are lots of these little non-physical tropes which have crept into 2D games.
Our approach to this problem is to morph each polygon (so that they smoothly change shape to the mirrored version of themselves), while keeping the position of hands/feet constant wrt the torso. This isn't a general solution, as it requires a somewhat constrained physics rig so that e.g the range of valid arm/leg positions is symmetrical about the axis you're flipping around. And also, determining the "best" way to morph an arbitrary shape is a very hard problem.. we've cheated a lot by constraining our input data so that simpler solutions are possible.
We posted a video of this a while ago: http://www.metanetsoftware.com/blog/?p=334
If anyone else is working on this sort of thing we'd love to hear about it!
Raigan, you're one of the metanet guys? Respect++, I really learned a lot from your posted tutorials back in the day.
By hoisting, I did just mean attaching a force to torso, and maybe head. You could also invest in some inverse kinematics for direction mortion, etc, but all this is really beyond the scope of most games, as is flipping. When mario flips, his geometry doesn't change, but his sprite does instantly. So they have the same continuity problem. The fact is an "instant" change, or some fudged animation, actually works quite well. People don't tend to question it, after so many decades.
By hoisting, I did just mean attaching a force to torso, and maybe head. You could also invest in some inverse kinematics for direction mortion, etc, but all this is really beyond the scope of most games, as is flipping. When mario flips, his geometry doesn't change, but his sprite does instantly. So they have the same continuity problem. The fact is an "instant" change, or some fudged animation, actually works quite well. People don't tend to question it, after so many decades.
BorisTheBrave wrote:
Raigan, you're one of the metanet guys? Respect++, I really learned a lot from your posted tutorials back in the day.
Thanks! Though I'm actually the only guy.. the other one of us is a girl 🙂
We really can't wait to write some more about all the new stuff we've been working on, but it's taking forever 🙁
BorisTheBrave wrote:
By hoisting, I did just mean attaching a force to torso, and maybe head.
But importantly, if the "hoist" constraint is a position constraint between the character and the world frame (i.e it creates "ghost forces") then it opens up all sorts of problems where the fake is evident, i.e if you remove the ground from under the character, they remain levitating in mid-air.
Better would be to make a constraint governing the distance along the surface normal between the ground object and the character, however you then have the not-insignificant problem of having to correctly choose a ground object and normal (what do you do when you're running over a pile of boxes or a ragdoll, etc?). This is really just a sort of "raycast forces" type approach which people use for physics platformers, but it works better at those small scales rather than when things are large like with a whole biped.. the trick breaks down.
At least, this is what we found as we were trying to get robots to walk; our "orientation stabilization" constraint is bad in that it adds ghost forces from nowhere/the world frame, but the benefit is that the character isn't dangling from anything, it will fall if you pull out the ground and will properly push off of piles of objects under its feet.
Of course it's a tradeoff, since locomotion is much harder -- you can't just move the "hoist" forward, the biped needs to know how to move its legs to push itself forward.
BorisTheBrave wrote:
The fact is an "instant" change, or some fudged animation, actually works quite well. People don't tend to question it, after so many decades.
I totally agree, but that only works if your game is as simple as SMB; as soon as you add constraints between the character and other objects this gets quite messy.
For instance imagine if Mario was holding a block in front of him, and the block was attached via a rope to some other object, when he flips then the block will teleport quite a distance, and as a result the rope will be pulled in a very non-smooth way. Not only that, but the block might end up deep in collision, or (if the rope is a physical colliding shape) the rope is now passing directly through Mario.. both cases will cause a large collision response which is unlikely to behave well. This gets worse as the character gets "fatter"/wider too.
One solution to this specific problem would be to have Mario slowly move the block up and around to the other side, or through himself gradually; another is to keep the hands where they were (i.e so that his arms are stretched out backwards instead of forwards). Neither is really perfect though.
Large characters are a challenge as well: imagine Mario standing on the leg/arm of a larger biped who then flips facing direction.. what should happen to Mario? If he is teleported to wherever the leg/arm ends up (i.e he's treated like an object the large character is holding), then any constraints attached to Mario are going to be broken in a very violent manner. But if he remains in the same place, he may suddenly find himself standing in mid-air.
The problem is that the goals "complex physical interaction" and "obeying established platformer tropes" seem to be conflicting. Sadly this is exactly what's often wanted 🙁
I really wish there was more discussion of this sort of thing, it seems like for the most part physics-based games abandon abstraction (i.e your character is a physical mechanism with a small number of degrees of freedom, like a rolling ball or a dirtbike, and you directly control some of the degrees of freedom) because it's easier.
raigan wrote:
The problem is that the goals "complex physical interaction" and "obeying established platformer tropes" seem to be conflicting. Sadly this is exactly what's often wanted 🙁
Yeah, tell me about it. Pretty much every phenomenon doesn't lend itself to physics.
Have you seen Super Mario World, though? It somehow combines all standard platform features with a fairly physical enviroment. The physics in it is just completely unrelated to real world physics. There are free objects (shells, keys), and mario can turn while carrying objects, which leads to some pretty complicated interactions. It's not perfect, but it's food for thought.
BorisTheBrave wrote:
Have you seen Super Mario World, though? It somehow combines all standard platform features with a fairly physical enviroment. The physics in it is just completely unrelated to real world physics. There are free objects (shells, keys), and mario can turn while carrying objects, which leads to some pretty complicated interactions. It's not perfect, but it's food for thought.
SMW is one of my favorite games actually 🙂
One difference between SMW and more modern physics-based platformers is the addition of constraints/interactions beyond simple collision; once you start connecting shapes to each other in networks, it becomes much trickier to interact with a single shape in a nice way.
It seems like part of the genius of SMW is that the design of object interactions really hides/avoids problems.
Original thread: https://box2d.org/forum/viewtopic.php?t=3994