Maximum reasonable number of Pathnodes + Spawnpoints ?

Discussions about Coding and Scripting
Post Reply
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Maximum reasonable number of Pathnodes + Spawnpoints ?

Post by MrLoathsome »

I have been working on a mutator that will spawn multiple swarms of pawns into maps, and maintain that
number. This was inspired by a couple of functions in the TWT_Zombies code that GoPostal released
with his excellent DM-ATypicalMall map.

The code builds a list of possible spawnpoints for the pawns like this:

Code: Select all

	for (N = Level.NavigationPointList; N != NONE; N = N.NextNavigationPoint)
	{
		if ((N.IsA('PathNode') || N.IsA('SpawnPoint')) && !N.Region.Zone.bWaterZone)
		{
			if (NavNodeCount <= 5000)
			{
				PNodes[NavNodeCount] = N;
				NavNodeCount++;
			}
			N.bPlayerOnly = False;
		}
	}
The maximum value hardcoded here of 5000 seems awfully high. Function logs the number of spawnpoints if finds right
after the above code executes. Don't recall ever seeing it get over 1000, or even close to it during testing.
(In any gametype, any map, even huge SP maps....)

I want to have the maximum set a bit above whatever the maximum number that would be expected, but hate
to leave it as is, if the array is being defined at 5-10x the size it needs to be....

Anybody got any idea or educated guess on what that value might be? (Mr.Loathsome is not a mapper...... :noidea )
blarg
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Post by JackGriffin »

I can confirm to you that excessive noding will certainly crash a server very hard and it was the AtypicalMall map that showed me that. It covers a lot of ground with many corners so it needed a lot of pathing. When I pathed it with what I considered reasonable it crashed immediately on the server. It was Ferali (no surprise there) that told me the likely problem and it was indeed over-pathing. I ended up removing something like 2/3rds of them to get it nice and stable. There is nowhere near 5K in there, I prolly never broke 1K so my guess it that it has more to do with branching than pathing since something like this:

X--X--X--X--X
is much less decision intensive than

X--X--X
\/ \/
X X
/\ /\
X--X--X

I wish someone with access to the native side could give guidelines about things like this once and for all. It's silly that after 10+ years we still have to glean by trial and error. I'm not really sure if this helps you or not but I never set out to find the limits for the engine, I just bumped into them by mistake. My guess is you will want to seriously scale back the nodes if it will build any sort of network aside from a point cloud.
So long, and thanks for all the fish
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Post by MrLoathsome »

Nice answer. I would also like to see a tech document with info such as this in it, but won't be holding my breath.

This project, (a mutator), is just counting the nodes on whatever map it happens to be running on.
So I just wanted to make sure I made the array large enough to avoid any array index errors. Got the max set at 2000 atm.

Have you ever used dynamic arrays in UScript? I have read of them, but never used them, and don't recall looking at any source code that did...
If they work for UT1, this would be a good use for them I think.

Sometimes I drink beer and read UDN pages. Remember reading something about that, but don't recall if it was for UT or just newer versions of the unreal engine.
blarg
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Post by JackGriffin »

Nope, Dynamic came in 2k3 and onward :(

I've not had much experience in it but here's a good page:
http://wiki.beyondunreal.com/Dynamic_arrays

Interestingly enough there is this bit:
Unlike any other data type in UnrealScript, dynamic arrays have absolutely no support for replication. Attempting to replicate a dynamic array variable will have no effect on the remote instance of that variable. Attempting to use a dynamic array as parameter of a replicated function will result in the parameter being empty when the function is executed on the remote side.
So long, and thanks for all the fish
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Post by MrLoathsome »

Yup. Remembered that bit. If they were supported, this would be the perfect use for them. No big deal. What I have works so far.
blarg
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Post by Shadow »

Dynamic Arrays are heavily used on C++ level and fully supported, best example is the Level's Actor List. But when dealing with Unreal Script you have no possibility to edit, create, delete a Dynamic Array (in the means of native functions).

Another downside: they behave strangely in defaultproperties, one may declare single default elements similar to static arrays, but when adding an entity of given class to the map the list is empty again... that's SO coool... not.
Image
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Post by Feralidragon »

I remember trying dynamic arrays once in UScript, everything went smooth until I added variables as references.... it crashed lol
It worked fine as long as I added UScript primary variable types: bytes, ints, strings, etc...
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Post by Shadow »

Yes, and don't try using dynamic arrays with (own) structs...
Everything went fine? For me that default property issue is horrible!
Image
Post Reply