Gravity, Movement

Discuss programming in the QuakeC language.
Post Reply
SusanMDK
Posts: 601
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Gravity, Movement

Post by SusanMDK »

I set sv_gravity to 0 in my flight game, and then did some movement code for the monsters that alters their velocity to move them. I also made them use a MonsterPhysics function that is basically just a duplicate of SV_PlayerPhysics (which is currently just flight movement), so their movement should be similar to player's movement? I'll probably make the monsters just use the player's function, not much point duplicating it.

Sometime earlier I was trying some alternate flight mode for the monsters (the Quake default FL_FLY sucks), but it didn't work so well with sv_gravity being non zero. They just bounced up and down annoyingly, as they tried to counter the gravity and sometimes still need to be able to move down. That sucked.

I was thinking I'd keep the sv_gravity at 0, and do my own gravity with QC. Then the flying monsters can fly without bouncing up and down insanely, and still be pushed around by damage. Walking monsters could walk if they're touching the floor, or fall if in air. Would this sort of thing work for all entities? Gravity affected missiles should probably run the function too. If I do the gravity in SV_PlayerPhysics for all entities.. and if non player entities run the function every 0.1s, do they fall slower than player? Does player run it every 0.01s or faster?

And some other thing, earlier in Blaze when I made player have air control when jumping, player just ran up all the steep slopes that he couldn't without the air control. I tried increasing the downward z velocity on certain conditions, but I just didn't get it right. Some of it made player unable to move up any slope, or suddenly stomp into the floor when being a little bit in the air over a slope, or just flat floor. I think I'll probably encounter this air control problem even with custom gravity.
zbang!
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Gravity, Movement

Post by frag.machine »

Leave sv_gravity with the default value and set the .gravity field to zero for every flying entity.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Gravity, Movement

Post by Spike »

.gravity=0 is default, and won't do anything.

SV_PlayerPhysics won't do anything for entities that are not players.
SusanMDK
Posts: 601
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Re: Gravity, Movement

Post by SusanMDK »

Well, if I make the monsters run the function in their thinks... Anyway, I tried something about this, at first just for player.

Results: I was able to make player not run up too steep slopes, it was sort of like in Quake2. You could run it up for a bit, but then you slide down. Also player was able to stand on walkable slopes without slowly sliding down. Other stuff didn't work so well. When player was standing on the edge of some drop, half on ground side, half on the drop side.. Player was no longer considered to be ongrond, and could no longer jump, which made jumping difficult. If player ended up sliding some steep slopes into a place with steep slopes in all directions, but still some kind of "path" between, player couldn't even walk. And sometimes when player was at that edge of the drop, he got stuck.

And then eventually I messed up my SV_PlayerPhysics so bad that when I enabled the default gravity, it was some low gravity. Maybe there was some heavy air friction.

I think if I could get it work, it would allow me better control how the game works. For now I'll just stick with the default, and my usual things in SV_PlayerPhysics... maybe have another go at trying to prevent player from running up the steep slopes with air control, and another go at alternate flight mode for flying monsters with gravity on.
zbang!
Post Reply