Anyone who looks at this code instantly becomes insane
1–10 of 81 posts
Re: Anyone who looks at this code instantly becomes insane
#2Re: Anyone who looks at this code instantly becomes insane
#3Re: Anyone who looks at this code instantly becomes insane
#4Object Class: Keter
Infohazard, Cognitohazard
Special Containment Procedures: Do not look at this code
Re: Anyone who looks at this code instantly becomes insane
#5You may not like it, but this is peak programming. A level of perfection attainable only by undergoing the rite of writing a single if statement with 100+ conditions.
Re: Anyone who looks at this code instantly becomes insane
#6Terraria 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.
Re: Anyone who looks at this code instantly becomes insane
#7It compares favorably to the official Terraria code (decompiled version here): 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,…
Re: Anyone who looks at this code instantly becomes insane
#8Re: Anyone who looks at this code instantly becomes insane
#9The code was actually very simple, it consisted of for loops over a bunch of element nodes in which child nodes had to be compared with child nodes in other element nodes, or in which attribute nodes needed to be compared with other attribute nodes, whenever one of these nodes that needed to be compared with other nodes was found a new for loop would be started to loop over the whole set of nodes once again to find the attribute or element with children that needed to be compared with the currently selected attribute or element. I am describing this so succinctly and clearly for you so that you may experience a deeper understanding of just how succinct and clear the code itself was.
Whenever values where found that matched they were added to an array that was later looped over to get the values to actually doing something with them. They had printed out the oode, it was nearly 100 pages - I was pretty sure I could have done it in less than 2 pages (it was in C# and I sucked at C#), I mean the actual XML that was being analyzed would be less than 5 pages if printed.
After looking at it for a few minutes I announced that it should be rewritten. The other developers wanted to continue on with it to find the bug. I think they had been driven insane.
on edit: by less than 2 pages I mean that it might be more than 1 page but I suppose not 2 full pages.
Re: Anyone who looks at this code instantly becomes insane
#10https://github.com/raxod502/TerrariaClone/blob/master/src/Te... You may not like it, but this is peak programming. A level of perfection attainable only by undergoing the rite of writing a single if statement with 100+ conditions.
A coder strives to write the longest and most impressive code.
A programmer strives to write the code that solvers the problem at hand at the simplest and most reliable way.