[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Preventing client velocity/angles input

Preventing client velocity/angles input

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Preventing client velocity/angles input

Postby mankrip » Wed Aug 29, 2012 1:59 am

Is there any way to make the server physics completely ignore the velocity and/or angles input from the client, without reimplementing SV_PlayerPhysics in QC through the DP_SV_PLAYERPHYSICS extension? I'm using FTE.

If I could just set something like an hypothetical self.phys_cl_input_flags = NO_VELOCITY|NO_ANGLES; filter, while still being able to read the client's intentions through self.movement, that would be perfect.

The only other way I could think of doing this would be to stuffcmd the movement cvars (backspeed, forwardspeed, etc.) to zero, but this would be too unreliable.

By the way, is there a .movement equivalent extension for the angles?
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
/ /
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Re: Preventing client velocity/angles input

Postby Spike » Wed Aug 29, 2012 2:50 am

the engine kinda forces it.
There's not much you can do, as the movement must match the values in the client or prediction breaks, thus any change must be client-visible.

you can use .float maxspeed; set that to something small and the player won't be able to move much. They can probably still stop, however.
Regarding angles, you'll just have to reset the angles value to what you feel it should be within PlayerPostThink, which will work for what other people see them as but that won't affect their own viewing angle (unless you fixangles it, which gets very spammy and thus bad).

Angles are sent as an absolute value, so v_angle _is_ the equivelent of .movement... Its just absolute instead of relative. You can track the differences between updates in PlayerPreThink or whereever.


You can also change the prediction code itself (a bit like DP_SV_PLAYERPHYSICS, but more comprehensive thus bypassing the drawbacks). This is the ssqc version:
void() SV_RunClientCommand =
{
input_angles = theanglesthatIwanted;
input_movement = someoverriddenmovement;
runstandardplayerphysics(self);
};
Note that csqc and ssqc both have the same 'runstandardplayerphysics' builtin available, which reads input_* globals, which are set by the engine before SV_RunClientCommand is called.
Thus, you can either implement your own physics, or you can just directly use the engine's player physics with a few input modifiers overriding what the client sent.
But beware, those input modifiers WILL BREAK PREDICTION.
This will not change the angle the player is looking in, nor even the angle of their model. For that, you'll have to explicitly set self.angles to change the angle of their model (save off their v_angle in PlayerPostThink and use it in SV_RunClientCommand perhaps), and self.fixangles=true to get the server to tell the client to force its view angles to match the angle their model/entity is looking in. Which is often a bit weird because v_angle_x is 3 times the angles_x value...

To avoid breaking prediction, you'll need to use csqc instead.
CSQC is the best option for keeping player angles locked as well, as it does not require fixangles spam.
If you're okay with csqc, you can make a really small mod, with just a void() CSQC_Input_Frame; function in it, within which you can override the values of the various input_* globals. This will completely override anything that it sent to the server. Note that there is latency between when some presumably-stat-based flag is set on the server and when the client receives notification of that, so you'll likely want to consider code in both places, to keep server physics correct and to keep them smooth.
You can also explicitly override the view angle in either your draw function, or by calling setproperty(VF_CL_VIEWANGLES, yourforcedangle); both of which will remove the need to spam fixangles.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Preventing client velocity/angles input

Postby ceriux » Fri Aug 31, 2012 4:39 pm

i do this is playerprethink to stop velocity so my player doesnt move during a menu.

if(self.menu > 0)//*ceriux*
{

self.velocity_x = 0;
self.velocity_y = 0; // if the menu is up you cant move *ceriux*
self.velocity_z = 0;

}//*ceriux*
you could also set self.angles or something to be static i believe.
User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Preventing client velocity/angles input

Postby mankrip » Wed Sep 05, 2012 4:21 am

Does setting .maxspeed also break prediction? It's the only thing I'm not sure if I understood.

But thanks a lot for the tips. Right now I'm using .movement, .maxspeed and spamming fixangles, but I'll eventually switch to csqc at the end of the project.

Setting .maxspeed to zero doesn't work (it seems to mimic the .alpha standard of "only use non-standard features on entities that explicitly sets them"), and setting it to very low values wouldn't be accurate enough for me, but setting it to negative values does the trick.

On a side note, the horizontal scale of the numbers in the intermission screen in FTEQW is wrong:
Image
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
/ /
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Re: Preventing client velocity/angles input

Postby Spike » Wed Sep 05, 2012 5:07 am

maxspeed is networked, so there might be a small hitch when its changed, but should not persist.
maxspeed = 0 means no extra limit (ie: sv_maxspeed), like alpha. if a negative value works better than a small value, go with it.

will fix the intermission alignment next time I commit.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Preventing client velocity/angles input

Postby ceriux » Wed Sep 05, 2012 5:50 pm

why do you want to change max speed? isnt that a global on the server? i still think spamming velocity is the best way to alter movement maxspeed effects all players.
User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Preventing client velocity/angles input

Postby Spike » Wed Sep 05, 2012 5:55 pm

the sv_maxspeed cvar affects all players.
.float maxspeed; is specific to the player. it just stops them from being able to move, in a way that does not result in prediction messing up.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Preventing client velocity/angles input

Postby Seven » Tue Nov 13, 2012 9:34 am

Thank you mankrip, Spike and ceriux.

I am currently working on a new monster implementation in Quake and needed your input regarding player movement.
The new monster has a ranged attack which will temporary 'freeze' the player if he got hit by it.
Your .float ideas in playerprethink work like a charm.

Thanks again,
Seven
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Preventing client velocity/angles input

Postby ceriux » Tue Nov 13, 2012 3:23 pm

couldnt you have just set the players self.nextthink to like time+x or something then reset it after time +x?

or does the player not have a nextthink?
User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Preventing client velocity/angles input

Postby gnounc » Tue Nov 13, 2012 4:21 pm

think points to a function, its for ai routines (monsters and items).
i dont believe the players movements rely on thinks as they dont rely on ai,
so setting its nextthink to something higher than time wouldnt restrict anything at all.

however, you can see an example of the player using thinks to change level during intermission screen
my
gnounc's
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am

Re: Preventing client velocity/angles input

Postby Seven » Tue Nov 13, 2012 4:38 pm

Yes, I think gnounc is right.
The players physics and stuff are called every frame.

Regarding my post:
The player must be able to look around and shoot, when he is "stuck" to a place by the monsters ranged attack.
It is a spider who spits out a net (to be specific) which holds the player at its place for a short time.
So ceriux´s idea with self.velocity_x/y/z = 0 in playerprethink is ideal for that. :)
I set/control the "frozen_time" via a specific .float function (analog to: self.pain_finished for example).

If the player would not be able to do anything at all, it would be too hard...
This way it is fun to play against this new monster, which moves fast and does other tricks as well.

Thank you again.
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Preventing client velocity/angles input

Postby r00k » Tue Nov 13, 2012 11:30 pm

What is your purpose for it?, Can you just keep updating the angle u want to force in playerprethink and postthink
when u try moving the mouse the view just blurs a little as it snaps back.
r00k
 
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Preventing client velocity/angles input

Postby Seven » Wed Nov 14, 2012 9:48 am

Hello r00k,

The purpose I described in the above posts:
A new monster (= spider-like creature) in Quake has a ranged attack (= spits out a net).
When the players gets hit by this net, he will be stucked to the ground (unable to move).
But he still can look around and shoot (otherwise it would be too hard).
This way he is able to still shoot the monsters around him, but he cannot move (only for a short time).

If I dont allow him to look around, he will not be able to "defend" himself, because he cannot aim.
That would be too hard I guess.
The spider would continue to spit nets and goes over to melee attack mode --> player is dead ;)
The spider can also do the demon jump (very far jump) towards the player.
That is his 2nd attack mode.
I am not quite sure how to determin which attack mode is the best for each situation.
Maybe depending on the distance I will randomly choose between "net" and "jump".
Meele attack is clear though (like the demon has). Spider has 3 different meele attack types.

Here are some animation frame screenshots:
walk:

spit out net:

behind:

emerge from the underground:

bite:


The model is from Psionic. I would never be able to create such a beauty.
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Preventing client velocity/angles input

Postby ceriux » Wed Nov 14, 2012 1:12 pm

awesome model did you make it?
User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Preventing client velocity/angles input

Postby frag.machine » Wed Nov 14, 2012 10:16 pm

I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2120
Joined: Sat Nov 25, 2006 1:49 pm

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest