1
0
Fork 0
forked from fte/fteqw

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:
Spoike 2022-06-02 06:08:21 +00:00
parent 33665b8d92
commit 2b440a186d
3 changed files with 7 additions and 30 deletions

View file

@ -598,7 +598,8 @@ void FlushEntityPacket (void)
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;
// read it all, but ignore it
@ -1316,36 +1317,18 @@ void CLQW_ParsePacketEntities (qboolean delta)
from = MSG_ReadByte ();
// 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)
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) {
// there are no valid frames left, so drop it
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)
if (cl.inframes[from&UPDATE_MASK].invalid || //old frame is unusable
cls.netchan.outgoing_sequence - oldpacket >= UPDATE_BACKUP - 1) // we must have lost the sequence its trying to delta from (or just too old).
{
// we can't use this, it is too old
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;
}
oldp = &cl.inframes[oldpacket & UPDATE_MASK].packet_entities;
oldp = &cl.inframes[from & UPDATE_MASK].packet_entities;
full = false;
}
else
@ -1428,7 +1411,7 @@ void CLQW_ParsePacketEntities (qboolean delta)
newp->entities = BZ_Realloc(newp->entities, sizeof(entity_state_t)*newp->max_entities);
}
if (oldindex >= oldp->max_entities)
Host_EndGame("Old packet entity too big\n");
Host_EndGame("Old packet entity too big\n");
newp->entities[newindex] = oldp->entities[oldindex];
newindex++;
oldindex++;

View file

@ -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.
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);
// Con_Printf("%i\n", cl.validsequence);
MSG_WriteByte (buf, cl.validsequence&255);
}
else
cl.inframes[cls.netchan.outgoing_sequence&UPDATE_MASK].delta_sequence = -1;
if (cl.sendprespawn || !actuallysend)
buf->cursize = st; //don't send movement commands while we're still supposedly downloading. mvdsv does not like that.

View file

@ -248,9 +248,6 @@ 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
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).