Here’s a long post documenting everything as technical as I can.. I also am rambling.
Most of the information is copyrighted(me), so if you use any of this stuff at all to sell servers YOU MUST GIVE ME CREDIT.
VALVe games are based off of quake 3. Even though source and future engines may seem to run on their own, they still have their roots in quake 3 (remember half-life itself).
- FPS
There has been much argument to what VALVes serverside FPS is. One thing that is known is the higher the number is, the lower the latency is for nanosleep(). When you crank up the HZ to 1000. A HZ is how many times a second interrupts fire off, which reduces latency/increases accuracy of several timers like nanosleep/select/itimers. When the game calls a frame, it updates world objects, does a couple of other things. Higher FPS also *seems* to reduce prediction erroring, which you can debug for yourself, since there are so many frames being called on the server. Higher server FPS reduces the chance is late or missed client snapshots. A late snapshot sent from the client won’t show on any netgraph 1/2/3. Overall, FPS is more or less a System Call Precision Accuracy Tester.. It reflects what HZ is set to on the system, more or less. There are more magic tricks going on with that many interrupts, but more or less that what it does.
- OS Caveats
The linux kernel as of 2.6.18 (just this version) has support (via patch) for vsyscall+gettimeofday. A vsyscall is a shared page mapped into the address space of every running process, and it is updated atomically. It avoids a full context switch into the kernel, and tries to make calling system calls cheap.. This only works on x86 games, not a x86_64 kernel with a x86 game. On a 32slot pub, I reduced CPU usage by 28% (average over 60 minutes with MRTG+perl script to monitor it’s pid) with this patch. Older versions of Linux have superior low latency support compared to the newer ones. 2.6.18 and 2.4 series are probably the best versions to use for gameservers, IMO. I don’t use Linux that much.
Another thing to consider about linux is most newer kernels have brain dead code to check to see if the TSC skews or not. It’s called about every 10/HZ (IIRC), and can make the FPS code unhappy (which makes CAL Open kids cry). GLIBC is very slow and bloated with junk, so don’t expect magic from userland. If you want to speed up userland for games, try compiling glibc without frame pointers.. this will prevent debugging, but it will remove a ton of shit from the stack and at least speed it up.
TSC vs HPET. I get asked this question quite a bit.. should you use TSC, or HPET for the timecounter? TSC is probably the fastest, but it *can* skew on SMP machines. Intel CPUs update at a fixed rate regardless of power management crap, so if you are using intel, you can do that I personally use HPET on my machines, but it’s slower to read but it’s better to use than the PIT/8254.
Does throwing more CPU power fix FPS problems? No. That just means you can put more servers on a machine. Another think to take in mind is valve isn’t the worlds most talented group of coders.. they make mistakes, just like kids when they complain that a bullet missed someone’s head.
What about 64bit kernel/userland, vs 32bit binaries? This is another age old arguement. If binaries are 32bit, then a 64bit kernel/userland doesn’t help them. The only reason you need 64bit any ways is to overcome the 232 limit of memory.
Filesystem? UFS? EXT/2/3? ZFS? RFS? Hammer? NTFS? .. Overall, the fastest one out of that is probably ext2. ZFS is a 128bit filesystem, and it’s maximum limits are so large (18.4 × 1018) that they will never been encountered. I like ZFS over them all due to it’s geeky-ness. For more ZFS lingo, if you put 1 exabyte on a ZFS filesystem each year, it would take around 7.9 million years to fill it up. Another way to write it is you wrote 1,000 files per sec (full dvd movies), it would take approx 284,012,568,000 seconds to fill it up (which is about 9000 years)
Windows? Microsoft’s operating systems provide the very basic interfaces. However, interrupt latency and poor design/ability to change very basic system parameters (sleep latency etc). To be honest, it’s so much of a joke that I have a hard time finding out why a machine is lagging in a game. The user interfaces for 2008 are so terrible it takes me at least 15 minutes to analyze event loggers horrible logs for security violations. I feel sorry for people who have to contend with so many problems on this platform.
FreeBSD? FreeBSD has probably one of the best development platforms (stable, release, current). Linux used to follow this method (odd number kernels would be development and even would be production). However, there are a couple of bugs in the linux emulation code. It’s being worked on slowly, but overall FreeBSD is a pretty good platform. The downside is lack of hardware support and general slow release cycles. However the quality of code is really good except for a few minor issues.
- Misc stuff
Kids want the following: low latency, stable framerate, and.. the most intrusive of them all, bullet registration. Bullet reg is something of a mystery, sort of like bigfoot. There is no way to prove it exists, and you’re unable to prove it doesn’t exist. So why assume it exists without evidence? Reverse feeble logic? Kids don’t understand that most of VALVes games’ netcode estimates things. Just as sure as MPG in a car, everything is either rounded up or rounded down. And the final value is estimated. So in math terms, you have the same odds as everyone else in terms of missing. Some people are just better at it than others, don’t expect to bowl a 300 game every time.
Main