3 ms·
It compares favorably to the official Terraria code (decompiled version here): https://github.com/TheVamp/Terraria-Source-Code/blob/master/Terraria/Item.cs http
by Scaevolus 7y ago
It compares favorably to the official Terraria code (decompiled version here): https://github.com/TheVamp/Terraria-Source-Code/blob/master/Terraria/Item.cs https://github.com/TheVamp/Terraria-Source-Code/blob/master/...
Terraria extensively used God objects with hundreds or thousands of properties, and used naive C# serialization for its netcode. This meant that sending the state of a single object would take over 1KB, leading to truly outrageous network requirements for a 2D platformer game, on the order of >100KB/s/player.
- GrayShade 7y agoThat's decompiled or automatically generated code, right?
- tudelo 7y agoI have to believe there is a 0 percent chance a human wrote all of that. It's the only thing that will keep me sane 8)
- Scaevolus 7y agoYes it's decompiled, so the chains of if statements would likely be switches instead, but basic things like an object having thousands of properties are exactly as the programmer wrote it.
- ynik 7y agoThe local variable names look like the code was decompiled with ILSpy. All the magic numbers probably (hopefully?) were constants in the original code. The crazy indentation looks like the decompiler just doesn't use "else if". The goto's were just old ILSpy versions being bad at control flow reconstruction. But neither the C# compiler nor the ILSpy decompiler moves code to different methods/classes (only the JIT does stuff like inlining), so yes it's really a single enormous class handling every possible item in the game via cascading if statements.