Git Product home page Git Product logo

Comments (1)

matthewearl avatar matthewearl commented on May 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.