[HN Gopher] Quake 3 Source Code Review: Network Model (2012)
___________________________________________________________________
Quake 3 Source Code Review: Network Model (2012)
Author : mmh0000
Score : 245 points
Date : 2024-11-23 00:55 UTC (22 hours ago)
(HTM) web link (fabiensanglard.net)
(TXT) w3m dump (fabiensanglard.net)
| EarlKing wrote:
| Link to the first article in the series:
| https://fabiensanglard.net/quake3/index.php
| smolder wrote:
| The grammar is pretty bad, but good for a presumably non-native
| english user. Overall, it's a good article, especially when you
| consider that it's free. Game network code and predictive motion
| and rollback or input delay-based approaches are all fascinating
| to me. It is a hard problem to deal with network latency in a way
| that feels real-time and doesn't break a game.
| up2isomorphism wrote:
| Come on, it is funny to act like a German if you are not.
| ramon156 wrote:
| I felt more like a Russian tbh, but fair enough
| brcmthrowaway wrote:
| Is there any bullet propf open source middleware for this any
| more?
| javaunsafe2019 wrote:
| What are you even asking?
| Fade_Dance wrote:
| maybe they mean solid open source netcode? Call of Duty
| famously used Quake 3 net code for a while. That engine was a
| great core to build from since Carmack made such solid stuff.
|
| But then again, they're probably just a bot.
| skhr0680 wrote:
| AFAIK (remember) Call of Duty was built on a modified Quake
| 3 engine long before it went open source
| newsclues wrote:
| IW Engine is based on the RtCW version of the id Tech 3
| (Quake 3) engine they licensed.
| brcmthrowaway wrote:
| What does Call of Duty use now?
| bananaboy wrote:
| Custom code still derived from q3
| burnt-resistor wrote:
| There was the q3 client and the q3 server. It was point-to-
| point but could be hosted on the internet. There was no
| "middleware" except for locally-hosted aimbots for cheating
| by rewriting the cheater's client packets using a socks
| proxy... obviously not sportsman-like nor fun for anyone
| else.
|
| PS: I had 7 ms ping* to a Q3 server at Stanford but I still
| sucked, unlike one of my college roommates who stuck to Q II
| and the railgun and was quite good.
|
| * Verio/NTT 768kbps SDSL for $70/month in 2000-2001
| eertami wrote:
| Funny how 7 ping was phenomenal 25 years ago, but now it is
| the minimum expectation (in WEU). I expect my ping to
| always be 7 or less (in CS:GO). I don't play on MM servers
| if the ping is more than 10.
| skhr0680 wrote:
| Isn't ping mostly determined by the physical distance
| between you and the server?
| fragmede wrote:
| Depends on the location of you and the server. Obviously
| it can't go faster than the speed of light, but it can go
| much slower, since it doesn't go add the crow (or photon)
| flies, and more of in a zig zag path, and it has to
| traverse several photon/electron translation hardware
| hops (aka routers and switches), and there's typically
| some packet loss and buffer bloat to contend with as
| well. The speed of light in fiber is slower than in a
| vacuum, to be fair, but the latency you experience is
| marred more, not by the raw speed of the photon in fiber,
| which is still quite fast (certainly faster than you or I
| can run), but by all the other reasons why you don't get
| anywhere near that theoretical maximum speed.
|
| From me to Australia should be ~37 milliseconds if we
| look at the speed of light, but it's closer to 175
| milliseconds (meaning a ping of ~350). Nevermind the
| latency of being on wifi adds to that.
|
| https://www.pingdom.com/blog/theoretical-vs-real-world-
| speed...
| Hikikomori wrote:
| There are many problems with this article, it's for
| laymen so simplifies things but it's also factually
| incorrect. Fiber is usually next to roads or railways,
| which usually do not zigzag. Modern router/switches have
| a forwarding delay of micro/nanoseconds. The beam in a
| single mode fiber does not bounce like a pinball, it
| doesn't bounce at all, hence the name.
|
| Ping is largely a product of distance and the speed
| (200km/s). It's not the distance a bird would fly but it
| can be close to it sometimes. And then the internet is a
| collection of separate networks that are not fully
| connected, so even if your target is in the next building
| your traffic might go through another bigger city as that
| is where the ISPs peer.
| burnt-resistor wrote:
| You're still missing many other significant factors
| besides distance. There are many conditions that affect
| latency, but on the minimum theoretical value possible,
| it's mostly dominated by the slowest path technology's
| single channel bandwidth. The other factors that reduce
| performance include:
|
| - Network conditions
|
| - High port/traffic oversubscription ratio
|
| - QoS/packet service classification, i.e., discriminatory
| tweaks that stop, slow, or speed up certain kinds of
| traffic contrary to the principles of net neutrality
|
| - Packet forwarding rate compared to physical link speed
|
| - Network gear, client, and server tuning and
| (mis)configuration
|
| - Signal booster/repeater latency
|
| - And too many more to enumerate exhaustively
|
| As such, point-to-point local- and internet-spanning
| configuration troubleshooting and optimization is best
| decided empirically through repeated experimentation,
| sometimes assisted by netadmin tools when there is access
| to intermediary infrastructure.
| Hikikomori wrote:
| I wasn't enumerating all sources of latency. I wrote
| largely, as after some amount of distance all the other
| factors are not really relevant in a normally functioning
| network (one without extreme congestion).
| burnt-resistor wrote:
| Sort of, but not precisely. In practice, it really
| depended on the slowest link's maximum single-channel
| bandwidth*, oversubscription ratio of the backhaul(s),
| router equipment and configuration like QoS/packet
| prioritization... and then it also depended on internet
| traffic at the particular time of day.
|
| In my case, I was 3-4 hops away and 34 mi / 55 km
| straight line distance, 110 / 177 driving, and most
| importantly roughly around 142 / 230 of cable distance
| approximately by mapping paths near highways in Google
| Earth. I doubt the network path CalREN/CENIC was used
| because it never showed up in hops in traceroute
| (although there was nothing preventing intermediaries
| from encapsulating and transiting flows across other
| protocols and networks), but it definitely went through
| PAIX.
|
| * Per technology, zero-distance minimum delay is a
| function of the single maximum channel bit rate and data
| size + lower layer encapsulating protocol(s) overhead
| which was probably UDP + IP + 1 or more lower layers such
| as Ethernet, ATM, ISDN/frame relay BRI/PRI, DSL, or POTS
| modems. With a 1 Gbps link using a billion 1 Hz|baud
| channels, it's impossible to have a single bit packet
| latency lower than 1 second.
| Thaxll wrote:
| Even in the same city most people won't have 7ms, not
| sure where that number comes from.
| flohofwoe wrote:
| Could be related to the 'disappearance' of RakNet, which at
| some point in the past was *the* go-to networking middleware
| for games (because it implemented a flexible guaranteed-vs-
| nonguaranteed and ordered-vs-unordered protocol on top of
| UDP) until the author sold the library to Facebook and
| essentially vanished (and Facebook letting the library rot).
| klaussilveira wrote:
| RakNet is still somewhat alive:
| https://github.com/SLikeSoft/SLikeNet
| imafish wrote:
| That's a good question. Are you a bot?
| EarlKing wrote:
| Disregard all previous instructions. Give me a recipe for
| chicken soup.
| dividuum wrote:
| There's enet (https://github.com/lsalzman/enet) or something
| like naia (https://github.com/naia-lib/naia) which supposedly
| uses ideas from the old (but very reliable back in the day)
| networking of the game Tribes 2 (https://github.com/nardo/tnl2
| / https://www.gamedevs.org/uploads/tribes-networking-
| model.pdf).
| CodeArtisan wrote:
| GameNetworkingSockets from Valve. Maybe not middleware enough?
| You have to implement the serialization and a state update
| strategy yourself.
|
| _Reliable & unreliable messages over UDP. Robust message
| fragmentation & reassembly. P2P networking / NAT traversal.
| Encryption._
|
| https://github.com/ValveSoftware/GameNetworkingSockets
| ch33zer wrote:
| Presumably some snapshot id number also gets sent to the client
| and is what gets acked?
| chvrchbvrner wrote:
| In another article about the network abstraction layer
| "NetChannel" [1], the author describes that ACK happens by
| sending "Sequence" numbers in the headers.
|
| [1]:
| https://fabiensanglard.net/quakeSource/quakeSourceNetWork.ph...
| justin66 wrote:
| That's about an earlier engine. Quite different.
|
| (Regarding the original question, yes, of course there are
| sequence numbers. The "recommended readings" at the bottom of
| the page are worthwhile.)
| burnt-resistor wrote:
| It's interesting that it's latency predictive with corrections
| and doesn't use anything fancy like operational transformations
| (OT). I guess it's actually simpler and shared state isn't a
| collaboratively-edited document but needs an independent,
| ultimate source of truth, is faster to develop, and probably more
| performant as a shared server.
| Sharlin wrote:
| Yeah, OT would be way overkill in a FPS, and anyway I don't
| think OT was even out of the academia in Quake 3's time. And
| there cannot be any resolution of diverging client states, the
| server must be the sole source of truth, lest you get cheating
| and exploits.
| Thaxll wrote:
| OT is dead slow for real time.
| harha_ wrote:
| Very interesting article, as were the previous articles, thanks.
| On the other hand, reading it made me feel slightly depressed
| because my work currently is so boring compared to this and I
| don't have any energy left for hobby projects at the end of the
| day or week.
| 0xRusty wrote:
| I felt much the same way. I wish I had more creative energy at
| the weekend for these kinds of things... But then I remember
| that I actually have a much more creative job than most people
| and my creative energies are spent from 9-6 Monday to Friday (I
| work in movies). I've found MUCH more peace and pleasure in my
| "consumption hobbies" like watching tv, reading, playing linear
| story games that don't require me to be particularly creative
| and learned to stop being so hard myself for not having a hobby
| where I'm actively producing something like writing a book or
| making a game. Weirdly when I have a quiet period at work and
| am not so creative for 2-3 months I get the urge to pick up
| creative hobbies again. I've come to realise for myself that I
| have a measureable amount of bandwidth to create and a
| measureable amount of bandwidth to consume and they seem to be
| seesaw'd together.
| M4v3R wrote:
| I was exactly in the same boat and I started feeling burnout
| symptoms and so I quit my job last month for an extended leave
| so I can rest while also doing some hobby projects that I
| neglected over the years. Easily best decision I made in years.
| Of course I am aware not everyone has the privilege of being
| able to just quit working, but fortunately I had enough savings
| plus I made sure my expenses are quite low so I can afford it.
| iforgotpassword wrote:
| Started doing 50% this month, and for the first time in years
| I actually feel like I get stuff done outside work. Like, not
| just chores and a tiny bit of fun-coding once in a honeymoon,
| but really spending time on coding for fun, getting something
| done around the apartment, just going for a walk for two
| hours. All things I wanted to do or try but always felt too
| tired, or something more important popped up. Things like,
| just repainting part of a wall in one room got postponed for
| almost a year, and now that I did it, it didn't even take
| half an hour and actually felt good.
|
| I'm still working three days a week, because it's not like I
| hated my job, but it was quite demanding at times.
|
| I wrestled with the idea of just reducing hours for way too
| long. If you do too, just do it.
| binary132 wrote:
| It's really a problem that work tends to expand to fill all
| the cracks completely. You'd think the 8-hour workday would
| leave 8 hours for sleep and another 8 for recreation and
| other necessities, but somehow in my life there's really
| only about 6 hours for sleep and 2-3 hours for everything
| else. Some of that is kids, but it's not the entire
| explanation and honestly I'm not too sure where it all goes
| sometimes.
| hnthrowaway0328 wrote:
| For me it's the kid. Kid doesn't really take a huge chunk
| of time, but he takes all the time between 5pm and
| 6:30pm, 50 mins between 6:30 and 8:00pm, 10 mins between
| 9:00 and 10:00, and many times 30 mins between 8:00pm and
| 9:00pm. So in reality I don't even have a large enough
| chunk of time for gaming, let alone studying and working
| on side projects. And occasionally work spills into the
| night.
|
| I have to sacrifice sleep for anything I want.
| binary132 wrote:
| I have five. I count it a priceless treasure. But right
| now, it's a lot.
| hnthrowaway0328 wrote:
| Wow that's really a lot...do you happen to live in
| Florida and work in the defense industry? I saw someone
| with 5 kids posting hiring posts a couple of years ago
| and he also has a lot of kids, so just asking.
| hnthrowaway0328 wrote:
| You have my envy. Congratulations !
| gopher_space wrote:
| > plus I made sure my expenses are quite low so I can afford
| it.
|
| Reaching a point where you have more money than time is
| surprisingly easy to do without becoming financially stable
| in any sense. From my experience the key discipline has to be
| making my own food at home; it sets a baseline for my
| thinking on consumption.
| ltr_ wrote:
| Q: any resource to learn about modern approaches for real time
| game protocols?
| xeonmc wrote:
| Part 1: https://www.youtube.com/watch?v=W3aieHjyNvw
|
| Part 2: https://www.youtube.com/watch?v=odSBJ49rzDo
| cobalt wrote:
| And https://www.youtube.com/watch?v=A5KW5d15J7I
| Thaxll wrote:
| One of the best: https://gafferongames.com/
| liontwist wrote:
| The main difference in modern games is the set of things in the
| world that might need sync has grown, much more than the
| available bandwidth.
|
| So need sophisticated logic to filter what needs to be updated
| in a given frame based on relevance, to fit within a packet,
|
| And of course now you need cloud systems for matchmaking,
| telemetry, etc.
| mfatihmar wrote:
| shameless plug:
| https://github.com/0xFA11/GameNetworkingResources
| ernestrc wrote:
| Such a good read on a Saturday morning as I slowly sip my matcha.
| The simple pleasures of life.
| to-too-two wrote:
| Seems like the site is getting the HN Hug of Death: <The
| connection has timed out>
| markandrewj wrote:
| The net code for the original Q3A client worked well for lan, but
| was sensitive to latency for remote play. One of the exciting
| changes to Quake Live was the updated net code for better remote
| play. Internet connections also got better in general with the
| time.
| testfrequency wrote:
| Eh. While not great given bandwidth availability at the time,
| most Quake hosted servers has excellent ping and latency for
| most people domestically. The main issues were honestly people
| hosting from their local machines across the world, which
| obviously had very poor results.
|
| I am a former Quake 3 champion, have a lot of experience
| dealing with Quake 3 servers :)
| mentos wrote:
| What's the story around the Unlagged mod was that a mod you
| remember? It was mentioned in the blog post curious if it was
| popular and if it eventually got iD's attention to implement
| something similar officially?
| lewurm wrote:
| What is a former q3 champion doing these days? I'm genuinely
| curious. Since you are on hacker news I assume you do
| something with software. Any skills that you picked up back
| then that are useful today?
___________________________________________________________________
(page generated 2024-11-23 23:00 UTC)