Game Development Community

Showing arms in FPS

by Maximillian Brewer · in Torque Game Engine · 06/12/2009 (4:47 am) · 11 replies

Hi everyone,

I asked in a previous post about how i would go about getting different stances in an FPS i am making, and i have looked around the resources section and am now looking for how to make it not just show the weapon, but you be able to see the arms/arm that is holding the weapon.

This then means that when you pick up ammo, you can make it show a reload animation and watch your guy reload the gun :D

I know that they do this in the ModMakers pack, but i am just not sure how to :D

From Max

#1
06/12/2009 (5:32 am)
First off, the weapon you see in 1st person view isn't always the actual weapon that the player is holding. Sometimes its an 'image' shown on the screen just used for 1st person view. Am I explaining that well? Someone else can probably explain it better.

Anyways, you need a custom animation, with the character animated to reload the weapon, then you have to "render 1st person", to actually see it happen. I think Render 1st Person is a check box or boolean in server/scripts/player.cs.

...checking player.cs

Yep, Its a boolean.

datablock PlayerData(PlayerBody)
{
   renderFirstPerson = false; //HERE IT IS!!!
   emap = true;
   className = Armor;
   ...

By default, its set to "false", which is why Kork can't see his feet when you look down at the ground. All you see is the weapon 'image', not the true weapon that Kork is holding.

Tony
#2
06/12/2009 (7:36 am)
Also do a search for Jakob Dankovchik's 'More realistic first person' resource. Without his changes, I don't think your character's arms will perform any animations in first-person view, unless you want to model them directly onto the weapon.
#3
06/12/2009 (11:18 pm)
@infinitum3D I will have a go at doing what you suggested, but am about to go out, so will test later. Will what you are suggesting mean that if i play an animation for reload for the actual model, it will show up in 1st person??

@Daniel Well i think in the ModMaker pack, they actually model the arms right onto the gun, and use that model as the mount image. if i do this, can i link up animations like reload to the mount image??
#4
06/13/2009 (12:31 am)
Have a look at the example crossbow weapon. Some states, such as the reload state, have animations that are played. It should be easy to figure out how this is done, looking at the ShapeBaseImageData declaration for CrossbowImage.
#5
06/13/2009 (1:09 am)
The whole modeled arms/hands thing in the ModMaker Weapons Kit was done through a LOD trick. The hands were simply modeled and animated to be a part of the weapons at the first and highest level of LOD. Sounds pretty good in theory, but can cause problems if you aren't careful. Depending on the LOD setup (pixel sizes) you run the risk of having 4 hands showing at one time!

There is a one line code hack to force a specific LOD while in first person only, but you still have to determine if you want to use/disable "renderFirstPerson" and run the risk of having 4 hands. Without it (renderFirstPerson) you don't cast a shadow nor do you reflect in a mirror while in 1st person. Thankfully Torque 3D solved that problem and makes things easier :D
#6
06/13/2009 (1:56 am)
I should live on these forums. I went and reinvented the wheel by creating animated arms onto my weapons.

And I thought I was some sort of innovator.

Good to see I'm out of the loop.
#7
06/13/2009 (2:15 am)
@Michael: Well i think i will go with the option to have the mount image the weapon with hands actually attached to it as part of the model.

When you say:

Quote: you run the risk of having 4 hands showing at one time!

You aren't saying this would happen if i choose a mount image (model) that has the hands attached in the first place would it? Coz by choosing the different mount image, what you see is just a trick that shows when in first person mode. And then if you look in a mirror, you wouldn't see the mount image anyway, you see the real model that is mounted

From Max

PS. I will do some testing with this
#8
06/17/2009 (2:13 am)
This is probably going to sound ridiculous and this is my first attempt on helping but here's what i did:

changed the render first person value in 'server/scripts/player.cs' to true

commented out the eyeoffset line in my weapon file i.e. 'server/scripts/gun.cs'

then i simply animate my whole character to do weapon actions i.e. reload aim etc..

#9
06/17/2009 (5:38 am)
The only player 'action' that is directly linked to the weapon Image Finite State Machine is the 'recoil' sequence, in it's update across the network.

I have seen the various 'hacks'/to art to get the player object's skeleton working with the FSM, and it almost never completely 'sells' the effect to me.

What I don't understand about this is...'updating'/bitmasking... is that the 'Recoil' State of the Image forces the Player object to play an armThread seqeunce[a blend in fact]. Why cannot this same type of network 'update' be done to other 'states' of the weaponImage?!?.

To me, this is the proper approach...and the rest is just hackery; which doesn't really suspend my disbelief. I can animate the player and sync up my armThread 'look' sequences to put the weaponImage in the player's HUD with good results, here ; what I need is the 'answer' on how to get the Source code to extend the 'recoil' type behavior to other 'States'....

pages.sbcglobal.net/rexpiscator/_uimages/blendProof.jpg
Here is a super quick 'look' animation I put together for this very old online guide to getting Blends to work out of Milkshape3D...notice how nicely centered the weapon and hands are...no hack there, no 'extra' set of hands...just the weaponImage and my player. Nicely streamlined to fit across the bloody network, no extra LOD's to figure into the equation, just pure weaponImage, the FSM, and the playerObject.

I'll work with any coder willing to delve into this....?!!
#10
06/17/2009 (8:13 am)
I believe that Rex is onto something there :D Been experimenting with something like that for the bloody iron sights thing that people seem to want -- and using animations seems to be the most "pure" way of doing it.
#11
06/17/2009 (9:05 am)
I'm a purist at heart. I like everything to be done "correctly".

However...

Using animations may seem like the most "pure" way of doing things, but everything in a video game is fake. Its all perception. One thing I've learned in my years here is that the "right" way, and the "best" way, and the "pure" way are not always the same, or even close. Everything is a hack, because its all illusion. We're only lighting up pixels on a 2D screen. How you light those pixels is up to you. As long as it looks good (and is efficient), how it happens is unimportant.

Obviously my purist ways are conflicted.

Tony