Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Ideas and Projects
#1

How to make objects follow waypoints

Archive: 7 posts


We've had one entire question about the AI racers on O-k-i-n-g-0 and my Sack Turismo level, yes, count them , one (and it wasn't even directed at us, it was a suggestion to ask us) so in my super helpful way, heres how we did the AI on that level.

Getting it to follow blue keys

http://img827.imageshack.us/img827/1987/diagramcar.png

This picture should be self explanatory, but we used a look at key tag chip in combination with a mover that pushes the car forwards.

We use the minimum range function to get that shape of the sensor zone. This means the car will always travel to the closest tag, then when it's about to hit it it switches to the next one thus pushing it around the track.

That's very simple? How do you make it more impressive?

Well, that's the trick isn't it. Having 6 cars follow a perfectly indentical racing line around a track is pretty dang boring.

What we then did is make 6 different lines around the track, completely parallel to eachother, almost like a super wide scalextric course.

We then put about 8 nodes in the course where the racers would then switch lanes to an adjacent lane. I won't tell you how to do that though, you guys can work that out for yourself, but there you go ^^

That's how you get stuff to loop on a following waypoint

The way we did it in our BCC03 is different, we used as sequencer to turn key switches on and off, but that's because we wanted the thing to stop at a certain point before continuing.
2010-11-07 16:05:00

Author:
Asbestos101
Posts: 1114


Really cool! It seems really easy, but will surely help some others. Good work!2010-11-07 16:07:00

Author:
piggabling
Posts: 2979


We then put about 8 nodes in the course where the racers would then switch lanes to an adjacent lane. I won't tell you how to do that though, you guys can work that out for yourself


...come on.

Anyways, this is a really interesting topic. I thought about a more dynamic system, where you create waypoints that have a LEFT node and a RIGHT node. Then have the car have a LEFT sensor and a RIGHT sensor, with a 180 degree arc, left covering the whole left side of the car and right covering the whole right side of the car, with infinite range. If only one tag is active, it will turn to that side. If both tags are active, it will drive straight. When a checkpoint is reached, that checkpoint should be destroyed and a new one emitted (or tags deactivated, new tags activated). Each AI driver would have their own set of checkpoints.

By the way, if you have all the checkpoints in place at any given dime, doesn't your method risk the AI driver getting homed in on a wrong checkpoint. For example if there's a hairpin turn, that it would try to cut through to the other side of the corner?
2010-11-07 17:16:00

Author:
Linque
Posts: 607


By the way, if you have all the checkpoints in place at any given dime, doesn't your method risk the AI driver getting homed in on a wrong checkpoint. For example if there's a hairpin turn, that it would try to cut through to the other side of the corner?

Well, if you want to have 6 cars on track at any time anyway, then you need to make the track wide enough.

This is indeed a problem that we had to get past ^^, the way to fix it is careful tweaking of the zones to not make them too wide, yet big enough to allow them to get knocked about a bit and regain it.

Anyway, to get the racers to switch lanes we used a randomiser triggered by a red key, and that had two inputs sent to a direction combiner.
That direction combiner went to a selector's input, so then it'd either randomly increment or decrement upon being triggered.
You then assign the different coloured lane sections to the different outputs on the selector.

The problem with that though is that if a car is on selector output 1 and it decides to decrement, it's going to sway wildly across the track to get to output 6's line of keys. So what you do is you add some AND gates on the direction combiner so;

If Selector output 1 is active, then the second input to the AND switch governing decrement is inactive.

I accidentally used some big words there, you might have to reread that last sentence, lol
So if the car is on an outer track, it'll only ever stay on course or move inwards, never jump to the far side.
2010-11-07 17:26:00

Author:
Asbestos101
Posts: 1114


Just a small problem with that method on a track of which lanes overlap... But I've thought of a solution, you can have for example blue keys going along a piece of track, go around a bend and

a) Deactivate the mag keys on the track except the bit you wish the cars to overlap (but that would pose a problem for other cars unless each car had their own colour trail of mag keys)
b) A toggle switch to change between which sensor switch is picking things up, and on the overlap of the track, have another colour such as red across the overlap.


If you don't get what I mean, imagine a giant " P " where you drive up from the bottom, turn at the top and overlap at the... uhhh... overlapping bit.

And if you still don't get what I mean, I'll try to come up with some sort of graphic representation.
2010-11-07 17:40:00

Author:
Weretigr
Posts: 2105


Just say a figure of 8, lol.

What you could do, is make it so once the cars are on a straight, space out the keys, and reuse the same key placement twice on the bridge across.
2010-11-07 18:37:00

Author:
Asbestos101
Posts: 1114


for overlapping bits (im assuming you mean where there is a bridge over the track) you could just set the tag sensor to "same level" couldnt you?2010-11-09 18:28:00

Author:
Skalio-
Posts: 920


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.