Comments (1)
I reckon the easiest way to do this would be on map change, scan through the whole demo file looking for a server info message with a map that matches the current map. If found, start reading the ghost info immediately, if not print an error message (like the current one).
The skipping could be made fairly fast since when in "scanning for map" mode we can avoid parsing most of the updates. For instance, here's what pyquake dumps for a level transition:
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='\nQdQ Stats patch v1.8\nThe recorded time was '))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='7'))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='.'))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='1'))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='3'))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='3'))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='4'))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='1'))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='\n'))
(False, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessagePrint(string='\n'))
(True, [-1.7424052953720093, 197.896728515625, 0.0], ServerMessageStuffText(string='net_messagetimeout 77157674313357435540\n'))
--------- PACKET BOUNDARY ---------
(True, [0.0, 0.0, 0.0], ServerMessageStuffText(string='reconnect\n'))
--------- PACKET BOUNDARY ---------
(False, [0.0, 0.0, 0.0], ServerMessagePrint(string='\x02\nVERSION 1.09 SERVER (5336 CRC)'))
(False, [0.0, 0.0, 0.0], ServerMessageServerInfo(protocol=Protocol(version=<ProtocolVersion.NETQUAKE: 15>, flags=<ProtocolFlags.0: 0>), max_clients=1, game_type=0, level_name='the Slipgate Complex', models=['maps/e1m1.bsp', '*1', '*2', '*3', '*4', '*5', '*6', ...]))
(False, [0.0, 0.0, 0.0], ServerMessageCdTrack(track=6, loop=6))
(False, [0.0, 0.0, 0.0], ServerMessageSetView(viewentity=1))
(False, [0.0, 0.0, 0.0], ServerMessageSetPause(paused=0))
(True, [0.0, 0.0, 0.0], ServerMessageSignOnNum(num=1))
--------- PACKET BOUNDARY ---------
(False, [0.0, -0.04839999973773956, 0.0], ServerMessageSpawnStaticSound(origin=(688.0, 192.0, 80.0), sound_num=65, vol=127, atten=192))
(False, [0.0, -0.04839999973773956, 0.0], ServerMessageSpawnStaticSound(origin=(592.0, 544.0, 88.0), sound_num=71, vol=127, atten=192))
(False, [0.0, -0.04839999973773956, 0.0], ServerMessageSpawnStaticSound(origin=(176.0, 1744.0, -152.0), sound_num=71, vol=127, atten=192))
(False, [0.0, -0.04839999973773956, 0.0], ServerMessageSpawnStaticSound(origin=(80.0, 1744.0, -152.0), sound_num=71, vol=127, atten=192))
(False, [0.0, -0.04839999973773956, 0.0], ServerMessageSpawnStaticSound(origin=(416.0, 2064.0, -112.0), sound_num=71, vol=127, atten=192))
(False, [0.0, -0.04839999973773956, 0.0], ServerMessageSpawnStaticSound(origin=(416.0, 1968.0, -112.0), sound_num=71, vol=127, atten=192))
....
--------- PACKET BOUNDARY ---------
(False, [0.04839999973773956, -0.4114000201225281, 0.0], ServerMessageTime(time=1.4109539985656738))
...usual update messages go here...
--------- PACKET BOUNDARY ---------
(False, [-0.02419999986886978, 89.806396484375, 0.0], ServerMessageTime(time=1.4387319087982178))
...usual update messages go here...
--------- PACKET BOUNDARY ---------
(False, [0.04840000346302986, 89.51541137695312, 0.0], ServerMessageTime(time=1.4526207447052002))
...usual update messages go here...
--------- PACKET BOUNDARY ---------
...and so on.
If we haven't yet found a server info message with our map, we can return DP_CBR_SKIP_PACKET
in the time callback which will mean we won't waste time parsing most of the demo file. I reckon this would be plenty fast enough for id1 marathons (at least on a modern machine) so certainly a feature worth having.
from joequake.
Related Issues (20)
- Issue with loading some maps from Paril3.0 HOT 3
- "GL_LoadTexture: numgltextures == MAX_GLTEXTURES" error
- Strange model skin issue HOT 2
- Signon buffer fragmentation
- Ghost splits: Rewinding a demo during intermission shows multiple splits per level HOT 1
- anisotropic filtering & anti aliasing support HOT 1
- Ghost splits: End of level splits not shown during finale
- NUMPAD keys don't function with SDL exe HOT 1
- Issue with pitch angles with SDL exe
- Issue with loading mj4m5 from Mjolnir HOT 2
- Ghost doesn't work for levels without a finale/intermission message HOT 4
- Level loading time is added onto game start time (up to 0.1 seconds) HOT 23
- Add GL_DEPTH_CLAMP_NV HOT 2
- glDrawElements fails with GL_INVALID_OPERATION on Intel Corporation Iris Plus Graphics G7 (laptop GPU) HOT 2
- Issue with r_fullbright HOT 1
- Crash when changing `gl_part_telesplash` from 2 to 0 when teleporting HOT 1
- Weapon draw still changes with FOV when cl_gun_fovscale is set to 1
- gfx/mainmenu should be replaced with a diffrent system HOT 2
- Game crashes when screensaver activates
- GL_Upload8 error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joequake.