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 mh » Wed Jul 14, 2010 7:15 pm

I wouldn't mind a copy of it, just to test that my fix actually does work with it, before you make any changes to your own engine.

(deleted stuff that wasn't actually needed; mental note to self: read the original code first!!! :oops: )

Also note the nifty "sv_novis" cvar. ;)
Last edited by mh on Wed Jul 14, 2010 9:50 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: 2287
Joined: Sat Jan 12, 2008 1:38 am

Postby Baker » Wed Jul 14, 2010 7:41 pm

goldenboy wrote:That sounds like the cleanest possible solution, but it's probably above my skill level to implement that.


My bsp understanding is limited, but I'd guess it is probably just commenting out this in SV_WriteEntitiesToClient in sv_main.c

Code: Select all
         for (i=0 ; i < ent->num_leafs ; i++)
            if (pvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i]&7) ))
               break;

         if (i == ent->num_leafs)
            continue;      // not visible


mh wrote:Also note the nifty "sv_novis" cvar. ;)


Hmmm :D
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: 3662
Joined: Tue Mar 14, 2006 5:15 am

Postby mh » Wed Jul 14, 2010 7:50 pm

It's BSP entities only isn't it, so you'd need to get the model name (something like pr_strings + ent->v.model), check if the first char is '*', then ignore the PVS test if so.

It's a solution to this problem for sure, but one I'd be dubious about as there is a possibility of alias or instanced brush models also being big enough enough to need a fix. Add enough models to the mix, take a map that's well stocked with even just inline brush models (like ne_tower for example) and you're entering a world of hurt. I just prefer the more general fix, it seems cleaner overall.

Edit: my code works with this one.
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: 2287
Joined: Sat Jan 12, 2008 1:38 am

Postby goldenboy » Wed Jul 14, 2010 9:48 pm

Confirmed, adapted mh's fix to FitzSDL/QS/RMQ engine. Works like a charm. Giant rotating bmodels, here I come.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby mh » Wed Jul 14, 2010 10:19 pm

Oddly enough, it also works perfectly with Enhanced GLQuake (aguirRe's engine) and he doesn't seem to have done anything to particularly fix this one - although I haven't looked too far yet. It does suffer from a "keyname too long" Sys_Error when parsing globals though, on account of the fact that he reduced the max key name length to 32 (from 64).
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: 2287
Joined: Sat Jan 12, 2008 1:38 am

Postby goldenboy » Wed Jul 14, 2010 11:20 pm

Yeah, but I guess it doesn't rotate there.

There is also no flicker when the offending thing is turned into a simple func_wall.

The problem only appears if the thing rotates, and the engine actually supports the rotation, I think.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby mh » Wed Jul 14, 2010 11:25 pm

Of course, you're right (and you had mentioned it before now that I check back).
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: 2287
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Wed Jul 14, 2010 11:47 pm

if (ent->v.solid == SOLID_BSP &&
(ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2]) )
{ // expand for rotation
float max, v;
int i;

max = 0;
for (i=0 ; i<3 ; i++)
{
v =fabs( ent->v.mins[i]);
if (v > max)
max = v;
v =fabs( ent->v.maxs[i]);
if (v > max)
max = v;
}
for (i=0 ; i<3 ; i++)
{
ent->v.absmin[i] = ent->v.origin[i] - max;
ent->v.absmax[i] = ent->v.origin[i] + max;
}
}


that code will pick the biggest axis and assume that all are that large.
On a long thin (bridge) thing, your absmin/absmax is huuuge. It also extends up and down too, by the same distance...
This is even worse if you didn't change the origin in qbsp.

This is why a func_wall is fine, but anything bsp with rotation will flicker, and also why you need so many leafs.
Spike
 
Posts: 2881
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby mh » Wed Jul 14, 2010 11:59 pm

It really should rotate the bbox, then build a new bbox around the rotated coords instead. I wonder though, would it still be possible for an entity to exceed 16 leafs even if that was done? I had originally put my code in to fix the very same problem with an elevator in apsp1.

I wouldn't dispute that handling the bbox better is one way of fixing this specific problem (and should probably be done anyway), but I would argue that it is more of a general problem which needs more of a general solution. It's perfectly possible to construct a huuuuuge brush model that exceeds 16 leafs without even having it rotate, for example, and we haven't even touched on huge alias models yet.
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: 2287
Joined: Sat Jan 12, 2008 1:38 am

Postby r00k » Thu Jul 15, 2010 6:35 am

For some odd reason i have MAX_ENT_LEAFS at 256 ?!?!
i thought it was added for something in the HL map support addition some time ago... overkill?? BTW the model's mins/max are validated in the loader code.

I've reverted to 16 leafs, and implemented MH's code for testing. (seems to work on normal maps).

@GB: do u have your rotating ent in a small 1 room map that i can test this rotation with?
r00k
 
Posts: 1108
Joined: Sat Nov 13, 2004 10:39 pm

Postby Spike » Thu Jul 15, 2010 7:56 am

from memory, halflife has a limit of 64 leafs.

the more complex the map (detail), the more leafs you need for the same sized object.
Spike
 
Posts: 2881
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby goldenboy » Thu Jul 15, 2010 5:55 pm

rook, no, but I can send you the map. Will PM you.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby r00k » Fri Jul 16, 2010 2:28 am

Cool, thanks. I would want Qrack to definitely support your mod out of the box when its available.
r00k
 
Posts: 1108
Joined: Sat Nov 13, 2004 10:39 pm

Postby Baker » Fri Jul 16, 2010 2:56 am

r00k wrote:Cool, thanks. I would want Qrack to definitely support your mod out of the box when its available.


To get phat map capacity, take FitzQuake 0.80 and FitzQuake 0.85 and WinMerge (or whatever you prefer).

Metlslime documented it very well.
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: 3662
Joined: Tue Mar 14, 2006 5:15 am

Postby goldenboy » Fri Jul 16, 2010 3:32 am

r00k: Like Baker said, start with phat map capacity, skyboxes, fog, alpha, support -sndspeed 44100, raise static entities limit to like 1024, raise max_channels, modify Read/WriteCoord for higher map size limit and include this rotation stuff with the smooth angles fix and the flicker fix.

RMQ's engine source is available at my blog. We declared our collection of hacks protocol 999.

We have this evil plan to add csqc support, so be warned. ;-)
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

PreviousNext

Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest