Would anyone happen to know a distance bundle that can be an alternative to proximity, one where you can change the distance and it knows when the object is not in proximity of it? But it will find the CLOSEST object.
I have a distance bundle in my Bundle Library, I would put the bundle in the target object and use the players position with globals. Then just message the player when it is close.
Flowlab Game Creator - Bundle Library
Tried that and it’s not working like the proximity.
When I had the proximity connected as shown below, the character would follow the closest object of this object, and whichever one the character object was closest to, will enable. The distance was 500. If it was not within a distance of 500, then the object will disable.
I tried using your bundle, and the character wouldn’t even follow it, it would move in a straight line.
There’s nothing in this code that would make it move toward the object, just enable and disable it.
Could you share the link to the game and what objects you want to replace the proximity in?
That’s because this is the pathfinding object. The other object “AI 1” is the one following the “Pathfinding AI 1” Object. When you look in AI 1, the “All-Star” bundle has the movement in it.
This is what I have done instead, I also suggest reducing it from 500 because even with the proximity in wants to dig into the cliff.
Did it work for you? Was it following the path?
Yeah it was, I lowered the distance to 200 in both objects and it was on the path.
But it was a bit too fast because it was always flying through the path with pointat.
There is still a lot of lag, how would I change this for the AI object as well? The performance metric is saying that it’s the proximity causing lag, but I removed the proximity from all the pathfinding objects, they are only in the AI objects but I lowered them to 200.
Hmm, the lag is probably caused because every single pathfinder object is calculating an expression with the player’s globals. And making a pathfinder object for every AI would really slow down everything.
To do this better, something needs to be done in the ai objects alone that would work with all ai’s with a single set of pathfinding objects. No code in the pathfinding objects would be best to help with performance. Here’s an idea, what if you attached an object with a fixed offset of 200+X from the attacher object? Then only use proximity in that object to find the closes pathfinder in front of them and message the position back to the attacher.
See, the issue with that is that the pathfinding objects that the ai passes will disable, this is to make sure they dont go in reverse instead of moving like they are supposed to. So I am not sure how I will make that possible, especially if another ai racer get’s the ability and uses it after the one in front of them.
It really doesn’t matter that they are disabling, that only affects the collision side.
There are 1000+ objects all doing the same expression, multiplied by having one for each ai.
If you want to do a system like this with performance then you cannot have code in those objects and use a single object for all raycers.
My suggestion is to have an attached object that is offset (always → 200 → +x position) to be in front of each racer that would use its own small proximity to closes pathfinder object to see in front of all the racers. The offset attached object can message their attacher racer to the position of that pathfinder position.
I don’t understand, how is attaching something to the racers going to help? I’m sorry, I am a visual learner.
I understand that there must only be one pathfinding object for each racer to follow, but i’m not sure how the attached racer object is going to help the racer actually move.
Think of it like you don’t have to cast a proximity at the center of the object, but anywhere around the object. In this case, the proximity will be 200 pixels to the right of the racers.
I put this in the Pathfinding object for all racers which I think you were trying to get me to do:
But the question is, what is it being sent to and how is it going to be used.
No, I mean a new object that you attach to the racers. The attached object it would be (always → 200 → +x position). That lets you offset the attached object off of the center of the racer.
With it in front of the racers, you can cast a proximity there.
Ok I did what you said in the offset object, I did this in the player object:
Is this what you meant?
Yeah, you can send the message to reply to last message.
And you just need the racers to send 1 message to their attached objects.