Home LittleBigPlanet 2 - 3 - Vita - Karting LittleBigPlanet 2 [LBP2] Help!
#1
How to Make a Race
Archive: 9 posts
Long story short, how do I go about making my vehicles in a race perform 3 laps before giving the player points based on what position they come in? I know it's possible, but for the life of me, I just can't envision the logic I'd need to create. So far I reckon I'd need several hologram checkpoints located at key points of my course, and the vehicle counts the checkpoints it hits in order, then once all 10 checkpoints have been activated, it gives the driver a score. But as for how the vehicle works out which checkpoint needs to be touched next I dunno, and as for how to work out which vehicle placed first, I don't know, either. Any help would be greatly appreciated. EDIT- Oh, and I tried searching for tutorials, and I couldn't find anything at all. I apologise if I've overlooked something obvious. But perhaps if someone could help me, said person could help loads of others by sticking a race tut in the tutorials board? ;3 EDIT 2 - For clarity, here. It's a top-down race. | 2011-02-01 12:36:00 Author: Ostler5000 Posts: 1017 |
The basic idea only requires one tag/player sensor, at the finishing line, hooked up to a Counter (set to max 3), but the problem is that it is easy to cheat; just turn your car and circle the finish line three times. Here is an idea, but it does not take multiplayer into account: Each checkpoint on your road has its own Microchip. It contains a player/tag sensor. Hook up each sensor of a checkpoint to the chip of the next checkpoint: this will make that after you pass one, the next checkpoint becomes sensitive. The last checkpoint - the start/finish line - will trigger a Counter to add one. Hook up the last checkpoint's output to one input of an OR gate. Add the race's starting signal to the other input of the OR and connect its output to the chip of the first checkpoint. The output of the counter ends your race when it reaches 3. Edit: I just realized that this does not disable the checkpoint you pass, but this can be fixed with 1-count Counters: one before each checkpoint's chip; they get activated by the previous chip and stay that way. Hook its output to the checkpoint's chip to activate it. When that checkpoint gets passed, it not only activates the Counter of the next checkpoint, it also has to reset the Counter that activated its own chip. Alternatively, this thing might also be done with chipped checkpoints hooked up by a Selector. All sensor ouputs go to one big OR gate that connects to the Cycle input of the Selector; the active checkpoint that gets passed by the player then essentially pushes the Selector to activate the next checkpoint chip. Probably a more portable solution! (I will leave up my earlier inferior suggestion for the purpose of self shaming) This should do it. http://i.imgur.com/lhSna.gif | 2011-02-01 12:47:00 Author: Antikris Posts: 1340 |
That's fantastic. Already I feel I can sort of... visualise and go from there. I have one question though, how would I go about determining who came first and whatnot? Your system will help me work out who's finished, but I can't quite make the connection to how I would use that to work out who came in what position and how to issue a score based on that. Oh, and another question - Do the chips go on the checkpoints, or would it be more effective to put the chips on the vehicles? The way I work it out, it would be a little more convenient to put the logic in the vehicles, and place tags on the checkpoints. EDIT - Fantasic. I've got a working lap-system thing! Woo! Now I just need to figure a way to give racers scores. | 2011-02-01 13:07:00 Author: Ostler5000 Posts: 1017 |
Oh, and another question - Do the chips go on the checkpoints, or would it be more effective to put the chips on the vehicles? The way I work it out, it would be a little more convenient to put the logic in the vehicles, and place tags on the checkpoints. In envisioned them on the checkpoints, but now that you raise the question, it would indeed be more handy on the cars!! Then a checkpoint simply has a tag (labeled CP1, CP2, etc). This would make a car know when it is finished, rather than the global level know when it is finished; you can disable a car after its own Counter expires and then give a score. I have one question though, how would I go about determining who came first and whatnot? Your system will help me work out who's finished, but I can't quite make the connection to how I would use that to work out who came in what position and how to issue a score based on that. Not sure... The level itself will no longer know when someone came over the finish line for the 3rd time. But a car does and can activate perhaps a tag "finished". The finish line has then a tag sensor that triggers each time one finished player passes. Have the sensor hooked up to the cycle input of 5-state Selector: state 1 is default, 2 to 5 are for winner to loser; output 2 to 5 can then be hooked up to a tag labeled "finished first", "finished second", etcetera. Each car can register each of these tags when it is in finishing mode (after Counter expiration), can use tag sensors with a selector again and its output to Price Givers corresponding to the amount of points one deserves. This has a drawback, though, that two players who finish closely can get caught in the tag cycling caused by each other; first player registers as first, second registers as second, but first gets caught in the latter event causing him to receive points for second as well. The points system on the car needs to make this a one time only event: once it registers the reward, it does not take anymore tag sensor input. | 2011-02-01 13:42:00 Author: Antikris Posts: 1340 |
I've worked out a means of doing it - I have some more invisible checkpoint things set up. These ScoreGates as I've labelled them, require the vehicle to have an active 'Finished' tag, then when they collide with them, they disappear, rewarding the vehicle with a score. To avoid multiple vehicles being awarded the same score, or one vehicle destroying more than one ScoreGate, the highest-value ScoreGate sits directly on the finish line, with all the others waiting in reserve just ahead of the finish line. Each gate has sensors on it, on the look out for the gate with the next highest score giver on it. In other words, ScoreGate for 2nd place is waiting for the ScoreGate for 1st place to disappear, so it can take up the same spot on the finish line. And the 3rd place gates waits for the 2nd place gate, so on and so forth. The gates move between the 2 spots easily wth the use of 2 Follower Movers and 2 Tags. Thanks very much for your help. Especially the little disagrams you posted. (Both of them. I saw the one with the errors. ;3 ) | 2011-02-01 15:32:00 Author: Ostler5000 Posts: 1017 |
Just keep in mind that the "score gates" cannot give a score to a player themselves, AFAIK. Unless player info from the (impact) sensor gets transferred to the score giver object. Having the score giving system on the car itself (or at least a player controlled object) fixes it. But I still have way too little experience with this part of the game to make any solid statements about that. | 2011-02-01 15:40:00 Author: Antikris Posts: 1340 |
I have a resetable solution on my thread with a lovely video that demonstrates if you want to see it :blush: here is the thread (https://lbpcentral.lbp-hub.com/index.php?t=47191-Top-down-Racer-Tutorial) if you are interested | 2011-02-02 12:00:00 Author: AssassinatorRFC Posts: 715 |
here is the thread (https://lbpcentral.lbp-hub.com/index.php?t=47191-Top-down-Racer-Tutorial) if you are interested I just posted in your tutorial thread linking to this topic. Full circle. | 2011-02-02 12:07:00 Author: Antikris Posts: 1340 |
As this thread is back alive now, I just got the idea that perhaps it is better to variably award the winner based on completed race time, instead of a fixed reward based on the order players finished. This will also give the level value for singleplayer play. The easiest thing I can thing of right now is a fairly lenient timer (if players are disqualified after 10 minutes anyway, set this timer to 10 minutes as well); put a Score Giver (with a large score setting) on a separate, nested MC and wire the timer on the other chip to this Score Giver. Then when the player passes the finishing line (if you stick with the checkpoint logic on the car instead of on the race track, the car will know when it finishes) have that event switch on the nested MC (wired MC, yes). I do not know if this setup will work; it works with Sequencers on a nested chip, but not entirely sure about Score Givers. The timer increases the score that is about to be given over time, the activation of the chip (finish!) actually activates the Score Giver and awards the player the variable amount. Oh, and it is a good idea to stop the timer immediately when passing the finish line or else points will be continuously given as the timer keeps counting, I think. | 2011-02-02 12:17:00 Author: Antikris Posts: 1340 |
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.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.