Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

Pathing Issue

Archive: 18 posts


Hey all,

I've started work on a multiplayer Tower Defense game and I've run into a few issues. I've managed to solve most things until now. As the title states, I'm having trouble with unit pathing.

I have units spawning from an emitter and I want it to move through a semi-complex environment, without hitting walls etc. At the moment the units are moving towards a tag at the other side of the map, (Look at Rotator + Mover) but they simply don't recognize any objects or walls in front of them and end up running straight into them.

I'm sure there is a way to keep the units turning and following the main path on its way to its target, as I've seen it being done in various published levels.

Any suggestions?

Thanks in advance!
2011-02-13 21:06:00

Author:
Pualjo
Posts: 8


Use named tags. Have multiple tags named stuff like "point 1" and point 2". Then make multiple tag followers wired up to a selector. Make it so that each time a tag follower gets to its tag (use close radius tag switch) it triggers an or switch that moves the selector up an selection, turning on the second tag follower.

So it goes like this. Tag follower "point 1" is active. Tag follower reaches tag "point 1". Selector is activated. Tag follower "point 2" is now active and so on.

Hope this helps.
2011-02-14 04:15:00

Author:
Unknown User


Hey Merlin,

Thanks for the help, sorry for not responding, been a busy few days!

I've managed to get through most of this. Here is what I've done.

I placed 3 tags at 3 locations, coloured them purple and named them 'Point 1, Point 2, Point 3'. I added a mover to the enemy unit. I then added 3x Look At Rotators. I then added a 3 Port Selector and linked up its 1-3 outputs to Look At Rotator 1-3 respectively. I added an 'Or Gate' logic and hooked up its Output to the Selectors 1-3 Inputs.

This is where I'm stumped. You say "each time a tag follower gets to its tag (use close radius tag switch) it triggers an or switch that moves the selector up an selection" but I'm unsure what a 'close radius tag switch' is and also if I have hooked up the various logics/movers correctly. Also, should I be using a 'Follower' over 'Look at Rotator'?

When I unpause, the unit moves to the first tag and circles it. The wire from the Selector Output 1 connecting to the Look at Rotator 1, is lit up, but obviously it's not switching to the next tag.

Thanks again for your help.
2011-02-16 23:55:00

Author:
Pualjo
Posts: 8


if you are using a predefined path, then i would just name all tags "path", then have a mover set to use local space just like you probably have.

Set the look at rotator to look at the "path" tags. Here's the tricky part. Set your minimum detection radius to just about the size of your tank. Set the detection angle to around 180 degrees. Now, when your tank goes over the tag, it moves out of range, and it begins moving towards the next one.

When setting this up, use a counter on your tank, and input it into both your look at rotator and mover, and set them both to speed scale. Now if you want to adjust the speed, you just change the counter value, and your speed of rotation adjusts with it. It simplifies things some later on.

I'm working on a tower defense level too. If you want to, I'll be on tonight and we can swap ideas.
2011-02-17 00:20:00

Author:
tdarb
Posts: 689


Thanks Tdarb, your method worked a treat.

I've since been trying to get the units to stop moving at a tower in order to shoot it, then start moving on again once its destroyed. I can get this to work no problem, but the method doesn't work for newly emitted units, as they aren't wired up like the unit I was testing on. The connections don't hold through for newly emitted units.

This is the next focus then. Any ideas? Admittedly I haven't spent much time trying to figure it out as I have to rush off to work now. I assume we'll need to do it by using tags sensors/tags, due to the issue above.

I'll try get online for a bit later, but have stuff to do. I'll be on from most of the day Sunday and Saturday evening anyway if you're available.
2011-02-17 11:50:00

Author:
Pualjo
Posts: 8


I can get this to work no problem, but the method doesn't work for newly emitted units, as they aren't wired up like the unit I was testing on. The connections don't hold through for newly emitted units.

Did you have your emitted unit wired up to anything that doesn't get emitted with it? If so, yes, all of those connections will be broken. This was basically crippling in LBP1, but with LBP2 you can create "remote" systems that will have emitted objects affect their environments and vice-versa. I can be tricky, but it is possible to send just about any signal remotely using the input of tags. Tags can be wired up like lights, and give/receive anywhere between 0-100% signal, which in turn can be picked up by tag sensors and translated into any function you desire, without the need to receive that value directly from the object outputting it.

Let me know if this is the issue you're facing, and I can elaborate on any specific applications of this technique you'd like.
2011-02-17 15:10:00

Author:
jdteather314
Posts: 74


@Jdteather314

Cheers for your reply.

I suppose the easiest way to do this is if I explain what exactly I'm trying to do, so you can tell me step by step how to do it. Once I get it ingame, I'll be able to see how it works and develop an understanding for the process and how all the bits work together.

My emitter emits an enemy unit. The unit moves along a set path towards tags, using a Look at Rotator with its detect range set to 180 degrees. I can set any sort of complex path for the unit to follow and it does, no problems.

What I want the unit to do however, is to stop once it reaches certain tags (placed on towers) and start shooting at it until its destroyed. Once destroyed, the unit needs to start moving again along its preset path, until it reaches the next tower.

As I've outlined in my last post, I can get this to work, but not for newly emitted objects. I think I was using a tag sensor hooked up to a Toggle logic, which was hooked up to the mover, in order to stop it. I'm guessing I will need to use your method with tags and tag sensors to get it working the way I want.

Thats pretty much it.

By the way, much thanks to everyone that has replied. Really impressed so far with the helpfulness of this community!
2011-02-17 20:22:00

Author:
Pualjo
Posts: 8


As I've outlined in my last post, I can get this to work, but not for newly emitted objects. I think I was using a tag sensor hooked up to a Toggle logic, which was hooked up to the mover, in order to stop it. I'm guessing I will need to use your method with tags and tag sensors to get it working the way I want.

Well, there are a couple of ways of going about this, depending on how robust you want the functions of your enemy units' movement to be.

The most simple, straightforward way is to place a tag sensor in your enemy unit's chip, set to inverted and detecting player towers, so that it is constantly outputting at 100% whenever it is NOT in range of a tower. Just set its trigger radius to whatever you deem an appropriate distance for enemies to be firing from, and hook it up to the "on/off" input of the enemy's mover. This way, the mover will simply turn off when the unit comes in range of a tower. For a different effect, set the tag sensor's output type to "signal strength" and the mover's input type to "speed scale", and using exactly the same setup, the enemy will only slow down as it approaches the tower, and speed up again when out of range.

Alternatively, if you'd like to leave room for drastically different speeds/movement types, you could always use a selector. The first output of the selector would be the "moving" state, the second would be "stationary". If you wanted to add different behaviours, those would be more outputs on the selector. Now you can just take that same tag sensor used in the first method, and hook it up directly to the first input of the selector, but also to a NOT gate, with the NOT gate's output wired to the second selection. This is essentially the same concept as the first solution, but leaves room for expandability (in case you wanted enemy units that can detect OtHER enemy units that are stopped, and either join them, move on, etc..)
2011-02-17 20:53:00

Author:
jdteather314
Posts: 74


If the units are sackbots, then get a named tag. Set the sackbot to 'Follow Waypoint' and make the tag it needs to follow that named tag. Whoopee! I fixed yur problem. Now gimme my cookies.2011-02-17 21:02:00

Author:
Mista Epic
Posts: 16


If the units are sackbots, then get a named tag. Set the sackbot to 'Follow Waypoint' and make the tag it needs to follow that named tag. Whoopee! I fixed yur problem. Now gimme my cookies.

This seems a little unhelpful, considering it's already been established in this thread that the OP is using movers and look-at rotators, which seems to suggest that they are most definitely NOT using sackbots, and your solution is only useful in a singular, specific application. If there were any cookies, I don't anticipate you'd be getting any.
2011-02-17 21:25:00

Author:
jdteather314
Posts: 74


Enemy movement works wonderfully now, thanks! They stop and start as required.

Since I have them spawning from the same emitter, I have an issue with them bunching up behind each other when they all reach the tower. Obviously I'll want them to spread out a bit and maneuver themselves around the tower realistically, so they can shoot at it. I have one method in mind, using multiple emitters and a bunch of preset tag paths, but that sounds like a long workaround to a potentially simpler solution.

As you mentioned with advanced behaviours using the selector, would this facilitate such a behaviour? I've tried setting 'Follower' movers to 'Flee' with a small radius, so the units move away from each other, but all that does is stop them moving at all.

Overall the units won't be more advanced then, move to target, shoot at target until dead, move to next target, rinse and repeat. They won't attack enemy players, or flee, or have any relation with other enemy units in proximity.

Thanks again, you've been real helpful. I spent a solid week trying to figure this stuff out, and as usual, the solution always makes sense!
2011-02-17 21:29:00

Author:
Pualjo
Posts: 8


I faced a similar problem to your stopping at the towers issue with enemies hitting each other when they follow the path. They gain slightly on one another in corners. To resolve this I set an AND gate just before the mover. Into that I input my speed scaling counter, and a tag sensor. The tag sensor is set to inverted so it is on when it does not detect a tag. Then output that AND gate to my mover and rotator.

since the AND gate always passes the lowest signal strength through, if you want the stop to be less abrupt, you can wire a Timer in between the tag sensor and AND gate. When the timer activates it will not affect the speed until its scale drops below that of your other speed scaling device (if you are using one). Once it drops below the current scaling, it will decelerate your eemies to a stop as quickly or slowly as you want.

In my case, whenever it gets too close to the enemy in front of it, it will stop and wait for it to get out of range again. I also have some manipulation to make it match the speed of the one in front of it so it is not continually stopping and starting, but you may not need that part. This should work pretty well for you too, by just putting the tag on the towers.
2011-02-17 21:40:00

Author:
tdarb
Posts: 689


I'm struggling to get the slow down movement working, do you need to add a counter? On the enemy unit, I have the Tag Sensor set to 'Signal Strength', which is outputted to the Mover with its Input set to 'Speed Scale'. It just comes to an abrupt halt though.

I managed to get the bunching up sorted, they sort of avoid each other a bit.. Looks a little unnatural at the moment, but should be fine with a bit of tweaking. Adding the slowing down/speeding up should help there too.
2011-02-17 22:19:00

Author:
Pualjo
Posts: 8


@tdarb Nice idea! How much fine-tuning did you have to do to get the variable speeds right? Did you manage to work out a specific speed increase percentage that needs to happen in order for the units to remain perfectly spaced-out when changing directions?

I was only going to suggest another tag sensor, set to require tags that are on all enemy units, and with a detection radius of about 45dg or so, facing IN FRONT of the enemy unit. Basically, what I'm going for is a "recessive" moving function, and a "dominant" stopping function. So on the selector, the second input receives an OR gate that is set to go off with either the tower tag sensor OR the enemy unit tag sensor. The first input (the moving one) receives an NAND (inverted AND) gate, so that both the input from the tower sensor AND the enemy sensor must be off in order for it to receive signal.

Since the tag sensor for enemy units is only about 45dg facing forwards, it'll only get set off when there's a unit in front of them, therefore the front unit is always moving forwards, until it stops at a tower.

Having the units go AROUND the other units, now that's a whole different matter. I'll see if I can come up with something.
2011-02-17 22:35:00

Author:
jdteather314
Posts: 74


signal strength works with a scaled tag output. If you connect the the output from a counter or timer into a tag, that tag will send a signal that is scaled so that its strength is equal to whatever percentage of the counter is filled. That's what you would pick up with signal strength. Using that on your towers would only slow down your enemies some, or stop them based on the strength of the signal.

What I would do is just run a timer into your mover (set to speed scale). Set the timer to left/right and set the current time so that it is full at the start. Now into that run a direction combiner. If your tag sensor is set to inverted, you will want to plug it straight into the positive input of your combiner. Then run your tag sensor through a NOT gate, and into the negative input. If your tag sensor is not inverted just flip those.

Now, when your tag sensor activates, it will start the timer counting down and slowing the speed. When the tag is gone it will begin to fill back up and start your enemy moving again.
2011-02-17 22:49:00

Author:
tdarb
Posts: 689


@tdarb Nice idea! How much fine-tuning did you have to do to get the variable speeds right? Did you manage to work out a specific speed increase percentage that needs to happen in order for the units to remain perfectly spaced-out when changing directions?

Thanks! I didn't have to do any fine tuning. I have my mover and rotator on the enemies set to speed scale, and am inputting a counter into that to control the speed. That way I can easily reuse it to control any enemy i want and have the turning scale appropriately with speed.

I just ran that counter to a tag. That allows the enemy to transmit what speed it is currently moving at.

The, using signal strength on a tag sensor, I grab that number with the enemy that needs to slow down, and using a sort of modified adder, I reduce the signal strength coming from my counter to match the signal of the enemy ahead. When the enemy in front dies, the one that was slowed returns to its normal speed.

Then run that through an AND gate with another tag sensor that is inverted and set to the absolute minimum distance. when it shuts off, the whole thing stops.

That gives a nice variable speed setup that will allow for slowing or stopping as needed.
2011-02-17 23:01:00

Author:
tdarb
Posts: 689


Thanks tdarb, I'll give this a try either tomorrow or saturday and report back with my results.2011-02-17 23:10:00

Author:
Pualjo
Posts: 8


Alright then, I have the moment exactly the way I want and I'm really happy with the results.

There is one last issue with the whole thing. When I bump into an enemy unit, I can move it/rotate it. This causes a number of problems. If I keep pushing into it, I can easily turn the unit around and it will then start moving backwards towards earlier tags, which of course is the wrong direction, and game-breaking. Same goes for when the unit is in front of the tower and shooting at it. I can nudge it and turn it so it is shooting in the wrong direction.

I've spent an evening tweaking anti-gravity settings etc, but nothing seems to work. Any ideas?
2011-02-23 11:18:00

Author:
Pualjo
Posts: 8


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.