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

Logic Help

Archive: 21 posts


Sorry for the vague title, but here goes:

Ok, let's say I have a game for 4 players. Every time you activate a certain thing, you get a point. Let's say there are 100 of these things, and each can only be activated once. I would like a way for it to recognise when one player is too far in front and cannot be caught. This needs to work if there are 2 players, 3, or 4.

Example:

Player 1 score is 51
Player 2 score is 0 (obviously a bit rubbish at this game )

49 points available, but player 2 can't catch up, so player 1 wins.

Any ideas?
2012-02-02 19:17:00

Author:
Ali_Star
Posts: 4085


Well your going to need to use sackbots, and each sackbot will need it's own unique tag.

P1 = Blue
P2 = Red
P3 = Green
P4 = Yellow

for example.

Each tag sensor is linked to counters, and one of the counters is set to 51. The counters go up one per point given and when 51 points is given, the 51th counter is activated and ending the game. This can be done individually with each bot to end with a different title..

Example:

Player 1 gets 51 --> links to ---> Player 1 wins
etc.. for all players..

Hope this helps!

RC
2012-02-02 19:27:00

Author:
Unknown User


It can't actually be that simple can it??

Because, what you're atually looking at is the difference between the scores.

Say there are 4 players, the scores are as follows:

P1: 30
P2: 24
P3: 19
P4: 8

So that's a total of 81. For arguments sake, let's say the number of points on the board is 86 (in reality, it's over a 100). With 5 points remaining on the board, player 1 wins in this case with 30 points. But I can't just make 30 points the amount a player needs to win. Because player 1 and 2 can each score 30 points, with 26 left on board..... there's still points to play for.

Can you see what I'm getting at?
2012-02-02 19:44:00

Author:
Ali_Star
Posts: 4085


Ah, i see your problem.

Only way i can think of would be using some very complicated math logic, involving lots of AND gates which counts each point given, to which player and subtracts that from the remaining point count, and ends the game when a player crosses the limit for scoring. Although it is do-able in this way, it's most likely very complicated and most likely unreliable, so perhaps look at it from another angle?

Perhaps each player who collects a point subtracts a point from a counter set to 100, and each point taken subtracts 1. This could then be used as a remaining counter to work along side the rising count from points per player.

Not something i can specificlly help you with so best of luck
2012-02-02 20:06:00

Author:
Unknown User


I think I have the additional problem in that my score count is over 100 (the limit to the counters). I imagine this could cause some bother?

When I first thought of the idea, in my head I had each player's scores activating 2 counters. One that increases from 0, and one that decreases from the max amount. Each of those would be connected to a seperate counter.

SOMEBODY out there most have had something like this in place? It's quite a simple idea, even with the logic being quite advanced.
2012-02-02 20:15:00

Author:
Ali_Star
Posts: 4085


I think this could be done through subtraction.

If the sum of a player's score minus the remaining points is larger than all other player scores then they cannot be beaten. The remaining points is equal to the total number of points minus the score attained by all players.

Couple of examples:

a) If total points equal 100

P1: 20
P2: 15
P3: 36
P4: 15

100-20-15-36-15 = 14

36-14 = 22, P3 cannot be beaten.

b) If total points equal 65535

P1: 10014
P2: 28587
P3: 8903

65535-10014-28587-8903 = 18031

28587-18031 = 11556, P2 cannot be beaten.
2012-02-02 21:45:00

Author:
Ayneh
Posts: 2454


Looks good. Will have to give it a test tonight. Probably have to look at a couple of addition/subtraction tutorials first.... I know comphermc and ScorpSkull have done one.

For some reason, I've been thinking that I had to use counters for the player scores.... completely forgetting about the existance of score sensors, which I don't think I've used before. I CAN use them in this place, can't I? Because how else am I gonna get it to recognise a score of 10014?
2012-02-03 09:44:00

Author:
Ali_Star
Posts: 4085


Use feedback loops addition and subtraction. Play with fractions of percentages to get past the '100' limit.2012-02-03 19:22:00

Author:
Antikris
Posts: 1340


Arg, someone talked about feedback loops before me ! Comphermc's lbplanetorials will help you with these too. It involves using signals smaller than 1%. Make them with speed sensors, it's more accurate than timers. By the way, in LBP 1+1+1+1+1 is not exactly 5. Don't ask me why, but even batteries aren't perfect forever, so don't use signals of 0.000001% or try to compare signals with sequencers.2012-02-04 04:09:00

Author:
Unknown User


All this sounds too complicated for my simple mind. I'll look into it though. If I can't get it working, then I can at least put it in when there's only two players, because in that case the score is set, eg if there's 100 points, and 1 player reached 51, then he/she can't be caught. Simples.

Out of interest, can you get score sensors to recognise certain players scores? Because I can't see a setting on there to allow it, unless I'm just missing it?
2012-02-04 17:52:00

Author:
Ali_Star
Posts: 4085


Ok, another related question.

Is there a way simply to detect who has the highest score at the end? At the end of the game, I'd like it to go to a screen that says "Player _ Wins!".
2012-02-12 14:58:00

Author:
Ali_Star
Posts: 4085


If you want to invite me, I have a system that links two timers together into one, I think we can modify it to work with counters.

We could use subtraction along with the counters, and tags to tell what is left, then compare to see if it is greater.
2012-02-12 17:52:00

Author:
fly_4_a_jedi
Posts: 151


If you want to invite me, I have a system that links two timers together into one, I think we can modify it to work with counters.

We could use subtraction along with the counters, and tags to tell what is left, then compare to see if it is greater.

Unfortunately, this is quite low on my list of priorities now. After getting a friend to test my level over the network, the logic is just completely failing in every sense of the word, because of the large amounts of it. If I can't find a way to fix it, then that pretty much means I've wasted the past month and a half.
2012-02-13 09:20:00

Author:
Ali_Star
Posts: 4085


Sorry to hear that... If you use less materials(if possible just use material changer), or if you have micro chips inside of microchips just put all of the logic on the first chip(it will be hard to move and place new logic because of lag, but things do run smoother). Those both worked when I had a similar problem.

Also, if you have multiple stages, then it helps if you just emit one stage at a time. I don't know if these will help much for you, but it solved most of the problems on one of my old levels.
2012-02-13 13:00:00

Author:
fly_4_a_jedi
Posts: 151


Sorry to hear that... If you use less materials(if possible just use material changer), or if you have micro chips inside of microchips just put all of the logic on the first chip(it will be hard to move and place new logic because of lag, but things do run smoother). Those both worked when I had a similar problem.

Also, if you have multiple stages, then it helps if you just emit one stage at a time. I don't know if these will help much for you, but it solved most of the problems on one of my old levels.

I'm currently looking at a few methods of reducing logic. I didn't actually know that having a microchip within a microchip (in my case, there's actually a MC, within a MC, within a MC, within a MC in some parts -- CHIPCEPTION!!) creates lag.

How many materials would you say is too much? I think I have about 7 or 8.
2012-02-13 13:51:00

Author:
Ali_Star
Posts: 4085


The microchip was my problem, but I had that about 8 times. I would just sticker the sections of the main chip, and place logic by color. I have not seen this in any post, but I went from having one copy of the logic without lag, then I had 4 running smoothly, but like I said placing the logic is laggy.

After moving the logic if it still lags, then reduce material amounts. If any two materials look similar, then I would pick one.
2012-02-13 13:57:00

Author:
fly_4_a_jedi
Posts: 151


I've been messing around with my logic a bit. I've done 2 things. The first I've detailed in the "Complicated Logic Schtuff" thread. The 2nd, is that I've done away with CHIPCEPTION. Only tested it in a small section, but I'm already noticing improvements with the thermo... so there may still be hope for me yet.

Thanks for your help.
2012-02-14 10:00:00

Author:
Ali_Star
Posts: 4085


No problem, I like posting that on post with thermo problems, because I have never seen it posted.2012-02-14 14:02:00

Author:
fly_4_a_jedi
Posts: 151


Didn't want to create a new thread, so:

Regarding tags - now that I've reworked my logic a little bit, I'm realising that I can get rid of some of the tags and replace them with wired connections. Now, since I've been experiencing problems with my tags due to a bit of logic lag, will having a bunch of wires everywhere improve this? I'm just wondering it will be detrimental to have about 10 more wires sending data across half the level?
2012-02-21 18:38:00

Author:
Ali_Star
Posts: 4085


If you have lag because of tags, try using 0.1 sec timers when triggering them instead of 1-frame signals. That usually fixes problems.2012-02-21 23:45:00

Author:
Unknown User


If you have lag because of tags, try using 0.1 sec timers when triggering them instead of 1-frame signals. That usually fixes problems.

Start count up, or start count down? I'm assuming count down, because the signal will stay on for slightly longer?
2012-02-22 09:16:00

Author:
Ali_Star
Posts: 4085


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.