Jump to content

Infinite Loops???


jaxaceron

Recommended Posts

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:

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?...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...