Maximum reasonable number of Pathnodes + Spawnpoints ?

Discussions about Coding and Scripting

Maximum reasonable number of Pathnodes + Spawnpoints ?

Postby MrLoathsome » Mon Mar 26, 2012 5:59 am

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 )
Download my stuff here: http://ecoop.tk/load/
MrLoathsome
Adept
 
Posts: 373
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: Mooooo !

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Postby JackGriffin » Tue Mar 27, 2012 3:09 am

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.
/away for now.
JackGriffin
Godlike
 
Posts: 1732
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Postby MrLoathsome » Wed Mar 28, 2012 2:40 am

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.
Download my stuff here: http://ecoop.tk/load/
MrLoathsome
Adept
 
Posts: 373
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: Mooooo !

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Postby JackGriffin » Wed Mar 28, 2012 4:12 am

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.
/away for now.
JackGriffin
Godlike
 
Posts: 1732
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Postby MrLoathsome » Wed Mar 28, 2012 6:25 am

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.
Download my stuff here: http://ecoop.tk/load/
MrLoathsome
Adept
 
Posts: 373
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: Mooooo !

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Postby Shadow » Thu Mar 29, 2012 8:33 am

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
Shadow
Masterful
 
Posts: 666
Joined: Tue Jan 29, 2008 12:00 am
Location: Halle (Saale), Germany

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Postby Feralidragon » Thu Mar 29, 2012 10:19 am

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
Feralidragon
Site Staff
 
Posts: 3712
Joined: Wed Feb 27, 2008 6:24 pm
Location: Portugal - Lisbon
Personal rank: The Unreal Boy

Re: Maximum reasonable number of Pathnodes + Spawnpoints ?

Postby Shadow » Thu Mar 29, 2012 11:45 am

Yes, and don't try using dynamic arrays with (own) structs...
Everything went fine? For me that default property issue is horrible!
Image
User avatar
Shadow
Masterful
 
Posts: 666
Joined: Tue Jan 29, 2008 12:00 am
Location: Halle (Saale), Germany


Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 2 guests