Lost factory in SpawnPoint

Discussions about Coding and Scripting
Post Reply
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Lost factory in SpawnPoint

Post by Barbie »

While trying to understand what produces the heavily repeated Access Nones here, I found the following but can not explain it by the code: If for whatever reason a Thing-/CreatureFactory's SpawnSpot array get filled twice AND if the number of SpawnPoints for this factory exceeds ArrayCount(SpawnSpot)/2, trouble comes in: if the function ThingFactory.trySpawn is called for the SpawnPoints that have NOT been added at second fill run, the SpawnPoint's factory is None at the moment it is called by the factory!

To test that, I've added an Actor ("DebugThingfactory") that shows the factory of every SpawnSpot of a ThingFactory: they are all correct (and not None) any time I trigger that DebugThingfactory.

Finally I just want to understand why a SpawnPoint's factory is None if called by ThingFactory's TrySpawn() and not None if I use another Actor accessing that SpawnPoint's factory.
:???:

Attached a test map where I have created sub classes of CreatoreFactory and SpawnPoint similar as done in TeamMonster.
Attachments
TestWiredCreatureFactory.zip
(11.94 KiB) Downloaded 83 times
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Lost factory in SpawnPoint

Post by Barbie »

Bump here - anybody got at least an idea? Has it to do with calling that function asynchronously from state code? Or are there little green men behind the scene?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Lost factory in SpawnPoint

Post by sektor2111 »

When was trying a fix for that SpawnPoint spam message I was threatened by something like: Hey, will crash game.
Not only was running properly (because I know what a Path-net is and how to screw it badly) but i went in chapter ThingFactory + CreatureFactory.
These KEYPOINTS are able to record and to set 16 SpawnPoints. Whatever "mappers" adding 22 SpawnPoints for a Factory are doing this wrong. So to speak if SpawnPoint doesn't have a mother Factory it should be stopped by setting up a garbage tag in order to isolate it from blabbering. You cannot delete it because it leads into a crash like a lottery. Someday, I'll buy hacked stuff for UT able to mock with constants and then I'll declare war to all sort of dumb things.
My technology is to rush in/before PreBeginPlay in doing some stuff and setting originals as null points - goal is to replace them with PathNodes but at this moment I cannot do it. I need stuff to copy pathing data which I don't have. Those attached SpawnPoints are gonna be nice (sanitized). This is what I know and the rest of things are not so known for me.
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Lost factory in SpawnPoint

Post by Barbie »

Thanks for your reply. :)

After messing around with that for hours I found the reason for that wired behaviour. Have a look at stock code:

Code: Select all

class SpawnPoint extends NavigationPoint;
[...]
var ThingFactory factory;
[...]
And then at its derived class:

Code: Select all

class WiredSpawnpoint expands Spawnpoint;

var ThingFactory factory;
[...]
That means that both classes have their own variable factory and they of course can have different values.

Now have a look how stock factories' SpawnPoint list is filled (I left out irrelevant lines):

Code: Select all

class ThingFactory extends Keypoint;
var int numspots; // number of spawnspots
var Spawnpoint spawnspot[16]; //possible start locations

function PostBeginPlay() {
	foreach AllActors(class 'Spawnpoint', newspot, tag) {
		if (numspots < 16) {
			spawnspot[numspots] = newspot;
			newspot.factory = self;
			numspots += 1;
		}
The variable Spawnpoint.factory is set here, but not WiredSpawnpoint.factory - so this one is empty.

ThingFactories' derived class WiredCreatureFactory uses WiredSpawnpoint instead of Spawnpoint for filling the list beyond current index numspots (I again left out irrelevant lines):

Code: Select all

class WiredCreatureFactory expands CreatureFactory;
// spawnspot[16] is NOT redeclared here
function PostBeginPlay() {
	Super.PostBeginPlay(); // <- here the above code is executed
	foreach AllActors(class 'WiredSpawnpoint', Tnewspot, tag) {
		if (numspots < 16) {
			spawnspot[numspots] = Tnewspot;
			Tnewspot.factory = self;
			numspots += 1;
	}
Obviously WiredSpawnpoint.factory is accessed here, but not the variable Spawnpoint.factory. This means that all WiredSpawnpoints not treated in this second loop have not set their factory.

Summary1: If the variable WiredSpawnpoint.Factory had not been defined, things would have worked.
Summary2: The coders of TeamMonster didn't know what they were doing. Heavy statement, but the code shows it.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Lost factory in SpawnPoint

Post by sektor2111 »

Bingo !!!
So now you can figure what TeamMonster.u is, it's just bullshitting around MH for ( my old ) deceptions. Perhaps I can remove the fix for that super-duper bad end because those levels are no longer interesting for me...
User avatar
Barbie
Godlike
Posts: 2807
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Lost factory in SpawnPoint

Post by Barbie »

sektor2111 wrote:You cannot delete it because it leads into a crash like a lottery.
What do you mean here that cannot be deleted? SpawnPoints or Creature-/ThingFactories? I guess SpawnPoints, because they are part of the path network.
sektor2111 wrote:Whatever "mappers" adding 22 SpawnPoints for a Factory are doing this wrong.
I've even seen that different factories were sharing the same SpawnPoints (what generally does not work).
:loool:

Because there are maps that have more than 16 SpawnPoints for a factory (e.g. MH-GardenOfDeath, MH-WhtTheFuck, MH-Chthonian), I've recently extended the factories supporting unlimited number of SpawnPoints. Until now that works fine. :) Attached a graphical representation of the distribution of number of SpawnPoints, but until now for a few maps only.
Attachments
SpawnPointDistribution.jpg
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Lost factory in SpawnPoint

Post by sektor2111 »

SpawnPoint (or SpawnPiont as written often by a HTD addicted one bullshitting settings ) is a bitch NavigationPoint, for this reason you need smarty hacks for replacing it - I prefer to ruin it and leaving it wild unused. Else this one has that variable "Factory" which you were mentioning above and it is ONLY ONE for default, sharing such things between many factories = stupid noob guessing work, 0 Tutorial read - I even failed to see these dumb setting all the time, it's unbelievable how they were doing trash. CreatureFactory has another simple setup which is not used - Acting as TRIGGER VIA TOUCH. It really doesn't need to mess with Counters since it do works normally by direct Touch - using a trigger is adding a hit at counter or whatever linked thing which is not necessary - else some smarts were making trigger permanent hitting counter without to kill monsters :loool: . If we want more pawns in wave, we can put 2 Factories and let's say 11×2=22 SpawnPoints, 11 for a Factory 11 for the other one, having separate TAGS. Obviously is not a Rocket Science configuring these Factories.
Post Reply