Home LittleBigPlanet 2 - 3 - Vita - Karting LittleBigPlanet 2 [LBP2] Help!
#1
Follower logic in a maze environment?
Archive: 28 posts
My son is trying to make a pac man level, recreating it pixel for pixel old school style. He's not particularly experienced and he's still learning how to use the tools, so I've been giving him guidance. However, he's hit a problem which I'm not sure how to solve for him. Basically the ghosts are supposed to converge on pac man wherever he moves, but with follower logic they will always try to take the most direct route rather than follow the lines of the maze. This means that more often than not they will try to move straight through a wall rather than follow the path around it. So, he needs a logic system that will allow the ghosts to home in on pac man while also following the path of the maze, and I'm all out of ideas. Any help? | 2011-02-06 13:04:00 Author: Ungreth Posts: 2130 |
So, he needs a logic system that will allow the ghosts to home in on pac man while also following the path of the maze, and I'm all out of ideas. You're probably looking at quite a complicated system of logic to do something like this - good pathfinding algorithms are non-trivial to implement. You could probably get away with a fairly simple one whereby you place tags at each junction point in the maze, have the monsters travel between these tags, and when it hits one, it decides which path to take based on which would best lead it to pacman using, say, a Look At Rotator to point to pacman, and choose the path closest to that angle. It's still quite a challenging bit of logic, however. | 2011-02-06 13:38:00 Author: Aya042 Posts: 2870 |
Hm.... Yeah, you will need something relatively complex. How 'bout Pac Man lays tags down whenever he moves, and the enemies move the the tag nearest to them, then it dissolves when they get there, then the move to the next tag in the 2 grid squares next to it? I dunno, I'm trying to suggest something simpler than complex and the enemies have to get onto Pacman's trail in the first place.... Thinking...... Edit: Thought about! Pacman starts from the same place as the enemies, but with like a 5 second head start. When you find one tag, the enemies could have a logic system which makes it search for the next tag. For example: Blue tag = Left Green tag = Right Yellow tag = Up Red Tag = Down If Pacman moves left and down, then the tags he lay down will be Blue then Red. When the enemies reach a tag, they search for a nearby tag and if they find a red one they'll move down. Or simpler, as soon as the enemies leave, the follow the tags and the tags are laid in order. So 5 squares left, 6 up. B = Blue/Left Y = Yellow/Up X = Start P = Pacman It'd go, P Y Y Y Y Y YBBBBBX This'd be REALLY simple with movers. I'd even make you a system pretty easily. Or if you understand what I mean, you could make it for your son. | 2011-02-06 13:46:00 Author: mutant_red_peas Posts: 516 |
You could probably get away with a fairly simple one whereby you place tags at each junction point in the maze, have the monsters travel between these tags, and when it hits one, it decides which path to take based on which would best lead it to pacman using, say, a Look At Rotator to point to pacman, and choose the path closest to that angle. This sounds like the best solution for a simplified version. You're likely to hit issues with monsters getting stuck in little cycles from time to time, but this problem should be less significant when the target point (pacman) is always moving. My best thought on a solution would be to have a notion of path distance to pacman being propagated around the maze, but this again is a non-trivial and would effectively be a realtime-updating implementation of Dijkstra's algorithm, with there being nodes at each junction point and pacman and (possibly) monsters being dynamic nodes. At each node you would be able to know which direction gives you the shortest path to pacman, even if it's not in the direction of him. Essentially there would be tags on the map that would "point" the direction the monsters should be going, if they are at that point - the entire map carries out the intelligence for the monsters. | 2011-02-06 13:52:00 Author: rtm223 Posts: 6497 |
My best thought on a solution would be to have a notion of path distance to pacman being propagated around the maze... I wonder, though, given even a simple pathfinding algorithm, whether this basically gives you the ability to 'herd' the ghosts in such a way as to make it impossible for them to ever catch you. Through strategic movements, you can get it such that the ghosts will end up all very close to each other following pacman around, but always one step behind. Reading this webpage (http://home.comcast.net/~jpittman2/pacman/pacmandossier.html), it sounds as if they gave a unique algorithm to each ghost in order to prevent this... Ghosts have three mutually-exclusive modes of behavior they can be in during play: chase, scatter, and frightened. Each mode has a different objective/goal to be carried out: CHASE?A ghost's objective in chase mode is to find and capture Pac-Man by hunting him down through the maze. Each ghost exhibits unique behavior when chasing Pac-Man, giving them their different personalities: Blinky (red) is very aggressive and hard to shake once he gets behind you, Pinky (pink) tends to get in front of you and cut you off, Inky (light blue) is the least predictable of the bunch, and Clyde (orange) seems to do his own thing and stay out of the way. SCATTER?In scatter mode, the ghosts give up the chase for a few seconds and head for their respective home corners. It is a welcome but brief rest?soon enough, they will revert to chase mode and be after Pac-Man again. FRIGHTENED?Ghosts enter frightened mode whenever Pac-Man eats one of the four energizers located in the far corners of the maze. During the early levels, the ghosts will all turn dark blue (meaning they are vulnerable) and aimlessly wander the maze for a few seconds. They will flash moments before returning to their previous mode of behavior. | 2011-02-06 14:25:00 Author: Aya042 Posts: 2870 |
Ah, interesting, Aya.... Maybe you could have a selector which changes a ghost's behaviour? And the logic behind it all is merged into one piece of invisible holo behind the maze and the logics on each piece only turn on when the correct selector output is activated. ??? There's probably gonna be many more solutions.... | 2011-02-06 14:30:00 Author: mutant_red_peas Posts: 516 |
I wonder, though, given even a simple pathfinding algorithm, whether this basically gives you the ability to 'herd' the ghosts in such a way as to make it impossible for them to ever catch you. Through strategic movements, you can get it such that the ghosts will end up all very close to each other following pacman around, but always one step behind. Of course, this is a standard issue with such a sense-react system and is always going to be the kind of thing that occurs in video games - most games from even the last gen had AI that was flawwed in such a way. I can still remember how to force most of the enemies in Quake 2 in to stupid and easily beatable behaviours Adding in a random scattering / roam / return home sequence helps, as does adding randomisation when the preferable option isn't clearly defined - or even just in general having a 1/3 chance the monster will take the second best route at any given point in time. These sorts of things are classic solutions for breaking simple AI systems out of loops that would prevent them from converging on a solution. I do remember reading elsewhere how the monsters had different characteristics. Characterising this in LBP is not simple either. Varying the weight of their picking the "wrong" path is one way, also determining how close the shotest path must be before they start to chase is another, how often they break and roam... etc. | 2011-02-06 14:46:00 Author: rtm223 Posts: 6497 |
Would now not be a good time to remind you guys that Pinky, Inky, Blinky and Clyde all had different movement patterns | 2011-02-06 14:54:00 Author: Asbestos101 Posts: 1114 |
I do remember reading elsewhere how the monsters had different characteristics. Reading further down the page, it pretty much explains exactly how the algoritms work for each ghost - they're apparently entirely deterministic (never random), and learning their behaviour has allowed people to reach the infamous level 256, which looks like this... http://home.comcast.net/~jpittman2/pacman/Level%20256%20Hidden%20Dots.png ...thanks to an oversight on behalf of the developers assuming you'd never be able to get that far. | 2011-02-06 14:54:00 Author: Aya042 Posts: 2870 |
You could probably get away with a fairly simple one whereby you place tags at each junction point in the maze, have the monsters travel between these tags, and when it hits one, it decides which path to take based on which would best lead it to pacman using, say, a Look At Rotator to point to pacman, and choose the path closest to that angle. There are still lots of places in the maze where this could work against the ghost, however: anywhere there's an inside corner, a ghost could wind up going back and forth into that corner trying to get closer to pac man... A basic pathfinding algorithm works like this: from the source, you extend out to all neighboring points, keeping track of the minimum total distance it takes to get there. You continue doing this from each point until you reach your destination. (This is basically what rtm223 suggested, but here's a way to implement it...) Now, implementing any kind of iterative algorithm in LBP (even with the logic gates in LBP2) is going to be difficult - but remember that you actually don't have to. Consider: 1: the path-finding algorithm is basically symmetrical. You can start from the origin point and work toward the destination, or from the destination and work toward the origin point. 2: If you start from the destination (Pac Man) and work toward the ghosts, you only have to do the work once. 3: LBP itself can do various types of "iteration" for you, as this is the nature of its physics engine and its digital logic simulation engine... 4: The ghost itself doesn't need to navigate the maze - it's easier (as rtm223 suggested) if the maze keeps track of pac-man and tells the ghosts where to go. So imagine that every junction in your Pac-Man maze has a light on it. All the lights are wired together such that when a light is on, all of its neighbors will also light up, but not as intense. And anywhere Pac-Man travels, the lights at the junction he just passed and the one he's traveling toward light up at full illumination. Then, far away at the opposite corner of the maze, there will be lights lit rather dimly - but (probably) lit all the same. A ghost can therefore find an optimal path toward Pac-Man by always travelling toward the brightest neighboring light. To implement this (in LBP2) - each node needs to be set up with sensors to find Pac Man (tag sensors presumably, since player sensors may not be applicable.) The sensors extend most of the way to the next junction in that direction. These sensors trigger the "full intensity" state on that node (activating a tag at full intensity) For each neighbor a node has, the node will have a tag sensor pointed at that neighbor: the sensor will yield an analog signal indicating the signal intensity of that neighbor node, decrease the value slightly (via directional combiner? I'm not sure... Or maybe you can just change the output value at the tag itself - I'm not sure...) and then feed another tag with that value. Each sensor will (I believe) detect just the strongest tag from each neighbor, so even though each node has up to five tags (four directions plus the "pac man is here" tag) each sensor will (I believe) pick out just the strongest signal. Now, as Pac-Man moves through the maze, the one or two nodes marked as Pac-Man's location will be continuously updated - and the mesh of junction nodes will also update to keep track of the best route to Pac-Man. In effect, the LBP game engine is performing the whole path-finding algorithm on your behalf, and you just need to program the ghosts to follow the best signal. There are some unknowns here - I'm pretty sure my understanding of tag sensors is correct but I haven't tested this. You could do the whole thing with a more LBP1-type approach as well - directly wiring each node to its neighbors, using pistons carrying magnets and a single magnet sensor to calculate the "intensity" value for each node... But any time you resort to mechanical approaches it's bound to take more thermo... If the magnet sensor approach really wasn't going to work out, you could create digital adders and comparators, and propagate the signal around digitally - say, a six-bit value for "Pac man is here" and then subtract one for each junction the signal crosses, and use the comparator at each junction to choose the strongest signal. This is harder obviously, but it gets you away from the potential ambiguities in how LBP's built-in systems are going to apply to the task of propagating and degrading an analog signal. If you really wanted to implement all of the ghosts' various behaviors you could use the following approach: Blinky's "Aggressive chase" simply always follows the best path to Pac-Man - possibly following a trail of "bread crumbs" left behind by Pac Man as well Pinky's "Cut him off" approach would need to more heavily weight the node Pac Man is approaching rather than the one he just visited. This could be done by creating a second copy of the path-finding logic which deactivates the "full on" for any node on the "trail of bread crumbs". Therefore the node he's approaching would be the only one "full on" and the one he just passed would have a less-intense signal. Inky's "unpredictable" behavior can be achieved by putting more of a random element into his decisions. Maybe this means you do a weighted-random selection of neighbor nodes based on their signal strength (not sure how you'd do that short of a mechanical approach) - or maybe you just pick directions randomly a certain amount of the time. Clyde's chase behavior seems like it may be something else altogether... "Scatter" behavior can be done by assigning each node a weight according to how close it is (navigation-wise) to a particular corner. This can be done statically, since the maze doesn't change... In "scatter" mode the ghost would navigate to its respective corner. "Frightened" mode could be done as the opposite of "chase" mode but with a greater random element mixed in. (EDIT): Actually, it seems that you can use an OR gate on multiple analog signals to pick out the one with the greatest intensity (http://www.lbpcentral.com/forums/entry.php?2069-Analogue-Logic-1-Fundamentals) - so each node could have just one tag... Though now that I think about it, there's a couple other details I missed. First, I described the nodes as providing just intensity information, with the ghosts themselves checking the signal strength in each direction to choose how to proceed - of course that's no good as the ghost could detect a node that's on the other side of a wall. So that logic needs to be wrapped into the maze node itself. Second, suppose the "north" direction has strength 0.6 while all the others have lesser values - the OR gate will get you that value (0.6) but then how is that translated into a direction? (I guess you could use direction combiners and splitters as comparators: if "north" is 0.6 and "south" is 0.3, you combine the two (with south as negative) to get 0.3 (positive) then split it again to take the sign and you find out north is better than south... Set up 3 + 2 + 1 comparators with the right logic gates on the outputs and you should be able to find the direction of the strongest signal and rule out the other choices... Unless there's a tie, in which case the ghost may wind up not moving at all... I guess if you make sure each of the four outputs is "is this direction better than or equal to all others?" as opposed to "is this direction better than all others?" then you could ensure that you'd at least know what your best choices are... | 2011-02-07 18:53:00 Author: tetsujin Posts: 187 |
There are still lots of places in the maze where this could work against the ghost, however: anywhere there's an inside corner, a ghost could wind up going back and forth into that corner trying to get closer to pac man... (cut down to save reading) ...that you'd at least know what your best choices are... That made my thingy about tags being laid down look like pretty much nothing. I like it in the shadows.... | 2011-02-07 20:26:00 Author: mutant_red_peas Posts: 516 |
RTM, Tetsujin. everytime i read your stuff i'm awed. You guys are just on another level alltogether... | 2011-02-07 22:02:00 Author: Epicurean Dreamer Posts: 224 |
I had some ideas. But really difficult to explain in text. So I wil ltry just some basic hints. mark each junction wit hmicrochip with tags. One tags color each of them (jsut to recognize "ah here is junction") and then four others to tell your ghost the free directions (like green and red will mean he can go up and right, etc) use one tag on the pacman. For movement use 4 way selector - otputs connected to the 4 movers - each moving with one exact diretion. This way the ghost will move only straight. And not diagonally. And will move constantly. by sendit a signal you will just change the direction. Now when you will detect you are at the junction (by the very near tag) do: 1 - move quickly to the tag (follwower/ max speed, max acceleration, max strenght etc). But also start some short timer (0.1sec) and have it conncted that this movement wil lbe done only for this short time. This way you will "center" the ghost on each junctino. Just to avoid they will get your to the way milimetr by milimetr over time. Then have the four tag senzor to check the free direction. And also use four pacman tags senzors - each with 180 degree, big radius and each rotated by 90 degree. So these will tell you if the pacman is left fomr you, Down from you etc. Then connect these four and four senzors by endgates and connect to the selector. So it will be like: If red tag is realy near (= I can go up) and the pacman senzor is showng is up above me - then the signal will change my direction to move up. of course you can extend it with more logic - that if none of these four condition will be true (might happen), it will select the direction by random. And also in case the junction will have just two directional tags you might consider checking it with active selector output and determine new direction by that - so the ghost will always turn. And not go back. All of this shoud be basically easy - just a lots a lots of AND/OR/NOT gates for many combinations of the inputs. Hope this was little bit usefull. | 2011-02-07 23:00:00 Author: Agarwel Posts: 207 |
It'd be rubbish but the way I'd do it is use a follower for each of the ghosts and make them bounce off the walls of the maze. They should be able to work their way around. For other behaviours like them running away the followers could just be set to follow tags in each of the four corners or something. | 2011-02-07 23:26:00 Author: Ayneh Posts: 2454 |
Argawel's idea might work. The movers make it so they can only move along 4 axis, horizontal and vertical. Maybe combining that with my tag idea so when the ghosts latch onto Pac-man's trail the follow it to where you are. ? | 2011-02-08 06:46:00 Author: mutant_red_peas Posts: 516 |
Argawel's idea is particularly prone (I think), to getting the ghosts stuck in corners or tight cycles. Tetsujin: I'd go as far as creating an entire analogue system for path distances so that the value at each node is truly the actual distance required to be traveled to reach pacman (as opposed to the more topographical concept of number of nodes to be passed). Basically just take the distance to the neighbouring node (using closeness) and the distance from the neighbouring node to the target (by detecting signal strength) and Add them together to give distance to the target down each path. Take the min of all of these will give your distance. One thing that is really interesting about such a solution is that all tags would initialise @ a value of 0, but then quickly converge to 100% (consider this infinite distance), without the presence of a target. This would be achieved by neighbouring nodes acting as positive feedback loops with each other - driving each other up to infinity in a very short space of time, which will neatly reset your distance finding algorithm ready for respawn. In terms of which is direction is "best", I would probably go for Go in direction1 IF d1 < min( d2, d3, d4) Go in direction2 IF d2 < min( d1, d3, d4) Go in direction3 IF d1 < min( d1, d2, d4) Go in direction4 IF {all above are false} Where di is the distance if you go in directioni This decision making can actually be done by the ghosts themselves, rather than by the nodes, which makes it easier to implement the variable personalities (though you do probably need some kind of extra system in the map to attempt blocking). | 2011-02-08 13:52:00 Author: rtm223 Posts: 6497 |
In terms of which is direction is "best", I would probably go for Go in direction1 IF d1 < min( d2, d3, d4) Go in direction2 IF d2 < min( d1, d3, d4) Go in direction3 IF d1 < min( d1, d2, d4) Go in direction4 IF {all above are false} Where di is the distance if you go in directioni Four analog inputs to an OR gate and the strongest one gets through, right? | 2011-02-08 14:07:00 Author: Antikris Posts: 1340 |
Not exactly, because you have to know which one gets through. The OR gate will simple give you a value of the strongest one. Also you actually need the minimum as the values represent distance, so an AND gate will give you the value of distance to propagate around the network. To illustrate, assume I have the following four values: up: 10 down: 33 left: 27 right: 9 A 4-way min function will return 9, which is the minimum distance, but 9 doesn't tell me which way to go. Hence the need for comparisons. The winning decision would be a signal that indicates "go right". You could probably take the max of all four and then do equality comparisons, which would actually drop your complexity down significantly. However, equality would require that absolutely no error is introduced in the OR operation (which is a reasonable assumption, but not one that I'm sure of). Also, you'd need to implement a tiebreak system no matter what you did - doesn't really matter what the effect of said tiebreak was, but you need one. Even if it's just an XOR between the 4 decision outputs that defers any decision until a unique decision is reached. | 2011-02-08 14:27:00 Author: rtm223 Posts: 6497 |
Yeah, they all have different behaviours. Blinky (red) is smartest, he'll chase you around. Pinky (pink, duh) is fastest. Inky (blue) is timid, and will sometimes flee from Pac-Man, and Clyde (stupid) is completly random and the slowest (because of this, me and my friends say you suck at Pac-Man if Clyde kills you). Another thing you may want to put in, have you got power pills? Also, it would be awesome if you got the Google Doodle (www.google.co.uk/pacman) in there too | 2011-02-08 17:18:00 Author: kirbyman62 Posts: 1893 |
One thing that is really interesting about such a solution is that all tags would initialise @ a value of 0, but then quickly converge to 100% (consider this infinite distance), without the presence of a target. This would be achieved by neighbouring nodes acting as positive feedback loops with each other - driving each other up to infinity in a very short space of time, which will neatly reset your distance finding algorithm ready for respawn. Well, it's a lot easier to subtract positive values from each other (i.e. use a direction combiner) than it is to add positive values together (i.e. either use a sequencer set to positional with a bunch of batteries and a huge OR gate as an "adder" - or else create an A-to-D converter (in a huge sequencer) - a binary adder, and a D-to-A converter (probably by starting with a 100% battery and subtracting values for each unset bit)... So it really is a lot easier to use the node values as values of "closeness" rather than "distance" - start at 100% and decrease each time you cross a node. You could still do the distance thing (by adjusting how much you degrade signals coming from each direction at each node) - but, seriously, it's a Pac-Man maze. it's probably not worth the trouble. You know, after all this I really have an itch to actually implement the thing... | 2011-02-08 18:14:00 Author: tetsujin Posts: 187 |
Yeah it is slightly simpler to do subtraction on closeness actually. Though I suggest you may wish to check out the adders in my blog, they will save you a tonne of effort and be more accurate, compared with the systems you describe above. You'll see why I say slightly | 2011-02-08 19:20:00 Author: rtm223 Posts: 6497 |
Yeah it is slightly simpler to do subtraction on closeness actually. Though I suggest you may wish to check out the adders in my blog, they will save you a tonne of effort and be more accurate, compared with the systems you describe above. You'll see why I say slightly Dang, why don't I think of these things? Gotta say, though, it's been one of the exciting things about LBP2 - I look at what I've got to work with and feel like some critical piece is missing - and then it turns out somebody already figured out how to solve the problem... I'm loving the whole logic thing in general - it was amazing how people could come up with complicated bits of mechanical logic in the first game, but it's also exciting to be freed of the timing and space and thermo constraints that all that mechanical logic would impose... | 2011-02-08 20:11:00 Author: tetsujin Posts: 187 |
Argawel's idea is particularly prone (I think), to getting the ghosts stuck in corners or tight cycles. I probably did not explained it in every deatail. But I must protest. That Idea would not stuck them at all. When it would get to the juction it will always choose new direction. In this way: If there are only two ways out then use the other than bacwards (two way are from turn. And we only want ghost to turn to the free way. Not to turn bacwars) If there are 3 or 4 tags than: 1 - check if the pacman is up/down/left/righ and if the same way is free (by the tags on the juction). If yes - use that way. (we might also exclude turning backwards!) This would be pain for lots of AND logic. But shoul be matter of patience to cover to possible situations. Or maybe teher is some way to actualy optimalize it. 2 - if previous condition is not valid for any of the four directions - then use randomizer to choose ome of the free paths. This way - the ghost wil lalways choose some way. If way leading to the side where pacman is is free - it will choose that one. Otherise some random. | 2011-02-08 20:53:00 Author: Agarwel Posts: 207 |
I probably did not explained it in every deatail. But I must protest. That Idea would not stuck them at all. When it would get to the junction it will always choose new direction. In this way: If there are only two ways out then use the other than backwards (two way are from turn. And we only want ghost to turn to the free way. Not to turn backwards) It could work. Pac-Man mazes aren't really hard to navigate after all... Limiting how frequently a ghost will reverse direction could be enough to save the ghosts from getting stuck. More interesting info on the behaviors of the ghosts from the original game: (taken from here (http://www.mameworld.info/net/pacman/basics.html)...) Blinky: The most cunning and most dangerous: Fast and trying to corner you with direction changes. When he's after you run quick and run twisty through lots of corners to shake (as with all others, cornering successive turn is most likely to lose the ghost). It also seems that Blinky does get a burst of speed when only a few dots are left in the maze. It is at it's most dangerous then. It will also track you by your poistion in the maze, trying to get to where you are as quickly as possible. It will try to line up with you vertically first, then horizontally. Blinky owns and patrols the top right hand corner of the maze. Pinky: Fast but more predictable. Once he's on your tail he won't let go. But he'll stay on your your tail running after you, hardly trying any tricks. Pinkey will line up with you by always following the direction which you are moving in or facing. If Pac-Man and Pinky are heading toward each other, and there is a hallway just before he hits you, Pinky will turn into the hallway first and try to run in the same direction as Pac-Man. All this is explained by the fact that Pinky is hard coded into the program to read the movement of your joystick and follow it. Pinky owns and patrols the top left of the maze. Clyde: Slower and a lot less harmful. Usually if you can stay out of the way of the top two (Blinkey and Pinkey) you can get away from Clyde and Inky by running through the maze. Clyde doesn't seem to want to line up with you or actively chase you. He just wants to get into your general vicinity and then only eats you if you happen to run into him. Clyde owns and patrols the bottom left of the maze. Inky: The slowest and almost shy. Often when faced head to head he will turn and run away from you. Mostly he will only catch you if you happen to run into his pattern. Nevertheless it seems like it can adopt the characteristics of any of the others at any given time. All of a sudden shy Inky might try and outwit you like Blinky and you won't even know what hit you. Inky owns and patrols the bottom right of the maze. Based on that it sounds like the original ghosts used rules similar to what you describe - not really navigating the maze but trying to reach Pac Man in various ways (lining up vertically or horizontally, forging a path through the maze, watching what direction the player's going, etc...) - lots of heuristics rather than a strict navigation solution. | 2011-02-08 21:34:00 Author: tetsujin Posts: 187 |
Well it dpends if you really want it to be exact as the original. In my opinion the pacman is not the kind of a game, where you need exact complex pathfindig (But if you have any ideal I would love to hear them to use if I iwll ever create sequel to my RTS - http://lbp.me/v/xhg8ft - It might really be handy there.) But for pacman - I guess completelly random behaviour should be enough for 99.9% players (nobody will appreciate if you make same AI as he original. Nobody will probably even notice). And if you add just a basic logic - try to use the path leading to the pacman (even if not nearest path), than I guess it would really be enough. Full pathfinding in the complex maze is nice. But probably for other kind of games. I dont want to hurt anyboy - but in Pacman I consider it waste of time. | 2011-02-08 21:59:00 Author: Agarwel Posts: 207 |
Well it dpends if you really want it to be exact as the original. But for pacman - I guess completelly random behaviour should be enough for 99.9% players (nobody will appreciate if you make same AI as he original. Nobody will probably even notice). Well, the reason I cite the original behaviors is because the game's developers put some thought into the design of those monsters, and they work. That is, the result of those behaviors was an enjoyable game. People may not notice if the ghosts' behavior doesn't match the original - but they will notice if the ghosts' behavior fails to provide an enjoyable game play experience. Completely random behavior - that is, not ever weighted toward any particular goal, would just result in the ghosts wandering around... I think you're right that a relatively simple set of rules is adequate for getting the ghosts around the maze in a satisfactory way - (and that's basically how it was done originally) but that's not "completely random"... | 2011-02-08 22:19:00 Author: tetsujin Posts: 187 |
Ungreth, have you tried to produce some of the ideas we have come up with yet? I wanna play the Pac-man level! | 2011-02-09 07:54:00 Author: mutant_red_peas Posts: 516 |
I know this thread is a week old, but I just got around to reading it. I have a different sort of thought on this. You guys seem to be focusing on the shortest path to pac man, which was my thought at first too, but then I thought "why do the ghosts need tags, they already have pathways?" Since we know that walls will always be a set distance apart, and will always be either vertical or horizontal, I think there may be another option. What if we made a flat square out of holo that is slightly larger than the pathways. Then, using the small grid, we cut the center portion out of each side of the holo square, so we have a gap on the north, south, east, and west edges. Inside of these gaps paste a new piece of holo with an impact sensor that can feel if it is touching a wall. Now we have a holo square that we can place in, and it is aware of which pathways are open. We put a chip on there, and we add movers that allow us to select a direction of travel. Now for the interesting bit. On each corner of the square we have made, we place tag sensors set to track the tag on pac man. using the analogue values for closeness we can determine which of the sensors is closest to pac man. This is the optimum direction, but we can't go diagonally. So we also find the second closest sensor, and this tells us which side is closest to pac man. Now we can move that way. What happens if that direction is unavailable to us because of a wall? Well, then we use the third closest sensor in conjunction with the strongest to choose the second best path. If that is unavailable (eg a corner), we choose the third best path by using the direction between the second and fourth closest tags. In the case of a Third best path chosen scenario, the ghost would almost have to follow that path until it meets with a junction that opens up path option two, so it can avoid being stuck in corners. I know I haven't worked out the whole thing in detail, but the logic seems sound to me. So, would this potentially work? | 2011-02-16 08:54:00 Author: tdarb Posts: 689 |
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.