Proximity detecting destroyed objects

There’s an issue with proximity continuing to output the x/y of destroyed objects.

The top objects are archery butts that spawn archer units, the bottom are egg sacs spawning a simple enemy. the archer and its building spawns a friendly tag every second which lasts for .2 seconds. Same with the enemy and its building, only it’s an enemy tag. When the archer proximity detects an enemy tag it points toward it, moves forward and fires randomly. Same for the enemy unit only using the friendly tag as its target and it doesn’t fire, it just bumps into stuff. But when either unit dies, its friendly/enemy tag is still being detected by the enemy. This shouldn’t happen because the tags destroy themselves, and because the unit is destroyed it won’t be spawning more. You see in the middle area of the example i posted above they target an empty space. I don’t know why, I’ve tried modifying detection rate and spawning rate of the friendly/enemy tags

When I add in the units themselves to the map, they work usually, but when spawned from the buildings they proximity detect destroyed things. This makes me think spawned objects primarily have this problem.

I used to get this issue with black holes in my Vortex game. Even if the hole was destroyed, it still sucked me in long after it destroyed. I don’t remember exactly how I fixed it, but try having a timer instead of an always if you’re using one. I can’t remember how I fixed it. It was years ago.

Maybe the proximity coordinates need to be reflashed to 0 or turned off with a switch, and they’re just not sure where to go until they detect a new one. Maybe it’s your “only once” or “nearest object only” on proximity. I can’t view it on my phone. Just throwing out ideas here. Where do they go when there is nothing in proximity? Maybe that should be flashed over 2 numbers for x, y by a message from object destroy.

For this case when there’s nothing detected they’ll still be rotated toward the last detected x/y but without input from the proximity detection there should be no movement, of course that is the problem they are detecting something that has been destroyed/the detection isn’t being updated to reflect the object being destroyed. And for this case it doesn’t matter what delay or repeat setting you put for the proximity detection.

It works as it should when they are placed directly on the map and then starting the game, instead of being spawned once the game starts, which is why I consider this a bug.

Are you using emitter or spawn? There was a similar bug where emitted objects shared memory last year. Shooting one enemy killed a different enemy, and if one enemy proximity detected you, ones that didn’t would go after you.

This was allegedly fixed in December. If it still exists from emitter, try spawn. If it exists with both, grazer will definitely have to look into it again.

It’s spawn, I try not emitting objects at all unless they are simple projectiles or effects

Hey @Wizardry - I’ve been trying to reproduce this, but haven’t been able to. In my tests, after spawning and destroying an object, it’s no longer detected by a proximity trigger.

Can you give me some more details about how to trigger this bug? If I can reproduce it, I should be able to get it fixed.

@grazer Run this while looking at the logic within “archer” or “enemy - unit killer”, specifically the proximity detection for enemy/friendly. It plays out the same as the gif I posted above. Note this only happens when any number of units are spawned from their respective building. When they are instead directly added to the level they don’t behave this way, which is strange

So I’m looking at the logic, but I’m a bit confused. The “meta unit-killer” is checking proximity against “meta friendly”, but “meta friendly” objects are getting constantly generated and destroyed every frame. Since there is a constant stream of them spawning, it’s difficult for me to tell if there is a case where destroyed ones are targeted by the proximity trigger.

Right, anything above 0 for the timed destruction works for detection, but they can be set to spawn and destroy slower with less units out, let me know if that would help to see. I don’t know that they’re detecting destroyed objects or if the output itself is stuck, but newly spawned units are outputing through proximity detection the position of previously destroyed objects/objects that were destroyed or at least should have been destroyed before they were even spawned

Interesting little piece of information I figured I might add, anytime you inspect the behaviors of an object, any existing objects of the same object will affect the behavior viewer. If you click on one type, and there are others on the map that exist, you will see their proximity, collisions, and destruction as well flicker on the behaviors of the one you are currently viewing. The behaviors do not only display that of the specific object you clicked on and are viewing, but all of that object in the game as a whole. It’s a bit confusing I know, but I’ve learned to just accept it.