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

Detecting Number of Players

Archive: 14 posts


Hey all

I was curious, in certain story levels, like the rat race, the level seemed to know how many people were playing. Is it possible that there is a way to tell how many people are playing, such as if there are three players, the level spawns three vehicles, or if there are four, it spawns a fourth?

I need this for my race level if there aren't any ways, I might have to have a vehicle selection option.
2011-03-02 04:20:00

Author:
AdenRalumdan
Posts: 296


Well, it's been asked several times, so maybe try a quick search before posting next time... but here you go...

The Player Sensor tool has a setting for number of players required. So at the start of your level (like maybe right smack on the entrance gate) place a microchip with 4 player sensors on it, each set to a different required number of players. Then do some comparisons. If 1 is on but not 2, there's only one player... if 2 but not 3, then two... of course if the 4 player is on there's obviously four players.

Hope this helps!
2011-03-02 05:26:00

Author:
v0rtex
Posts: 1878


If you want the easy way out, you can pick up my advanced player sensor from my logic showcase level. The link is in my sig. In a nutshell, the advanced player sensor can tell if there's greater then, less than, or equal to any number of players. Hope you find it useful!2011-03-02 05:32:00

Author:
Yofig
Posts: 288


v0rtex - If the 3 player sensor is on the 2 player one will be too, and the 1 player one.

I've wanted to have things set out a different way whenever something new comes in. For example:

P = Car
- = Start Line

1)

------P------

2)

---P-----P---

3)

--P---P---P--

4)

P---P---P---P

If 3 is activated, so is 2 and 1. Is there any way around it?

Maybe a selector-typed thing?
2011-03-02 07:30:00

Author:
mutant_red_peas
Posts: 516


A selector type thing is the perfect solution. Hook the 1 player sensor into the top input, the 2 player into the next, 3 player into the third, and 4 player into the fourth. The selector will pick the highest output.

There are other ways as well but that's the simplest. (The next simplest is to use XOR gates. 1 XOR 2 for 1 player, 2 XOR 3 for 2 player, 3 XOR 4 for 3 player, and 4 player will always be unique.)
2011-03-02 07:44:00

Author:
Tygers
Posts: 114


Well yes, that's why I said you need some selection logic along with it. It's not the lesser values you need to be concerned with. If the next greater value is not on, and the current value is, then we can say that the current value is correct. And yes, a selector set-up could work, or a series of selectors as the true-false gates.2011-03-02 09:02:00

Author:
v0rtex
Posts: 1878


Well, it's been asked several times, so maybe try a quick search before posting next time... but here you go...

The Player Sensor tool has a setting for number of players required. So at the start of your level (like maybe right smack on the entrance gate) place a microchip with 4 player sensors on it, each set to a different required number of players. Then do some comparisons. If 1 is on but not 2, there's only one player... if 2 but not 3, then two... of course if the 4 player is on there's obviously four players.

Hope this helps!

Well, I did do a search...I guess I didn't search enough. I couldn't find anything on the subject.

I figured it'd be something like that. I just couldn't figure it out =P
2011-03-02 15:29:00

Author:
AdenRalumdan
Posts: 296


It is as simple as this:

http://i.imgur.com/EaeIm.gif

Four player sensors, each with a huge range (if one player runs out of range, the thing will detect one player less; so, unless you tweak the system, set a very large radius here). Each sensor requires one player more than the previous one. Hook them all up to a Selector, with the sensor requiring just one player hooked to input #1, p2 sensor to input #2, etcetera.

The selector will give priority to the active input with the highest number on a consecutive signal. This means, if for instance 3 players are present, input #1, #2 and #3 on the selector will light up; the selector however will give input #3 override until a fresh signal is received (i.e. a fourth player joins). Now all you need to do is wire the outputs of the selector to the respective actions you want to occur.
2011-03-02 15:57:00

Author:
Antikris
Posts: 1340


OOo, I likey the picture

I've always been a visual learner, so the picture helps a lot. Thanks!
2011-03-02 22:34:00

Author:
AdenRalumdan
Posts: 296


Yeah - thanks. I didn't know that about the selection process if multiple inputs are sending a simultaneous signal. Very good information. 2011-03-03 08:41:00

Author:
v0rtex
Posts: 1878


I have the faint idea that my selector setup will not take into account the event of one player leaving the level mid-game; for instance, 3 sensors are active, selector outputs 3, and then the signal of sensor #3 drops. It will not affect sensor #2 and #1 in any way, as far as I can tell. That will mean the selector receives no new positive signal from any sensor and will stay put on 3 players.

This is the limitation of my setup, I guess.
2011-03-03 10:04:00

Author:
Antikris
Posts: 1340


Good question =P2011-03-03 10:30:00

Author:
Onii55
Posts: 153


Here is excellent tutorial from comphermc about Player Counters:



http://www.youtube.com/watch?v=AoksqBRw4z8
2011-03-03 10:57:00

Author:
Domik12
Posts: 838


Here is excellent tutorial from comphermc about Player Counters:

Awesome tutorial! It does exactly what OP asks for and does not have the drawbacks of my suggestion. On top of that I learned about the practicality of adding/subtracting analogue signals and wirelessly transfer that signal (I didn't know that 'signal strength' could be used for this). That last bit is a very practical way to set up your detection logic and prevent wires all over your level.
2011-03-03 11:35: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.