Simplify QW network deltas. By just trusting the server instead of second-guessing it, we should get something more robust (at least for demo playback).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6258 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
33665b8d92
commit
2b440a186d
3 changed files with 7 additions and 30 deletions
|
@ -598,7 +598,8 @@ void FlushEntityPacket (void)
|
||||||
|
|
||||||
memset (&olde, 0, sizeof(olde));
|
memset (&olde, 0, sizeof(olde));
|
||||||
|
|
||||||
cl.validsequence = 0; // can't render a frame
|
if ((cl.validsequence&UPDATE_MASK) == (cls.netchan.incoming_sequence&UPDATE_MASK))
|
||||||
|
cl.validsequence = 0; // last-known-good sequence is becoming invalid.
|
||||||
cl.inframes[cls.netchan.incoming_sequence&UPDATE_MASK].invalid = true;
|
cl.inframes[cls.netchan.incoming_sequence&UPDATE_MASK].invalid = true;
|
||||||
|
|
||||||
// read it all, but ignore it
|
// read it all, but ignore it
|
||||||
|
@ -1316,36 +1317,18 @@ void CLQW_ParsePacketEntities (qboolean delta)
|
||||||
from = MSG_ReadByte ();
|
from = MSG_ReadByte ();
|
||||||
|
|
||||||
// Con_Printf("%i %i from %i\n", cls.netchan.outgoing_sequence, cls.netchan.incoming_sequence, from);
|
// Con_Printf("%i %i from %i\n", cls.netchan.outgoing_sequence, cls.netchan.incoming_sequence, from);
|
||||||
|
|
||||||
oldpacket = cl.inframes[newpacket].delta_sequence;
|
|
||||||
if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
|
if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
|
||||||
from = oldpacket = cls.netchan.incoming_sequence - 1;
|
from = oldpacket = cls.netchan.incoming_sequence - 1;
|
||||||
|
oldpacket = cl.inframes[from & UPDATE_MASK].frameid;
|
||||||
|
|
||||||
if (cls.netchan.outgoing_sequence - cls.netchan.incoming_sequence >= UPDATE_BACKUP - 1) {
|
if (cl.inframes[from&UPDATE_MASK].invalid || //old frame is unusable
|
||||||
// there are no valid frames left, so drop it
|
cls.netchan.outgoing_sequence - oldpacket >= UPDATE_BACKUP - 1) // we must have lost the sequence its trying to delta from (or just too old).
|
||||||
FlushEntityPacket ();
|
|
||||||
cl.validsequence = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((from & UPDATE_MASK) != (oldpacket & UPDATE_MASK)) {
|
|
||||||
Con_DPrintf ("WARNING: from mismatch\n");
|
|
||||||
// FlushEntityPacket ();
|
|
||||||
// cl.validsequence = 0;
|
|
||||||
// return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cls.netchan.outgoing_sequence - oldpacket >= UPDATE_BACKUP - 1)
|
|
||||||
{
|
{
|
||||||
// we can't use this, it is too old
|
|
||||||
FlushEntityPacket ();
|
FlushEntityPacket ();
|
||||||
// don't clear cl.validsequence, so that frames can still be rendered;
|
|
||||||
// it is possible that a fresh packet will be received before
|
|
||||||
// (outgoing_sequence - incoming_sequence) exceeds UPDATE_BACKUP - 1
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldp = &cl.inframes[oldpacket & UPDATE_MASK].packet_entities;
|
oldp = &cl.inframes[from & UPDATE_MASK].packet_entities;
|
||||||
full = false;
|
full = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2096,13 +2096,10 @@ qboolean CLQW_SendCmd (sizebuf_t *buf, qboolean actuallysend)
|
||||||
//delta_sequence is the _expected_ previous sequences, so is set before it arrives.
|
//delta_sequence is the _expected_ previous sequences, so is set before it arrives.
|
||||||
if (cl.validsequence && !cl_nodelta.ival && cls.state == ca_active)// && !cls.demorecording)
|
if (cl.validsequence && !cl_nodelta.ival && cls.state == ca_active)// && !cls.demorecording)
|
||||||
{
|
{
|
||||||
cl.inframes[cls.netchan.outgoing_sequence&UPDATE_MASK].delta_sequence = cl.validsequence;
|
|
||||||
MSG_WriteByte (buf, clc_delta);
|
MSG_WriteByte (buf, clc_delta);
|
||||||
// Con_Printf("%i\n", cl.validsequence);
|
// Con_Printf("%i\n", cl.validsequence);
|
||||||
MSG_WriteByte (buf, cl.validsequence&255);
|
MSG_WriteByte (buf, cl.validsequence&255);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
cl.inframes[cls.netchan.outgoing_sequence&UPDATE_MASK].delta_sequence = -1;
|
|
||||||
|
|
||||||
if (cl.sendprespawn || !actuallysend)
|
if (cl.sendprespawn || !actuallysend)
|
||||||
buf->cursize = st; //don't send movement commands while we're still supposedly downloading. mvdsv does not like that.
|
buf->cursize = st; //don't send movement commands while we're still supposedly downloading. mvdsv does not like that.
|
||||||
|
|
|
@ -248,9 +248,6 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
//this is the sequence we requested for this frame.
|
|
||||||
int delta_sequence; // sequence number to delta from, -1 = full update
|
|
||||||
|
|
||||||
// received from server
|
// received from server
|
||||||
int frameid; //the sequence number of the frame, so we can easily detect which frames are valid without poking all in advance, etc
|
int frameid; //the sequence number of the frame, so we can easily detect which frames are valid without poking all in advance, etc
|
||||||
int ackframe; //the outgoing sequence this frame acked (for prediction backlerping).
|
int ackframe; //the outgoing sequence this frame acked (for prediction backlerping).
|
||||||
|
|
Loading…
Reference in a new issue