patko at January 19th, 2013 19:01 — #1
I am a student of Information Technology with my specialty being programming. In this last semester before graduation I have a course in gaming. For this course I am tasked to make a 3d game using Unity. First game I am going to make, I have some experience in modeling and can rig a model.
Concept: Character is viewed sideways and is always running, the user encounters various objects "coming at him". The user has a button that will make the character jump over the obstacles in a freerunner kind of fashion. This could mean for instance that the character will plant his hand onto a box and swing his body over it.
Rosy Scenario: User pushes the right button at the right time, his hand is planted succesfully on the obstacle and the jumping animation is played.
Problem: How do I account for badly timed jumps? Best case I would want there to play some kind of collision animation even better would be to make the character start his jump but then make the model go into ragdoll mode when no handplant is detected causing the character to fall.
Question: Am I getting myself into advanced territory here or is this something that can be achieved by a beginner? I am indulding my own imagination for this project and havn't really thought about how feasible these kinds of things are. I can manage the modeling and animation. But the interaction of an animated character with a static object is something that alludes me.
Any tips, comments, suggestions are greatly appreciated!
reedbeta at January 19th, 2013 19:25 — #2
Unity has a physics engine built-in I believe. I'm not sure if it has ragdoll bodies, so you should research that and be sure it does. Aside from all that, it sounds like a simple enough game for a first-time project. It only has one basic mechanic, which is good. The main question is how many different kinds of obstacles and jumps will there be? You want to keep that a small number, maybe 3 or less, to avoid having to do a bunch of work making different variations of animations. You also might want to look into inverse kinematics (IK) animation for planting the character's hand on an object. That would let you have the character grab things at different positions and angles without having to make a new animation for every possibility. And if there's no IK solution (his hand can't reach the object) then he fails the jump.
If you get the ragdoll stuff working and have time, you could spice it up a bit by adding some grotesque physics-based deathtraps that the character will fall into if he fails a jump - like some giant gears that he gets stuck in, platforms that slam him around or a stack of crates that fall on him, etc. The nice thing is that all that stuff should be relatively easy to do once you have the physics engine and the ragdoll system going.
patko at January 21st, 2013 04:18 — #3
Thanks for the reply, I'm not clear on the IK part though. I use IK in my character rigging but don't really understand how it can be used to apply on outside objects, never mind combining it wiht a fixed animation. If you could perhaps point me to some reading material it would be greatly appreciated!
fireside at January 21st, 2013 07:28 — #4
I'm not sure about IK, but animation blending will cover some issues. It sounds like you need to know the height of the obstacle to decide on the animation. You could do that by casting a ray. When in motion, your eye won't see small imperfections in height. This sounds like a good use of Unity's new Mecanim system which uses IK. I'm not up on it yet. I guess it depends on how much time you have, etc. Myself, I would just make a couple extra animations for varying heights, like 4 or so and then maybe raycast to find the approx height so I knew which animation to use. My own feeling is that, those things are somewhat detail oriented and should be considered after you have a working prototype that feels fun to play. Having the character perfectly place his hands on a surface doesn't make the game fun. That involves making choices that affect the outcome of the game in some way. I guess, if it's some school thing, they might judge it in a different way, but for me, you get a game working and enjoyable and then work on the details if you have time.
thenut at January 21st, 2013 08:32 — #5
I haven't really seen anything in the requirements to merit more complicated IK animation and ragdoll physics. Ragdoll is good if you want to take death sequences to the extreme. IK is used both in modelling and it can also be used in programming to support dynamic animations. As Reed said, this could be programming the hand to grab something at any position or climbing where the foot animations look more tuned to the environment rather than some static animation that looks fake. It's a nice solution to give animation control to the programmer, but it's not cookie-cutter. You need to implement constraints as well, otherwise your joints will go all over the place when you start doing some typical routines like lift the foot high enough and the thigh rotates weirdly or some such. I'm sure you've seen that by now just by playing around with your character rig. Pretty much every game, character, situation you support will involve research time to dial in the right settings and support level. It's pretty rough.
I would say you are getting into advanced territory if you do get involved with either of those two topics. Judging by the sound of your game, I believe you'll be fine just by exporting static animations and blending between them when it's time to do so. It depends though, because there's many recovery options available to you and depending on how you want the end product to look, it will affect the amount of effort you will need to put in. It's not uncommon for instance where I see games just blink a character model as it ghosts through the object taking damage for hitting it. Or death sequences that play out, but you may still be falling even after the sequence completes. Not AAA quality mind you, but enough to get the point across. Still, if you're up to it you can investigate the above two topics. They are a must if you ever want a career in writing skeletal animation systems for games.
rouncer at January 21st, 2013 09:04 — #6
this kinda thing gets really advanced to the point your writing the animation for assassins creed, so watch out.
tyree at January 21st, 2013 21:47 — #7
there is no reason to program motion. there will never be a shortage of programming in a game regardless of how simple it is. I dont know why the character would let himself fall. unless its some kind of comedy game, but if you want that. it could be done in your 3d program and exported as an animation then triggered whenever you decide it should play. you wouldnt need ragdoll for this. you could put a collision sphere or box on the object the character is planting his hands on
and use that to determine when to play the fall animation but I doubt that would be an enjoyable game