Sign in to follow this  

Realistic PC movement in 1pv/3pv games

This topic is 1278 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Realistic PC movement in 1pv/3pv games

 

its time for me to make some improvements to the basic movement code in Caveman 3.0:

http://www.gamedev.net/blog/1730/entry-2258672-caveman-v30-general-desciption/

 

given:

 

8 directions of movement (forward, back, left, right, and diagonals),

 

3 movement speeds (walk, run, sprint),

 

and 2 movement modes (normal and stealth mode),

 

what combos of the above are realistic?

 

note:  left means sidestep left, right means sidestep right, back means walk / run / sprint backwards.

 

the actual speeds of walk, run, and sprint would be modified by things like fatigue, encumbrance, damage, slowing effects, etc.

 

while you can side step, its not as fast as walking forward. you can side step fast - about as fast as walking forward - but trying to sidestep even faster usually results in tripping. same idea for walking/jogging/running backwards (try it!  but be careful!).

 

 

for non-stealth movement, i'm thinking:

 

* you can walk, run, or sprint forward.

* you can sidestep left and right or walk backwards at 1/2 your forward movement speed, but no sprinting.

* forward diagonal speed should be 3/4 of forward speed, and you can sprint.

* backward diagonal speed is 1/2 of normal speed, and you cant sprint.

 

i'm thinking that for stealth mode, you should only be able to move at 1/2 speed forward, 3/8 speed forward diagonal, and 1/4 speed in all other directions, no sprinting.  

 

once all this is determined, then the slope of the ground in the direction of movement would be applied to speed up or slow down the PC some.

 

I already do this, but based on the slope ahead, not in the direction of movement. 

 

modeling the players horizontal velocity and applying accel/decel for slope, movement, and drag/inertia would work even better. then you'd need some time to come to a stop when running down a big hill.

 

right now, i simply apply both left/right and forward/back movements, resulting in unrealistically fast diagonal speeds. fixing that, and speed based on slope in direction of travel, not direction of view, is what prompted me to update the movement code. so i figured that while i'm at it i ought to try to get it a realistic as possible.

 

so what seems most realistic?

 

 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Realism in movement control is very hard. The major issue of movement is, that the feedback of your action is not really communicatable to player. Eg. when you hit an opponent, you can atleast give some visual feedback (blood, shaking camera etc.), but if you start to trip, move slower while faitigued, sprint etc. it get really hard to communicate all this. I don't think that realistic movements in a game with current hardware is a good idea. Here are some points you should consider:

 

1. The player is used to a certain control behavior. Player will refuse your control scheme, once you start to ignore the standard behaviour (One of the most blamed game features in my game, I changed it now to a more traditional control scheme).

 

2. Communication of feedback is very hard. Try to reduce the feedback to only a handful of actions and try to communicate them clearly. Examples

2a. Instead of getting slower over time (the player will not recognise it most of the time), use a threshold at which the player gets very slow suddenly (faitigued). Add some sound to communicate it (grunt).

2b. When sprinting, add some audio feedback, faster breathing, faster heartbeat etc.

 

3. Always remember to connect a control scheme with a game related feature. If running is only faster than walking, most player will just run all the time, why should they walk at all ? Why should they walk if they can creep in situation where they need precision over speed ? So, where do walking,running,sprinting,creeping differ ? Only speed is not enough, there should be a game related impact.

 

4. Use benefits insteads of disadvantages:

Well, you can punish the player for certain actions (sprinting=>chance to trip and get injured) or you can grant a benefit (sprinting=>quick,but short, way to escape a dangerous situation).

Try to avoid punishments, instead try to give the player some kind of benefit while keeping risk/reward relation. Eg if you have a resource (endurance), sprinting could use this resource. The player will take the benefit (sprinting all the time to travel faster), but although have the risk, that he will be out of endurance when a danger approaches. A similar effect would be to let the player trip and get injured when sprinting, this way he would take a risk for a benefit too. But the risk control is no longer in the hand of the player (the propabiltiy , that he stumbles increases over time, and it will just happen now or then) and a sudden disadvantage will be considered as punishment.

Share this post


Link to post
Share on other sites

Maybe not complicate it with fractional speeds and all what have you... something more like

 

three speeds, walk/run/sprint 

two modes normal/Stealth

 

Fatigue bar.

 

All stealth movement is at walk speed.

Only allow sprinting forward.

 

Sprinting drains Fatigue most quickly.

Running drains fatigue slowly (The tripping is interesting... only req a tripping animation... if running in a direction other than forward while fatigued, chance of trip)

walking slowly replenishes fatigue slowly.

standing quickly replenishes fatigue

 

Moving Stealthily requires that you not be fatigued, but neither drains nor replenishes fatigue.

 

 Realistically, you can just as easily move in any direction at a walking speed without worrying about tripping.. and even moving quickly (running) in any direction doesn't cause someone to trip unless they are to tired to move their legs quickly enough (fatigued). 

 

In terms of realism, the speed at which you can move stealthily is more a function of the terrain than anything else. For example, you can pretty easily run on a concrete floor without making noise, but an old wooden floor requires you test each step to make sure the boards won'y squeak and practically any movement in water (unless it's deep enough that your feet remain submerged) will make a lot of noise.

Share this post


Link to post
Share on other sites


If running is only faster than walking, most player will just run all the time, why should they walk at all ?

 

lower fatigue cost. Fatigue modeling in Caveman 3.0 is pretty in-depth.

 


So, where do walking,running,sprinting,creeping differ ?

 

fatigue costs, and chance of detection.

 


or you can grant a benefit (sprinting=>quick,but short, way to escape a dangerous situation).
Try to avoid punishments, instead try to give the player some kind of benefit while keeping risk/reward relation. Eg if you have a resource (endurance), sprinting could use this resource. The player will take the benefit (sprinting all the time to travel faster), but although have the risk, that he will be out of endurance when a danger approaches.

 

fatigue modeling does this already.

 

it even models fatigue for npc's and animals (monsters).

 


Sprinting drains Fatigue most quickly.
Running drains fatigue slowly (The tripping is interesting... only req a tripping animation... if running in a direction other than forward while fatigued, chance of trip)
walking slowly replenishes fatigue slowly.
standing quickly replenishes fatigue
 
Moving Stealthily requires that you not be fatigued, but neither drains nor replenishes fatigue.

 

fatigue rates are already realistically modeled. 

 

walking increases fatigue. try it sometime. go for a hike in the woods. every couple hours, you have to take 5.

 

only standing, resting, resting and healing, and sedentary activities like daydreaming, cloud watching, and stargazing restore fatigue.

 

as i recall, stealth movement costs extra fatigue. i'd have to check the code. it requires more effort to sneak than walk.

 


Realistically, you can just as easily move in any direction at a walking speed without worrying about tripping.. and even moving quickly (running) in any direction doesn't cause someone to trip unless they are to tired to move their legs quickly enough (fatigued). 

 

but moving at the same pace in different directions results in different speeds due to different step sizes.  a forward step is longer than a side step, which is longer than a back step.

 

side step running only moves you as fast as walking forward.

 

trying to side step and move as fast as you run forward, you trip and fall (or you're unusually coordinated).

 

running backwards only moves you at about the same speed as walking forwards. and again, trying to go faster backwards without tripping and falling is not really happening.

 

go outside and try it. see if you can do it, i sure can't !

 


In terms of realism, the speed at which you can move stealthily is more a function of the terrain than anything else. For example, you can pretty easily run on a concrete floor without making noise, but an old wooden floor requires you test each step to make sure the boards won'y squeak and practically any movement in water (unless it's deep enough that your feet remain submerged) will make a lot of noise.

 

a good point!

 

i was thinking more just about the physical speed limits due to moving while crouched - not how slow you have to go to be silent.  i should probably add some sound detection modeling to the stealth modeling - right now its basically line of sight.  just added it to the todo list!

 

as a related subject, since many things affect the final movement rate, walk run and sprint animations don't always match the movement rate. i may decide to implement continuous variable movement animations. a possible workaround would be to get the final movement speed once all effects are applied (including slope ahead, encumbrance, etc), then play which ever animation (walk, run, or sprint) is closest.

 

i guess my point about realism is the part about the difference in step size and therefore top movement speeds in different directions. that's why i defined left and right as sidestep, not running left / right but looking ahead as some games do. in Caveman, left and right are sidesteps, not walk/run movements.

Share this post


Link to post
Share on other sites

i've started making improvements based on the suggestions here.

 

here's what i've done so far:

 

WASD are translated into a movement in one of 8 directions or no movement, instead of being handled as individual events. as a result, forward left and forward right now move you at 45 degree angles from straight ahead. before it was more like 30 degrees, since forward speed was greater than sideways speed.

 

forward movement is at 100% speed.

 

forward diagonal movement is at 75% speed.

 

all other directions are at 50% speed.

 

speed based on slope is now based on direction of movement, not the slope ahead.

 

here's the factors that determine the base movement speed before direction of movement is considered:

* sneak, walk, run, or sprint. sprint defaults to run if fatigue is too high to sprint. run defaults to walk if fatigue is too high to run. actual speeds were calibrated by setting up a 50 yard dash in the game and timing the PC in the 50. other movement speeds were calibrated in a similar manner, based off of research data.

* PC's speed stat adjusted for encumbrance and intoxicants

* vegetation coverage adjusted by path finding skill

* roughness of terrain

* rock formation coverage adjusted by path finding skill

* PC illness

* PC fatigue modified by intoxicants

* usage of stealth skill

* usage of tracking skill

* wearing foot protection

* carrying drawn weapon

* moving through shallow water

* slope in direction of movement

 

at the moment you can still walk, run, or sprint in any direction (with separate animations for each - talk about a pain!), and sneak speed is 1/2 walk speed, with no running or sprinting in sneak mode.

 

i'm thinking only forward and forward diagonal movement should support sprint speed. its possible to sprint forward diagonally - i used to do it playing soccer.

 

i'm not planning on modeling tripping at high speeds. being able to get lost while travelling cross country is enough of a pain. but it does model intoxication (drunk cam), which makes moving around pretty difficult (and combat nigh impossible!).

Share this post


Link to post
Share on other sites

This topic is 1278 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this