Correct ping during demo playback

Discussions about ET modding (sdk code, player/weapon modeling)

Moderators: Forum moderators, developers

Post Reply
Chruker
Posts: 12
Joined: Sat Jun 26, 2004 12:28 pm
Contact:

Correct ping during demo playback

Post by Chruker »

Hi

I was wondering if the ETPro team could give any hints to how etpro displays the correct ping during demo playback. Vanilla ET shows a maxed out ping, although the snapflags are there.

Also can you tell me if there are any commands that restarts a demo, just like map_restart restarts the map. Of cause I could do 'demo chruker1' again and again - but are there something faster?
Chruker
Posts: 12
Joined: Sat Jun 26, 2004 12:28 pm
Contact:

Post by Chruker »

Ok, it seems that the snap->ping used to draw the lagometer, contains numbers between 20000-100000+ - they are obviously not pings, and they don't vary much during a demo.

Does etpro store the ping's in another structure, and then use those during playback? Or do you 'patch' the engine?
User avatar
bani
Site Admin
Posts: 2780
Joined: Sun Jul 21, 2002 3:58 am
Contact:

Post by bani »

Code: Select all

        // add this snapshot's info
-       lagometer.snapshotSamples[ lagometer.snapshotCount & ( LAG_SAMPLES - 1) ] = snap->ping;
+       if (cg.demoPlayback) {
+               static int lasttime = 0;
+               // rain - #67 - display snapshot time delta instead of ping when
+               // playing a demo, since I can't think of any way to get the
+               // real ping
+               lagometer.snapshotSamples[lagometer.snapshotCount & (LAG_SAMPLES - 1)] = snap->serverTime - lasttime;
+               lasttime = snap->serverTime;
+       } else
+               lagometer.snapshotSamples[ lagometer.snapshotCount & ( LAG_SAMPLES - 1) ] = snap->ping;
+
Pedro
Posts: 42
Joined: Sat Sep 25, 2004 9:40 am
Contact:

Post by Pedro »

Pointers FTW!
Image
Pedro
Posts: 42
Joined: Sat Sep 25, 2004 9:40 am
Contact:

Post by Pedro »

Pointers FTW!
Image
Post Reply