Basics for an FPS game

Posted By: CyberGhost

Basics for an FPS game - 07/10/15 19:25

Where can I learn the basics for the player behaviour in an FPS game, especially the code for motion, gravity and jumping?

I have been working on that for a few days and I always get weird bugs ,especially when it comes to gravity and collision ....
Posted By: DLively

Re: Basics for an FPS game - 07/10/15 23:57

Check out my youtube channel laugh
Posted By: CyberGhost

Re: Basics for an FPS game - 07/11/15 14:04

The problem is that this distance_to_ground gravity method doesn't work for me. I keep manipulating all the values and tried many stuff, but many times the player keeps flying or ascending upwards. And even the video_screen variable makes some bugs in gravity although it shouldn't be related to all that .....

I think I need another kind of gravity/jumping code frown ....
Posted By: Superku

Re: Basics for an FPS game - 07/11/15 14:29

Have you seen the following tip yet?
http://opserver.de/swik10/index.php?title=Gravity
Posted By: CyberGhost

Re: Basics for an FPS game - 07/12/15 10:55

It worked fine ,but the player gets on some models/blocks so easily. I mean these models have some height and the player should just stop when encountering them because they are high a little bit and I am not jumping. However, the player 'jumps' automatically on them ...
Posted By: Ch40zzC0d3r

Re: Basics for an FPS game - 07/12/15 13:07

Srsly, if you would have read the tutorial instead of just copy and pasting you would know what code you have to change to fit your needs.
Posted By: CyberGhost

Re: Basics for an FPS game - 07/12/15 15:59

Originally Posted By: Ch40zzC0d3r
Srsly, if you would have read the tutorial instead of just copy and pasting you would know what code you have to change to fit your needs.


"Srsly" I already read the tutorial and tried several times but this still happens. And btw., the downloadable code has some stuff that are not mentioned at all in the tutorial.

Please, if you don't want to give a helping reply, don't post in this thread
Posted By: EpsiloN

Re: Basics for an FPS game - 07/12/15 20:08

Try on your own, starting simple. Just applying a z motion !AFTER!(in a separate call) a forward or side motion.
Then, limit the feet height, as your model will probably sink a little...and then build on that base what ever you want.

I'm saying this in general, because there are many ways to limit the feet and to implement jumping. I am limiting the z height of the feet with c_trace calls downward in my game...

Basically, its a struggle to get a bug-free FPS movement with jumping and proper collision. But there are numerous ways you can try and build it.

PS.: Tip - always try to avoid glide as much as you can. Use it only when you really need it. It uses up to 6? c_move calls to make your entity glide, it produces seemingly random results every time and its a nightmare when you come to the MP programming for movement and synchronization grin
For gravity, it'll be too advanced, but you can always try to implement gliding on your own along a surface normal...But thats for when you have the proper gravity method already.
© 2024 lite-C Forums