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

Always equally-distant moving pieces

Archive: 21 posts


So, I've started a gameplay engine project a little while ago, and I'm working right now on the stealth features, the guards' AI to be precise. I won't go into details right now; I plan to post it at the Ideas and Projects section when I have something more concrete and also explain my logic some time in the future, but right now I don't want to spoil anything, so I'll get straight to the point.

http://i49.tinypic.com/2vt1tnm.gif

This little schematic badly done with MS Paint shows five pieces of sticker panel (the picture above shows three situations with different distances between the squares); the blue one follows the guard, the red one follows the player when it enters the guard's line of sight and the black bars stay between the blue and the red squares, and all pieces must be equally distant from each other no matter what that distance is. If I want to implement the detection AI the way I plan, this little scheme with the panels is necessary, so thanks in advance for any help!
2012-10-12 04:25:00

Author:
MatrixEchidna
Posts: 66


are the black bars for impact or visable in any way during playmode or will they only be used to determine distances for your logic setup? (if they are logic only you can get those distances via logic only)
also will the guard and the player always be on the same level or will the black bars need to move around depending on what angle you are relative to the guard?
i understand not wanting to give much away but it can make it hard for people to help if you dont give us much to work with
2012-10-12 09:46:00

Author:
evret
Posts: 612


Well, I'll try to go into details without spoiling much.

The bars are just for logic, and therefore invisible. I honestly didn't think much through up/down movements and I planned to design stuff such a way that when the player stands in a different level from the guard, it'll either be easily detected or too far from the guard's field of vision to be found, but now that I think about it, using the same logic with the bars DOES give more freedom to the level design. Maybe changing from bars to smaller squares is a good idea... Sorry, I guess it's a bit hard without giving away much since only I know what I'm trying to do.

But anyways, the important thing is that the bars stay between the player and the guard and be equally distant from each other. If I turn them into squares, rotating (on their own axis&apos might be not a problem, but first I got to know how to move them accordingly in the first place, so that's why I created this thread.
2012-10-12 17:05:00

Author:
MatrixEchidna
Posts: 66


This is a concept I've tried to work on myself, but have not gotten a working solution yet. Without more info, we can't come up with a better solution, only to try to help with what he's asking for. I've gotten close to a working solution with 3 objects, but the one in the middle doesn't necessarily stay in the middle. It uses a unique tag on the two outer objects, and tag sensors connected to followers on the middle object. It kinda works; if either of the 2 outer objects move, the middle object will orient itself halfway in between. But it can't detect if it's actually in the middle, only equal distant from the 2 outer objects. Also, the speed and strength of the followers have to be low, or it just flies off and breaks, and has a floaty kind of motion when it does find the middle. If a solution is found, I would be very interested to find out how it works.2012-10-12 17:25:00

Author:
Brannayen
Posts: 438


I know how to do it if there is no chance of them being at different heights, it's just not an easy method to explain. I also know a way to get it to work with the different heights, but thats even harder to explain and less stable. i really believe a logic only solution (remove the bars completely and simulate the info they would be giving you) would be best based on the info you've given us however without knowing the info u require from the setup i wouldnt know where to begin.2012-10-12 17:41:00

Author:
evret
Posts: 612


If only "Positional" was an input option on pistons...2012-10-13 04:36:00

Author:
MatrixEchidna
Posts: 66


If only "Positional" was an input option on pistons...

it is on lbp vita
2012-10-13 05:46:00

Author:
evret
Posts: 612


I have a solution. Well a possible solution, that works for heights as well as lengths. It is a chip that can find the center of anything where the borders are marked by tags (so if you have 4 tags in a square shape, then it will find the center of said square). If you place the chip on each of the bars, give every piece of sticker panel its own individual tag, and have the chip find the center of the two tags adjacent to it, then the bars will always be the same distance...in theory.
The chip is too complex to explain on here and requires tweaking to work to your needs, but I think it might work.
2012-10-14 03:18:00

Author:
Kalawishis
Posts: 928


Seems like an interesting idea, but I'd rather avoid using tags on the panels if possible, since there'll be more guards... Then whatever senses the tags on the panels would just panic if the guards happened to get any close.

Well, I'm thinking on an alternative to this moving pieces stuff (I thought it would be easier, like I forgot about a gadget that would solve the problem or something), but if anybody thinks on a working way please share : )
2012-10-14 05:46:00

Author:
MatrixEchidna
Posts: 66


if you can share the info you need from the "black strips" i may be able to help2012-10-14 06:08:00

Author:
evret
Posts: 612


Since I've now posted the project this is intended to (https://lbpcentral.lbp-hub.com/index.php?t=74781-Recreating-the-Metal-Gear-Solid-gameplay), I guess it's okay to show what I wanted with this.
Basically, the sticker panels system was intended for the game to perceive if there's an obstacle in the line of sight between the guard and the player, on different layers. A way to simulate the guard's perspective as if it were 3D.

http://i46.tinypic.com/23ubst4.gif

The pieces are actually always in the middle layer, each bar glued to another piece in each thin layer. Each piece (except the ones following the sacks) rigged with impact sensors set to detect obstacles (with an appropriate tag).

http://i50.tinypic.com/14obtq1.gif

This is a top-down view of what I planned to do. Red = Player, Blue = Guard, Black = Bars, Brown = Obstacle and Grey lines = thin layers. In the third scheme, the colored bars are active bars, that detect (via impact sensor) the obstacles. Also, if the player and the guard are distant from only one layer, only the piece in the thin layer between the two in the middle bar would be active. Also, it wouldn't account for when player and guard are in the same layer; another, simpler, system would take care of that.

What I really need is a way to simulate perspective, and this was what I had in mind to simulate it...
2012-10-14 19:13:00

Author:
MatrixEchidna
Posts: 66


So basically, you want the guard to see Snake unless there's an obstacle in the way or Snake is too far away?

In your project thread you mentioned that you're planning a full HUD. Is this going to include a top-down map?
2012-10-14 22:58:00

Author:
Chicago51
Posts: 258


Well, a map isn't really on my plans, since I always thought MGS was more thrilling when you couldn't count on a map... Of course, I'll try and not be unfair with the level design.

And well, the thing is, the guard sees the sackperson when it's on range and there's no obstacles, but taking the direction he's looking at account too.
2012-10-15 00:20:00

Author:
MatrixEchidna
Posts: 66


Hey, I have a working version of this. You can join me in lbp just to confirm that it is in-fact what you're asking for.

Basically you can have two objects with a holographic strip which will always sit at an equal distance from each object, regardless of whether the two objects are at different heights. At the moment it is only one strip between the two objects, but you can add more strips which sit at equal distance between the first strip and one of the objects, it's just a matter of changing some tag sensors.

It works by using the polar co-ordinates (radius and angle) of the player relative to the guard with a local space advanced mover. I can write up a tutorial if you like but I think showing you in-game would be much easier.

EDIT:

I ended up making a tutorial about the basics for this kind of logic, however the tutorial only deals with two objects that are level with each other.

https://lbpcentral.lbp-hub.com/index.php?t=74798-Equally-Spaced-Objects
2012-10-15 04:56:00

Author:
Seku
Posts: 65


I got it working perfectly with elastic and anti-gravity tweaker with partial dampening.2012-10-15 13:24:00

Author:
Brannayen
Posts: 438


Just throwing a crazy idea out here... wouldn't elastic make the object balance out at equal distances?

Personally, I'd do everything in logic like Evret suggested. Better yet, I'm currently favouring an entirely different approach, using hologram to mark areas that have line of sight (eg. a pillar in the middle of the room would have 4 partly overlapping holograms around it: front, back, left, right). Areas with a player in it activate a tag, a guard that feels a hologram with active tag has line of sight. Advantage is that you are extremely flexible in designing complex lines of sight, disadvantage is it's more work and maybe more thermo.

Edit: Nice snipe there...
2012-10-15 13:33:00

Author:
Rogar
Posts: 2284


Wow thanks guys, I didn't honestly think you would give so much feedback!

@Seku: Thanks for going through this much trouble to help me with this! I'll have to take more time to read and understand it, but I don't think it would be a good idea to use tags in my case, since as stated before there'll be more of them.
@Brannayen: I've tried elastic at first and it did work, but it was so unstable I don't know if it would remain without breaking for much time. I'll give it another try later!
@Roger: If it doesn't work, I'll analyse this method closely.
2012-10-15 18:53:00

Author:
MatrixEchidna
Posts: 66


Shoot me a friend request, and I'll show you what settings I used. I was able to stretch it out pretty far, and it never broke.2012-10-15 21:28:00

Author:
Brannayen
Posts: 438


Ok, I'm adding you and Seku as soon as I go back to LBP (playing Assassin's Creed right now, might not take too long as I think I'm about to beat it)2012-10-15 22:00:00

Author:
MatrixEchidna
Posts: 66


So I've been thinking about this quite a lot plus fiddling around in LBP, but only just now I think I've came up with something that will work well (haven't tested it so I'll leave it up to others to poke holes in it =P). I think it's a method that works regardless of level layout and regardless of amount of guards with virtually no logic at all.

It involves emitters. I'll try and explain in steps which should also explain the process.

1) Each guard has a player sensor in their centre with a cone shape as the detection radius, i.e their line of sight. If the player moves into this radius the sensor triggers.

2) When triggered, the output is connected to an emitter that spits out a small invisible bit of sticker panel/hologram at the fastest speed it can. Furthermore this emitter should be setup so that its direction of fire is always pointing towards Sackboy by using a look at rotator, and I guess the emitter itself on some holo that follows the guard to allow for free rotation.

3) All obstacles in your level should have a tag attached to them. The emitted piece of sticker panel should have an impact sensor that responds to the 'obstacle' tag and activates a destroyer to destroy the sticker panel.

4) In addition the sticker panel should have a player sensor attached with a very small detection radius (360 degrees). The emission should be travelling so fast it is effectively the guard's true eyesight and when it comes into contact with Sackboy the player sensor will activate and you can sound the alarm.

The settings on the emitter should allow for a constant stream of emissions while Sackboy is in the field of view and should have a lifetime that causes them to disappear when they reach the end of the guard's 'cone'. I can't see how this shouldn't work... but like I say I haven't tested it. When more than one player is present it may cause issues, but that could be resolved by having four emitters with one looking at each player. I think this method works because it breaks the process down into two stages by first checking it's possible for the guard to spot the player, then if it is possible it checks for anything that is in the way, but the speed at which it happens should mean there's no obvious processing time.
2012-10-15 23:19:00

Author:
Xaif
Posts: 365


This doesn't have anything to do with the problem I presented in the thread since it's not related to inter-layer logic, BUT!
It's still a great idea I'd like to implement with same-layer logic, I had another plan but this is much better. I do have a problem with the "emitting small objects FAST" part, since those objects would just skip through everything, as it used to happen with my gunshots until I worked around them, and hopefully that's possible here too!

(said workaround involves using long objects, since it'd be harder for them to skip through stuff; with my gunshots it's perfect since it looks awesome as a bullet trail, but I'd have to test it to see how it works for the detection system)
2012-10-15 23:49:00

Author:
MatrixEchidna
Posts: 66


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.