Re: [Plib-users] how do i???
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-03-23 05:13:20
|
Horacio Sanson wrote: > How do i animate the entities in my game??? this is all theorical since i > haven't write a line of code. This is the situacion: i have a player that has a > lot of movements, he can walk, run, jump, duck etc. he also has a weapon like a > sword, he can attack, defend, attack while jumping, dash, and has special > attacks etc. Well, modelling every step of motion from every position to every other position will be VERY tedious. At 60 frames per second, you'd need to build 60 models to get a one second move from (say) walking to (say) starting to jump, another 60 models for going from walking to fighting....this is going to balloon to unreasonable proportions pretty fast. What's needed is to model the character as a set of limbs with joints. The *simple* way to do it is to have each part of the guy's arms, legs body and neck modelled as a separate object - with transforms modelled for each joint. You can then store 'key frames' for the endpoints of various motions as sets of rotations and translations for each body part. You can interpolate the angles to get all the inbetween positions. This allows the player to go from partway through a walk sequence with (say) reaching forward with his right leg while his left foot is on the floor...to having both feet on the floor with knees bent ready for a jump. The storage for this is compact and the inbetweening code isn't too hard. That's essentially how Tux_AQFH models Tux and Gown. However, modelling (say) the forearm as one rigid polygonal model and the upper arm as another makes it very hard to make the elbow joint look convincing. Many modern commercial games adopt a technique called 'bones' where those joint transforms control an imaginary bone inside the forearm and another inside the upper arm. Each vertex in the 'skin' of the model is then weighted according to how close it is to each bone. (sortof)...hence, a vertex halfway along the forearm would be positioned using only the forearm bone. A vertex that's just a couple of inches from the elbow joint would use (say) 50% of the position it would have if it were transformed by the forearm and 50% of the position it would have if transformed by the upper arm's transform. PLIB doesn't directly support this stuff yet...but it's certainly something I'd like to play with if only I had the time. However, I've promised myself that I won't add major new PLIB or Tux features until PPE is a bit more complete. I'd need PPE to position the bones and set the vertex weights anyway - so that's the logical order of implementation. > My first idea is to make all the frames of the model in all positions and then > draw all the frames in secuence depending of the action required. Since the > player has so much movements it will take a lot of time but it's posible. Not really. > But........ the player also has the ability to change weapons and armors, > helmet, boots etc.. so the problem is if i have to make a model of the player > with each armor, weapon and make all the frames for each weapon, armor??? Exactly. > if i have a model of a player and diferent model of swords, and i > make the sword model child of the players hand model, the sword will follow the > players hand whenever it moves???. Yes - that WILL work because a sword is a rigid object. Doing that with (say) a shirt would be MUCH harder though. > I have seen a lot of games, RPG at most, and i don't see much changes in the > players look..... so i think what i want is not possible. Any ideas please > tell me. I know this has nothing to do with PLIB, but i'm willing to use PLIB > to do this, if it is possible. I think it's possible - and it certainly does have to do with PLIB - but the needed code for the skin+bones approach does not yet exist. Using simple rigid model articulation is much easier and can indeed be done with PLIB off-the-shelf. -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |