Forum

Avirox's Rotation Tutorial Adapted to NetQuake

Post tutorials on how to do certain tasks within game or engine code here.

Moderator: InsideQC Admins

Postby Spike » Sun Apr 10, 2011 9:26 pm

-1 and -2 mean 'up' or 'down', don't remember exactly which is which. So those are proper and required values.

worldmodel with angle -92 makes no sense, although its possible it was some hidden flag for some specific mod, but I'm unaware of which it could be.
Spike
 
Posts: 2853
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby mh » Sun Apr 10, 2011 9:43 pm

Hmmm; this is where my mapping-fu hits it's limits, but I do believe you're correct there and that these are legal values indeed. Which means that this is a slightly more insidious problem as we have a case of legal values causing trouble.

I wonder if checking for - and clearing - an "angle" (not "angles") of -1 or -2 on map load would be a more robust solution? Probably not. Although these values are explicitly used for nothing else (up to and including map load time) aren't they, so maybe it is safe? Unfortunate that ID chose a field that has two different uses with no clear distinction. Would have been better to create a new _ field and throw it away in the compiler. (Edit - I think that's probably all rubbish as QC uses them, doesn't it?)

Angles set in worldspawn are nothing new by the way, e3m3 has them too.
Last edited by mh on Sun Apr 10, 2011 9:48 pm, edited 1 time in total.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2283
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Sun Apr 10, 2011 9:47 pm

mh wrote:I wonder if checking for - and clearing - an "angle" (not "angles") of -1 or -2 on map load would be a more robust solution? Probably not. Although these values are explicitly used for nothing else (up to and including map load time) aren't they, so maybe it is safe?


Not possible. See SetMovedir in subs.qc.
Spike
 
Posts: 2853
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby mh » Sun Apr 10, 2011 9:49 pm

You just trumped my edit! :lol:
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2283
Joined: Sat Jan 12, 2008 1:38 am

Postby mh » Sun Apr 10, 2011 10:20 pm

Hmmm, SetMovedir just seems to be called from spawn functions, and it also clears the angles to (0, 0, 0) when done. At least in a clean QC it should.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2283
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Sun Apr 10, 2011 11:18 pm

yeah, the problem is that its not called from every spawn function.
so if someone sets that setting and changes entity type or something, it has the wrong angles.
entity-type-specific mapper bug perhaps.
you still generally can't assume that its not a valid value unless you specifically check for entity names and mods, or something. you can make special-case hacks I suppose, but they may break some misc mods.
Spike
 
Posts: 2853
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby mh » Sun Apr 10, 2011 11:21 pm

I've no interest in special-case hacks. Evil ugly little things.

I guess the most robust approach then is to revert back to what ID Quake did in cases where the angle being written is -1 or -2; something like what I've outlined here: viewtopic.php?t=3184&start=5

At least it feels less dirty than the previous hack I'd proposed...
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2283
Joined: Sat Jan 12, 2008 1:38 am

Postby metlslime » Mon Apr 11, 2011 6:52 am

I've seen this before, and it's as you say, the result of better rounding with a yaw of 1. This happens in fitzquake even with protocol 15, since i do "better" rounding in all cases.

Technically it is a map bug because the mapper intended it to have a yaw of 0, but obviously engine changes that create symptoms can be considered engine bugs too.

Might be a good reason to revert to "bad" rounding for everything that isn't player aiming.
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby mh » Mon Apr 11, 2011 4:54 pm

angles[1] is the only one that needs special handling though; [0] and [2] can keep the rounding.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2283
Joined: Sat Jan 12, 2008 1:38 am

Re: Avirox's Rotation Tutorial Adapted to NetQuake

Postby ericw » Sat May 23, 2015 6:14 pm

Was playing with this recently. gb's and baker's test maps are very cool.
I made another little test map that requires no special qc:
http://quaketastic.com/files/misc/bboxangletest.zip

The focus was to look at how engine bbox rotation could break old vanilla quake maps.
There's a drawbridge that's half open (func_train with "angles" "-32 0 0"). In the map/bsp, the bridge lies flat on the floor. Depending on whether then engine does bbox rotation you either clip through the half-open bridge, or walk up the ramp.
In hindsight I think it's basically a safe change (with regard to breaking vanilla content), because I think the bbox -not- rotation when you mess with "angles" could be considered a bug, and I think it's an unlikely kind of bug for mappers/modders to have exploited.


One note: my test map seems to give trouble in RMQe and DirectQ. As soon as you touch the bridge you sink in and get stuck. I know those aren't maintained, but this might be a useful debug test case if you're still using the same collision code in your research engine, mh,
ericw
 
Posts: 90
Joined: Sat Jan 18, 2014 2:11 am

Re: Avirox's Rotation Tutorial Adapted to NetQuake

Postby mh » Thu Feb 16, 2017 4:01 pm

What a fascinating re-read.

ericw wrote:One note: my test map seems to give trouble in RMQe and DirectQ. As soon as you touch the bridge you sink in and get stuck. I know those aren't maintained, but this might be a useful debug test case if you're still using the same collision code in your research engine, mh,


This was caused by the SV_RotateBBoxToAbsMinMax function I posted on the previous page. Reverting it to the code in Baker's original first post is sufficient to fix (at the expense of generating a larger bbox, of course).

I think this is an interesting enough problem to warrant further investigation. I don't curently have the capability to show server-side bboxes in my test engine, so I might port the rotation code to a Fitz-derivative and try to break it again with my messed-up function.

At the rate this thread is updating that might well be some time in 2019. :biggrin:
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2283
Joined: Sat Jan 12, 2008 1:38 am

Previous

Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest