Forum

Problem with DP's MOVETYPE_WALK :(

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Problem with DP's MOVETYPE_WALK :(

Postby Wazat » Wed Jan 19, 2005 12:23 am

I've noticed a problem with DP's MOVETYPE_WALK on non-clients feature. Actually, it took me ages and AGES of agonizing bug testing to figure out what it was, but I finally located what it is.

It turns out that the engine movement code for MOVETYPE_WALK doesn't seem to care about when you set origins. The bug cropped up for me when I tried to make a non-client respawn, and it kept on appearing either where it died, or at the same spawnpoint over and over again. Many hours later I realized it was linked to the entity's MOVETYPE_WALK. I was able to set origin fine when the entity was MOVETYPE_TOSS, but with WALK I couldn't even accurately set the origin, even when I set it a thousand or so times a second (the entity would spawn in the spot then begin to droop down below the location because of gravity, instead of constantly returning to that spot). So I'm guessing that some engine-side origin variable isn't getting set.

Thankfully I have come up with a hacky fix: set the entity's movetype to TOSS for 0.5 seconds when he respawns, then set it back to WALK afterwords. That way another movetype takes control long enough to get the offending variable reset before WALK takes over again.

However, please fix the bug soon. It's a rather ungainly fix, and MOVETYPE_WALK on non-players is going to be important in this mod. :)
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Wazat
 
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Re: Problem with DP's MOVETYPE_WALK :(

Postby Tei » Wed Jan 19, 2005 12:47 am

looks like the position its reset, so the code ignore the change and continue the movement...

I have to check that.

what engine?
User avatar
Tei
 
Posts: 193
Joined: Mon Oct 25, 2004 12:22 pm

Postby Wazat » Wed Jan 19, 2005 12:54 am

Darkplaces
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Wazat
 
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Postby Urre » Wed Jan 19, 2005 10:08 am

I showed this thread to LordHavoc, and he said he's unsure what causes it, but he has a better workaround. Do this:

Code: Select all
self.oldorigin = self.origin;


AFTER setorigin. It resets because it thinks it's in solid.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Wazat » Wed Jan 19, 2005 5:07 pm

Okay, that makes sense. Just to be sure, I'll redirect the setorigin function to call setorigin_real and then update .oldorigin if the entity's movetype is WALK (as typed below, more or less). That should cover all the bases and keep me from forgetting a spot.

Thanks, Urre and LordHavoc!

Code: Select all
void(entity e,  float org) setorigin =
{
     setorigin_real(e, org);
     if(e.movetype == MOVETYPE_WALK)
         e.oldorigin = e.origin;
};
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Wazat
 
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest