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

Trying to make a pac man game, but having issues

Archive: 15 posts


Normally, logic is my strong suit, but need a little help here. I'm trying to make a pac-man type game (not a sacboy with jetpack wannabe) and I'm trying to create the logic for pac man to move smoothly through a maze. I've tried a number of ideas, including tags at each intersection indicating which directions you can move, invis holo barriers, similar to scroller levels (this one works the best so far, but there's still far too much wiggle room). I am using grid/angle snap to get everything to fit just right. I just can't seem to get a system for pacman to run smoothly. Preferably, I'd like a system where I can quickly create new mazes and not have to re-engineer the entire level in the process. Any ideas?2012-03-20 19:12:00

Author:
Brannayen
Posts: 438


Only thing that comes to mind is having separate tags on invisible holo labeled for the direction they are. Like Top, Bottom, Left, and Right. If it touches one of those tags AND is moving in the direction of it, then it will stop.

Use a selector with the different directions (Either from the stick or the buttons) running into it. All 4. Not just 2. Use a directional splitter for that.

From memory, that's all I can help with right now. I'm not sure if it will work. And it seems like you already tried it.


I've tried a number of ideas, including tags at each intersection indicating which directions you can move, invis holo barriers, similar to scroller levels (this one works the best so far, but there's still far too much wiggle room).

Lets hope one of the logic masters sees this... They'll know what to do...
2012-03-21 01:20:00

Author:
Speedynutty68
Posts: 1614


How about bolting a cross-shaped collection of invisible holo objects to the pac man (keep it straight using a gyroscope) that - by using impact sensors - detects whether the southern part impacts with a wall, eastern part, etcetera? Based on the impact data of four directions, logic can decide to allow a player to change the pac man's direction when a gap in a wall is being passed by. You would not have to use physical collision on the pac man object itself and allow yourself to make a slightly smaller orb than the width of the corridors preventing it getting stuck, slowing down, etcetera.

http://i.imgur.com/LXbJe.jpg
2012-03-21 10:31:00

Author:
Antikris
Posts: 1340


Thanks for the suggestions; I got it working great last night, not long after posting, actually. What I ended up doing is making a rail system, with friction set to 0. Also, I have a microchip at every possible intersection to indicate possible directions. It will be easy to hide it, and with this system, I can quickly make different mazes.2012-03-21 22:52:00

Author:
Brannayen
Posts: 438


That's basically exactly what I needed help with on my level, but I didn't know exactly how to explain it in a Help thread!

If 'ya don't mind, I think I'm gonna modify that a little bit and turn it into one of those ice puzzles from Pokemon.

I don't know why I wasn't able to think of any solutions... I'm not really the best logic dude, and I had spent so much time making, remaking, and fixing up my other puzzle.
2012-03-21 23:22:00

Author:
KlawwTheClown
Posts: 1106


If you want, join me online sometime if you want to see exactly what I did.2012-03-21 23:48:00

Author:
Brannayen
Posts: 438


I made one once long ago, and it was terrible. I placed tags on every intersection telling which way you could move from there, and I made it so the direction change only works when there's a tag. Now since pacman was holo, it wasn't perfect so theres a follower to make me come back to the last corner if I hit a wall. It is barely visible. The only bad part with it is that you can't change direction in the middle of a line, you must wait for pacman to reach the next cross. It was great for a first LBP2 level though ^^ I think it's still on my planet. But yeah, using physical stuff is probably the simplest way.2012-03-22 00:06:00

Author:
Unknown User


Wait... So I actually got something correct after 4 months? Wow. I'm surprised.

https://encrypted-tbn3.google.com/images?q=tbn:ANd9GcTc67JXT1aSV2kk4Q7bHZadvHIng0V_R o5Q1RZMtEevbwHntdTBaA
2012-03-22 00:14:00

Author:
Speedynutty68
Posts: 1614


Well, I've hit a wall again, this time it's for the AI for the ghosts.
1) When a ghost arrives at an intersection, 1 or more AND gates are activated, depending on possible directions it could travel. Currently, they are prevented from reversing direction unless they arrive at a dead end (yes, it my game it might happen). I trying to figure out the logic to randomly select from the AND gates that are activated to a single selection on a selector switch. In many cases, such as a corner, there's only one way for it to go, but for a 3 or 4 way intersection, there might be 2 or 3 ways for it to go.

2) I have tag sensors on the ghost to tell it in which direction the player is...I want these tag sensors to affect, to a degree, which way the ghost goes. Obviously, it can't be a constant or the player would be cornered very quickly. I need to be able to increase the frequency that these tags affect the decision as the level progresses.

One idea I had, which I've never used before, is analog signals. Maybe have the AND gates, as well as the aforementioned tag sensors, contribute to a set of analog signals. Then, whichever signal is strongest, is the one selected. It'd be nice if they had a randomizer with multiple inputs, that when activated, it randomly selected an output, choosing from the inputs only.

The other idea I had, which I'm trying to avoid, it to have a separate set of logic for every possible combination of AND gates.
2012-03-22 11:41:00

Author:
Brannayen
Posts: 438


Well, I've hit a wall again, this time it's for the AI for the ghosts.

Oh man, you had to bring that up, didn't you?

https://lbpcentral.lbp-hub.com/index.php?t=48020-Follower-logic-in-a-maze-environment
2012-03-22 18:18:00

Author:
Antikris
Posts: 1340


Make a holo-cicle and bolt it to the ghost, then place a look-at rotator on it, set to look at pacman. Place 4 tags on the ghost - not on the circle you bolted.

/?K?
(K B K)
_R_/
Here, K is tag, B is bolt, R is rotator on the circle over a tag on the ghost. On the ghost, place a chip. Make a tag sensor set to pacman and give it the same radius there is on the rotator - how far can the ghost see through walls. When this signal is on, it will make the selection work, else it will move randomly.

Now you need to place a chip on the holo circle, the X on the picture.

/?X?
( )
___/

Then you must place 4 sensors set to the 4 tags placed on the ghost. These will be set to proximity (default). The OR gate outputs the biggest signal you give it. You can use it to tell which tag is the closest to the sensors. Use a 4-input OR gate for the sensors. Now in order to know which signal is the biggest signal, compare each signal with the OR gate's output.
If signal A is equal to biggest signal, signal A is the biggest signal. That's obvious. Now how to compare those ? Use a combiner. If both signals are the same, then the result will be 0. Wire the output of this combiner in a sequencer set to position with a battery on the whole lenght. This means the battery will be on as long is the signal isn't 0. Wire the battery in a not gate. Copy this combiner-sequencer-NOT system 4 times, once per tag sensor. Now you know which tag is the closest, you can use this to tell the ghost to go in a certain way...

That's a starting idea.
2012-03-25 22:23:00

Author:
Unknown User


Thanks for the help, everyone. I now have the logic all worked out for the ghosts. They even have 4 different levels of how much they follow the player. I'm trying to decide what kind of special power ups I want to include, besides the power dots in the corners. I'll post some pics when I get a chance.2012-03-26 00:38:00

Author:
Brannayen
Posts: 438


Nice! I got tired before powerups, so in mine there was no way to kill the ghosts ^^
I would make a fruit/star show up every time you eat X pellets. Then when you eat it it makes you turn anoher color randomly, each color for a powerup. You could give a shield which allows you to pass through one ghosr. Or a gun, if you prefer. You could also make a speed boost, or the craziest, a second pacman controlled with right stick
2012-03-26 04:23:00

Author:
Unknown User


http://id.lbp.me/img/ft/66d7aa9b6b21b12375e88486f20e273c0d71c54c.jpg
This is the logic for my Pac Man so far.

http://i0.lbp.me/img/ft/560a2891facfab61a5d1da6a6e6d3065371e4f37.jpg
This is the logic for my ghost so far.

There will be more added, but this shows what I've had to go through just to get the basics to work.
2012-03-27 01:51:00

Author:
Brannayen
Posts: 438


Ghost A.I. taking up way more than Pac Man logic, eh? Nothing new here. 2012-03-27 07:22: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.