Article 76Q6P CodeSOD: The Most Dangerous Game

CodeSOD: The Most Dangerous Game

by
Remy Porter
from The Daily WTF on (#76Q6P)

While we talk about bad video game code periodically, we generally avoid it because it's so specialized and while something like fast inverse square root is bad code from a maintainability perspective, it's great code for abusing floating points to make math fast.

Itan Yldz sends us a snippet from a game's config file. I won't pick on the specific game, but this isn't some random build of TuxCart, but a released game sold on multiple platforms. It's from a small team, but it's an actual professional product running on many devices. What's notable about this is the game has multiplayer elements, which means networking code, which means...

net_socks_buffer_size= 4096;//I wouldn't change this if I were younet_max_message_size= 32768;//changing this will require restarting the game. MUST be power of 2, don't be a dick and make it too bignet_max_download_frames= 16;//changing this will require restarting the game. MUST be power of 2 and smaller than net_max_message_sizenet_udp_packet_size= 65536;//576 bytes the "recommended" fragment cutoff, ipv6 requires 1080. The game will check automatically and make sure you aren't out of range (at least on windows it can do this)net_udp_packet_send_buffer_size= 4;//how many packets it can store before sending (ideally it shouldn't be storing anything but threads are a b*)net_udp_packet_recv_buffer_size= 8;//how many packets we can receive in 1 frame (8 is defualt, it'll discard packets that don't fit... it'll warn you in the console when this happens)net_udp_force_specified_size= false;//overrides what the OS recommends, could disable networking and maybe crash the game? who knowsnet_udp_enable_checksum= false;//probably unnecessary to have UDP checksums, but you can if you want for some reason

... it means you can configure your copy of the game to attempt DoS attacks against other players' network stacks.

I enjoy the warning here: don't be a dick. You can set your max message size to any power of 2, but don't be a dick about it.

The networking settings are fun, and I'm glad to know that I can probably cause the game to crash (either my copy or my fellow players' copies). But can I do something dangerous or even... oh, I don't know, crazy? I really hope I can.

sys_ignore_variable_constraints= false;//DANGEROUS AS F***, leave off goddamnit you're crazy if you turn this on

That's the spirit! I want every game to add this config flag IMMEDIATELY. Actually, I'm working on a robot: I'm definitely going to add that to my robot software. I'm gonna make the robot arm punch through a wall (note: it's not supposed to punch through walls, and I think a number of people would get very upset with me).

proget-icon.png [Advertisement] Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments