• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Infinite Loops???

jaxaceron

New member
I was looking at the Assembly-CSharp.dll trying to understand how zombie pathing is determined (Haidrgna does this thing in GNAMOD where the zombies do a zigzag while chasing you and it gave me some ideas...) and I immediately noticed a ton of what appear to be infinite loops build into the game code. For example:

Code:
if (!RZ)
{
	while (true)
	{
		switch (2)
		{
		default:
			return;
		case 0:
			break;
		}
	}
}
You've got a while(true), which would loop forever (ignoring the unnecessary switch clause). I was wondering if any other modders noticed this and if it's common in game code? I know most programs have limiters which prevent infinite loops from running forever and causing issues, but that's still an extra routine that has to run and like I said, I see them everywhere. Could this be causing some of the lag issues within the game? And might it be worth creating a mod that cleans this up?...

 
This one is a bad example, since the return won't cause it to loop infinitely, but it's still unnecessary decision clauses. I didn't think TFP did obfuscation since they're so supportive of the modding community. You usually obfuscate important variables, classes, and function names, and most of those are crystal clear what they are.

 
This one is a bad example, since the return won't cause it to loop infinitely, but it's still unnecessary decision clauses. I didn't think TFP did obfuscation since they're so supportive of the modding community. You usually obfuscate important variables, classes, and function names, and most of those are crystal clear what they are.
If you run the DLL through the SDX Launcher, with no mods selected, then it'll clean up the DLL to be more readable.

 
Just use de4dot to de-obfuscate the assembly and then a reflection tool like dnspy to export it to a project.

Cheers

 
Back
Top