#1470 posted by Lunaran on 2014/07/13 05:46:08
In WaterMove()
if (! (self.flags & FL_WATERJUMP) )
self.velocity = self.velocity - 0.8*wl*frametime*self.velocity;
self.velocity is reduced by an amount that is scaled by frametime, when self.velocity itself is not a framerate-relative variable. I also notice that the player doesn't actually move any slower in liquids. Is this a typo or another weird QCism?
#1471 posted by necros on 2014/07/13 05:52:14
doing frametime * self.velocity gives you the amount of movement for that frame.
#1472 posted by Lunaran on 2014/07/13 06:03:53
Yes, I understand that. The player isn't being moved there. The player isn't moved in qc at all, except when teleported, only his velocity - in units per second - is manipulated. The physics moves him.
#1473 posted by necros on 2014/07/13 06:05:29
I must have misunderstood what you meant then. Why do you say that velocity is not framerate relative?
#1474 posted by necros on 2014/07/13 06:06:41
Oh, ok, I see. Yes, so velocity itself is not framerate dependant; it's constant. But because we want to reduce speed by a constant amount, we have to multiply by the (varying) frametime to get the constant amount to reduce per frame.
#1475 posted by Lunaran on 2014/07/13 06:11:53
... because it's in units per second.
Your framerate can vary as much as it wants and your velocity in units per second just is what it is. The amount the engine moves you per frame is different, but that's not the progs's business.
Okay, look.
if (! (self.flags & FL_WATERJUMP) )
self.velocity = self.velocity - 0.8*wl*frametime*self.velocity;
wl is waterlevel, which if you're in over your head is 3. Let's say self.velocity is '100 0 0'. Let's also say the framerate is 60, so frametime = 0.01666.
0.8 * 3 * 0.01666 * '100 0 0' works out to '4 0 0', so the player's velocity when underwater is reduced to '96 0 0'. What's the point?
#1476 posted by Lunaran on 2014/07/13 06:12:50
Shit I see, this is applying additional friction?
#1477 posted by Lunaran on 2014/07/13 06:15:51
Well, I commented it out and the player still slows to a halt when swimming underwater, so the engine clearly applies underwater drag anyway. So I'm still not clear on the purpose of those two lines.
#1478 posted by necros on 2014/07/13 06:44:45
interesting, you're quite right:
void SV_WaterMove (void)
{
int i;
vec3_t wishvel;
float speed, newspeed, wishspeed, addspeed, accelspeed;
//
// user intentions
//
AngleVectors (sv_player->v.v_angle, forward, right, up);
for (i=0 ; i<3 ; i++)
wishvel[i] = forward[i]*cmd.forwardmove + right[i]*cmd.sidemove;
if (!cmd.forwardmove && !cmd.sidemove && !cmd.upmove)
wishvel[2] -= 60; // drift towards bottom
else
wishvel[2] += cmd.upmove;
wishspeed = Length(wishvel);
if (wishspeed > sv_maxspeed.value)
{
VectorScale (wishvel, sv_maxspeed.value/wishspeed, wishvel);
wishspeed = sv_maxspeed.value;
}
wishspeed *= 0.7;
//
// water friction
//
speed = Length (velocity);
if (speed)
{
newspeed = speed - host_frametime * speed * sv_friction.value;
if (newspeed < 0)
newspeed = 0;
VectorScale (velocity, newspeed/speed, velocity);
}
else
newspeed = 0;
//
// water acceleration
//
if (!wishspeed)
return;
addspeed = wishspeed - newspeed;
if (addspeed <= 0)
return;
VectorNormalize (wishvel);
accelspeed = sv_accelerate.value * wishspeed * host_frametime;
if (accelspeed > addspeed)
accelspeed = addspeed;
for (i=0 ; i<3 ; i++)
velocity[i] += accelspeed * wishvel[i];
}
seems to apply normal ground friction while in the water, and then the qc is apply extra friction.
you can see this in action by setting sv_friction to 0. you'll slide forever on ground, but in the water, you will still slow down.
very bizzare.
#1479 posted by necros on 2014/07/13 06:47:17
i suppose... at some point they wanted the player to move slower than normal friction reduction..?
maybe it was easier to do it in QC than to modify the engine.
is there QC from the older version of the progs? maybe this was added in a later version?
#1480 posted by Lunaran on 2014/07/13 07:34:27
It's like that in the 1.06 progs.
Also, this doesn't actually apply friction either, since player velocity is overridden by the exe based on the player's controls. It acts as a max speed cap, one that caps speed at 96%.
I'm leaning towards cruft/typo.
Higher Friction
#1481 posted by Preach on 2014/07/13 10:49:26
This still does the work of creating extra friction and should be left in. It doesn't have much effect when the player is actively swimming in a direction, as the new input tends to overcome the subtracted velocity every frame. It is important for when the player's velocity is not coming from input, like coming to a halt after the player stops swimming. Another example is where the player enters the water with a higher velocity than they can achieve by normal movement - like if they're falling from height into the water. Remove that code and the player will plunge deeper after falls into water, and there's a bigger chance they'll take fall damage from the bottom despite the water.
#1482 posted by Spike on 2014/07/13 15:21:47
96% might not be big, but remember that its 96% every single frame.
it builds up.
quakeworld killed most velocity changes in the qc thankfully. the only one left is from damage. This was basically required for reliable prediction.
Darkplaces Black And White
#1483 posted by Qmaster on 2014/07/19 18:57:01
Is there a way to modify the color saturation in the DarkPlaces engine? I was curious about making an infrared vision effect by making the colors black and white, enabling fullbright, and setting fog to black with a short falloff, and maybe also toying with hdr settings to simulate eyes hurting from bright lights. Anyways are there hsv settings I'm missing?
QC
#1484 posted by digs on 2014/07/21 05:49:57
Where I can download sources v1.06 (*.qc) with fixed problems?
Digs
#1485 posted by madfox on 2014/07/21 08:22:29
Maybe try this one?
Or the wike tools
originals from 3D
MadFox
#1486 posted by digs on 2014/07/21 08:50:27
Thanks, but:
1. Looks like it's not single player sources
2&3. versions without fixed bugs
Yes
#1487 posted by madfox on 2014/07/22 00:31:50
After downloading I also was surprised to find a mod progs.
I searched my whole archive as I was sure I downloaded it.
Can't find it though.
Seven made a new progs but it only works in DarkPlaces.
I wonder if the errors that appear in FTEQcc can be overcome by new coding, on behalve of the double count rotfish.
@digs
#1488 posted by Baker on 2014/07/22 00:56:17
This one is probably the best with all the SP fixes:
https://gitorious.org/quakec-v1-01-clean
It took changes from "clean source" and "qip bug fixes" and combined it into one.
(Ignore the fact it says "1.01" -- that was the GPL base, you don't want to know more ...)
@Baker
#1489 posted by digs on 2014/07/22 04:22:51
Thanks!
After compile a have same 7 warnings. Example
doors.qc:626: warning F307: type mismatch: void() to void(entity attacker, float damage) entity.th_pain
doors:626: self.th_pain = SUB_Null;
function th_pain require 2 params, SUB_Null without params. Is it will work correctly?
#1490 posted by Qmaster on 2014/07/22 06:30:10
#1491 posted by Qmaster on 2014/07/22 06:31:56
should work fine, see the 3 or 4 posts in the forum link above.
#1492 posted by digs on 2014/07/22 07:26:42
@QMaster thanks
Got A Tricky One
#1493 posted by ijed on 2014/07/23 15:28:30
So, I'm spawning monsters after the start of a level. Not just hiding them and then turning them on later, but actually creating new monster entities.
This involves a lot of tricky with spawn functions and precaches, but it works fine (props to gb/Preach).
What doesn't work is incrementing the monster count properly.
I'm using a custom writebyte to do this:
total_monsters = total_monsters + 1;
WriteByte (MSG_BROADCAST,SVC_UPDATESTAT);
WriteByte (MSG_BROADCAST,STAT_TOTALMONSTERS);
WriteLong (MSG_BROADCAST,total_monsters);
Which also works fine, but only the first time a monster is spawned. After that it increments the counter by 2 instead of 1. It doesn't keep on incrementing, no matter how many more I spawn, it just sticks at +2 per spawn.
I'm trying various solutions, but it almost seems like there is some engine side value which is being affected invisibly.
I've traced back all the occurances of total_monsters = total_monsters + 1; I can find and no luck. I've also shifted where/how its incremented a few times and turned off various parts of the process to try and localise the issue, but no luck so far.
Yes, I have an exclusion in walkmonster_start so that doesn't also add to the count...
Any ideas? I'm tempted to make it so that spawned creatures just don't add to the count, meaning the player can get >100% kills, but that's a sloppy fix.
I Fixed It
#1494 posted by ijed on 2014/07/23 15:39:04
Stupid mistake in walkmonster_start
|