Forum

Quick CSQC question

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Quick CSQC question

Postby soxinthebox » Wed Aug 18, 2010 6:40 am

Hi guys,
I'm trying to roll the player's view around the view angle and can't seem to find any examples of this being done. Would I be correct in assuming that it isn't possible using SVQC and would have to be done using CSQC?

I am completely at a loss with CSQC (aside from altering the HUD) and was hoping someone could point me in the right direction.

Thanks :)
soxinthebox
 
Posts: 6
Joined: Mon Aug 24, 2009 12:22 am

Postby Spike » Wed Aug 18, 2010 6:45 am

in your CSQC_UpdateView function, or some child function, call setviewprop(VF_ANGLES, replacementangles) in order to change the angle of the view (same method as moving the view around on the screen or in 3d space, just different property names).
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Karatorian » Wed Aug 18, 2010 6:20 pm

I wouldn't be so sure it's not possible server side, although, I've never looked. If not possible on vanilla, I be quite surprised if there's not an extension for it.

I'll let you know if I find anything.
Karatorian
 
Posts: 31
Joined: Tue Aug 17, 2010 4:26 am
Location: Rindge, NH, USA

Postby Spike » Wed Aug 18, 2010 6:57 pm

self.angles = foo;
self.fixangles = TRUE;

note that this also affects v_angles (with some lag), and thus feeds back into angles too. Does work with any engine though.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby GiffE » Wed Aug 18, 2010 7:38 pm

Code: Select all
   msg_entity = self;
   WriteByte (MSG_ONE,SVC_SETANGLE);
   WriteAngle (MSG_ONE,self.v_angle_x);
   WriteAngle (MSG_ONE,self.v_angle_y);
   WriteAngle (MSG_ONE,self.v_angle_z + 20);

Rolls your view 20 degrees to the left. This is in ssqc, no csqc needed. Especially since the default (mouse) controls have no effect on roll, you shouldn't have to worry about updating the angle.. its a 1 time deal.
GiffE
 
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT

Postby Karatorian » Wed Aug 18, 2010 7:42 pm

As I figured. No CSQC required. (CSQC rocks though.)
Karatorian
 
Posts: 31
Joined: Tue Aug 17, 2010 4:26 am
Location: Rindge, NH, USA

Postby Sajt » Thu Aug 19, 2010 2:24 am

Urrrr, except the solutions mentioned are not practical in any way unless you're setting the camera angle once and for all :P
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby soxinthebox » Thu Aug 19, 2010 4:20 am

GiffE wrote:
Code: Select all
   msg_entity = self;
   WriteByte (MSG_ONE,SVC_SETANGLE);
   WriteAngle (MSG_ONE,self.v_angle_x);
   WriteAngle (MSG_ONE,self.v_angle_y);
   WriteAngle (MSG_ONE,self.v_angle_z + 20);

Rolls your view 20 degrees to the left. This is in ssqc, no csqc needed. Especially since the default (mouse) controls have no effect on roll, you shouldn't have to worry about updating the angle.. its a 1 time deal.


Cheers I'll give that a go later tonight. I was hoping to bind it to an impulse so I could change the view at will.
soxinthebox
 
Posts: 6
Joined: Mon Aug 24, 2009 12:22 am

Postby Karatorian » Fri Aug 20, 2010 6:12 am

Sajt wrote:Urrrr, except the solutions mentioned are not practical in any way unless you're setting the camera angle once and for all


Why aren't they practical? You could abstract it and send the update every frame in PlayerPostThink or something. Or is there something I'm missing?
Karatorian
 
Posts: 31
Joined: Tue Aug 17, 2010 4:26 am
Location: Rindge, NH, USA

Postby Sajt » Fri Aug 20, 2010 6:33 am

So the client gets a "snap" from the server every server frame (which does not equal every client frame). Now his view angles stutter and lag (I think). SVC_SETANGLE or fixangle aren't meant to be used every frame. You could use SVC_SETANGLE per frame, maybe (for something like a Duke3D security camera that automatically yaws left and right), but you'd want to zero the client's mouse sensitivity and yaw/pitchspeed cvars first, and it would still be choppy and laggy. Well, at least I THINK it doesn't get lerped...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby Karatorian » Sat Aug 21, 2010 8:51 pm

Well, if I recall correctly, the server framerate is usually 72 fps. That's actually faster than what I usually get client-side (yes, I know my hardware sucks), so it should be as smooth (on my setup) as anything else in the world.

On the other hand, I can see how it would be a problem, in some situations, if it doesn't get interpolated. It seems kinda odd that it wouldn't though. Has it just been overlooked because it hasn't been traditionally used in Quake and mods?

So, I guess CSQC would lead to more consistent results.
Karatorian
 
Posts: 31
Joined: Tue Aug 17, 2010 4:26 am
Location: Rindge, NH, USA

Postby Sajt » Sun Aug 22, 2010 12:09 am

I think sys_ticrate is how often the server sends updates to the client, and it's either 10fps or 20fps by default in NetQuake.

Anyway, someone can try the server-side method and get back to us on how it worked out. If it were me, though, I wouldn't even try. (What is this for, anyway?)
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby Baker » Sun Aug 22, 2010 1:28 am

Sajt wrote:Anyway, someone can try the server-side method and get back to us on how it worked out.


RuneQuake rune of weirdness has (had) that.

Actually the Rune of Weirdness dates back to original Artifact Quake.

That being said, for years if you got the weirdness effect, if would screw up your angles for the rest of the game. Sometime rather recent in history, maybe in the last 4 years or far more recently, either that particular effect was dropped due to the angles issue or fixed.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby GiffE » Sun Aug 22, 2010 1:39 am

Well alternatively you could in csqc:
Code: Select all
R_SetView(VF_ANGLES_Z,20);

In Update View, and have it initiated by a temp entity. That would allow you to "roll to ideal" instead of just jerking to the angle.
GiffE
 
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT

Postby soxinthebox » Mon Aug 23, 2010 2:50 am

I gave the code a go which did roll the view like I wanted but I couldn't really figure out how to consistently roll it the correct way. For instance if I rolled 180 the view wouldn't necessarily flip over and I couldn't consistently produce the same results. Does QC not use 360 degrees of rotation?

Cheers for the help so far :)

Sajt wrote: If it were me, though, I wouldn't even try. (What is this for, anyway?)


Just messing with the engine and seeing if I could flip the view 180 without rotating the map. Walking on the ceiling is the aim, then later the walls which will be more neat if I could rotate the view to match.
soxinthebox
 
Posts: 6
Joined: Mon Aug 24, 2009 12:22 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest