Ninja test of 3D platformer controls

Community Forums/Showcase/Ninja test of 3D platformer controls

jhocking(Posted 2003) [#1]
With apologies to sinu here is a demo I threw together of a character walking around with 3D platformer controls:
www.3darteest.com/ninja_test.zip

There's still a fair amount to do to get this working as well as I would like; I still need autocentering, obstacle avoidance, etc. I threw this together because after seeing sinu's work I was curious how hard it was to do. As an experiment I tried a slightly different approach taken by many games where the camera rotates automatically when you move sideways.

There are two control schemes: with keyboard and with joystick (or rather, dual analog stick gamepad as with modern consoles.) You can switch controls by hitting Tab.

Keyboard controls:
arrow keys - move character
Z - jump
X - attack
A & S - rotate camera

Dual analog controls:
left stick - move character
button 1 - jump
button 2 - attack
right stick - rotate camera

Oh, and I used Psionic's ninja for the test character. I had an original character initially but since that belongs to a client I had to throw something in there to replace it before posting.


(tu) sinu(Posted 2003) [#2]
the only thing similar is the actual aligntovector command which sets the player to face the right way.
still ok for the beginner plus you gave source too although mine is like a few 1000 lines but that includes my player system too

Edit: 100's of lines each :)


Binary_Moon(Posted 2003) [#3]
Sinu - could you tell me what is different between this and yours since using it they seem pretty much identical


jhocking(Posted 2003) [#4]
"the only thing similar is the actual aligntovector command which sets the player to face the right way"

True, but without the other stuff I mentioned that I still have to implement (eg. obstacle avoidance) the TFormVector and AlignToVector commands are the important code. Everything else is just dressing for the demo (some of which, like the jumping, is rather useful too if I do say so myself.) I don't doubt that you have some impressive additional features (after all, something is taking up your thousands of lines) but I've not seen anything else in your demos nor have you mentioned anything in words. For example, what does "player system" mean?


Binary_Moon(Posted 2003) [#5]
I think the jumping in Jhockings demo looks really camp. I know this is down to the animations but it really reminds me of "Morecambe (sp?) and Wise" (the bit where they do the skippy dance thing at the end of the show)


(tu) sinu(Posted 2003) [#6]
"Sinu - could you tell me what is different between this and yours since using it they seem pretty much identical "

it's based an old demo i sent joe, if im not mistaken.

"I don't doubt that you have some impressive additional features (after all, something is taking up your thousands of lines) but I've not seen anything else in your demos nor have you mentioned anything in words. For example, what does "player system" mean? "

i've not mentioned anything cos i like it that way plus those demo's are old and pretty lame to be honest, i have tonnes on my comp and those were the ones i threw out.


ps in my other post regarding a camera\player control system i should have maybe said 3d platform game system because thats what it really is, im implementing stuff like ledge climbing, pushing,sneak,walk,jog,run,multi-jumps,damage, attacks , crawling, throwing etc
and making an allround 3d platform system much like a console one or the base for one.


jhocking(Posted 2003) [#7]
"I think the jumping in Jhockings demo looks really camp. I know this is down to the animations"

I'm using a climbing animation frame in Psionic's model; it's the closest thing I could find to the body stretched out vertically. The actual jumping animation in his model doesn't work well because it has an enormous windup and landing. No offense to Psionic here since the model and textures are excellent, but the animations are pretty bad. Never mind the jump, the attack animation looks terrible. And the walk loops very poorly; there's an obvious stutter every cycle.

"it's based an old demo i sent joe, if im not mistaken."

What is "it?" Are you referring to the demo I posted here? Because this is 100% original code, with the demo mostly just inspired by the latest demo postings of yours. I'm not sure if you are implying that I just adapted your code but I assure you that's not what I did.


Anthony Flack(Posted 2003) [#8]

The actual jumping animation in his model doesn't work well because it has an enormous windup and landing.



Ah, I've fallen into this trap before myself. The competing needs of good animation, and reponsive gameplay. Generally speaking, although I'm a sucker for cool animation sequences, responsiveness has to win over realism, in my book. Unless you're really clever about the AI given to your player character to compensate.


jhocking(Posted 2003) [#9]
Yeah, the pretty cheap but effective trick I am using right now to get around that is to simply have a single frame for jumping instead of an actual jump animation, and then the movement into/out of that pose comes from the built-in blending of the Animate command. Which is why I needed a stretched out vertical pose. The main problem with this, which is pretty easy to fix actually but not what I'm focusing on right now, is that the character is completely static while airborne.


Anthony Flack(Posted 2003) [#10]
My current thinking is - generally, a proper windup to a jump is a bit of a no-no, as you want your character airbourne pretty much straight away. A nice landing animation is okay, but certain other actions should take priority over it (for example, if you pressed the attack button)


(tu) sinu(Posted 2003) [#11]
"it's based an old demo i sent joe, if im not mistaken."

"What is "it?" Are you referring to the demo I posted here? Because this is 100% original code, with the demo mostly just inspired by the latest demo postings of yours. I'm not sure if you are implying that I just adapted your code but I assure you that's not what I did. "

i've seen the source and can see it's 100% original, yours is coded way different to mine and like you said mine just pushed you along :)


jhocking(Posted 2003) [#12]
I just posted a last version to this demo (same zip.) I didn't change the code much; mostly I prettied it up by adding a level (okay, just a room with a bunch of crates to jump on) and redoing animations for the ninja.

I say "last" because, although I will continue working on the camera control system, I doubt I'll be posting any more updated versions of this demo.


Psionic(Posted 2003) [#13]
Ermmm, did you read the readme with the file, it explains the animation ranges and you aren't even close to em :)

try instead:-

ExtractAnimSeq(level1\player,184,205)
ExtractAnimSeq(level1\player,15,30)
ExtractAnimSeq(level1\player, 60,68) ;attack
ExtractAnimSeq(level1\player,126,133)
ExtractAnimSeq(level1\player,146,158)

and also:-

ElseIf characterState=5 And AnimSeq(character)<>5
Animate character,3,-.4,5,4
EndIf

change to -.4 and he does a forward somersault when jumping :)



1-14 Walk (normal)
15-30 Stealth Walk
32-44 Punch and swipe sword
45-59 Swipe and spin sword
60-68 Overhead twohanded downswipe
69-72 Up to block position (play backwards to lower sword if you want)
73-83 Forward kick
84-93 Pick up from floor (or down to crouch at frame 87)
94-102 Jump
103-111 Jump without height (for programmer controlled jumps)
112-125 High jump to Sword Kill (Finish em off move??)
126-133 Side Kick
134-145 Spinning Sword attack (might wanna speed this up in game)
146-158 Backflip
159-165 Climb wall
166-173 Death 1 - Fall back onto ground
174-182 Death 2 - Fall forward onto ground
184-205 Idle 1 - Breathe heavily
206-250 Idle 2
251-300 Idle 3


Psionic(Posted 2003) [#14]
Hey guys! Please try this tweaked version using the actual animation ranges I wrote in the readme.....:)

http://www.psionic3d.co.uk/downloads/ninja_test.zip


jhocking(Posted 2003) [#15]
"did you read the readme with the file"

I did but the ranges you just listed are different than the readme I have. I must have a version where you changed the animation frames but not the readme yet. Whatever; the latest demo I posted uses new animations I created. As I said the model and texture are great, I just had to redo the animation for my needs.

ADDITION: Something else just occurred to me to point out Psionic. Because of how the collision detection system works it is not a good idea to place a character's feet at 0,0,0. If you look at my version of your ninja in Ultimate Unwrap you'll see that I shifted it down so that 0,0,0 is centered, and I use the ground plane established by the position of the feet in the default pose in all my animation. The collision detection system in Blitz assumes that 0,0,0 is center mass for models and thus the collision sphere is always centered on 0,0,0.

Now that I think about it Blitz really should allow you to set the center point for the collision sphere. Using the grid for your ground plane is pretty convenient when animating.


Psionic(Posted 2003) [#16]
I'm pretty sure I uploaded only the finished version! as for anims not looping etc (higher up in the thread) I tested them all in blitz as I went along (and wrote the readme as I went) dunno what happened there m8!

its GREAT to see him running around and somersaulting etc, cool stuff!! Very cool!

any programmers out there need the model centered at 0,0,0?? cant you just offset the collision sphere/ellipsoid etc? to fit?

just asking cus I've never had any probs with this method before?? :)


jhocking(Posted 2003) [#17]
Actually I think I know what happened. I didn't use the readme included in the zip, I got animation frames from one of your older forum posts. I must have downloaded a version of the model made after you wrote your post.

If anyone knows a way to offset the collision sphere I would love to hear it. There's nothing in the command reference in the "Entity Collision" section to do that, the logical place such a command would be documented.


Gabriel(Posted 2003) [#18]
I never attach collisions to a mesh. I always create a pivot, offset the pivot and attach collisions to that. I actually like having models with their feet at 0,0,0. It's how I do my own my own models. The great thing about using a pivot for collisions is that you can have two or more per character. Which is great for doing show-off stuff like making your character automatically duck ( collision with higher pivot but not lower ) or jump ( collision with lower pivot but not higher )