Home LittleBigPlanet 2 - 3 - Vita - Karting LittleBigPlanet 2 [LBP2] Tutorials
#1
Guards: Three-Dimensional detection system
Archive: 1 post
So, I had this plan (https://lbpcentral.lbp-hub.com/index.php?t=74781-Recreating-the-Metal-Gear-Solid-gameplay) for recreating MGS gameplay in LBP... But then I caught myself in one of my flaws, my sheer incapacity to keep creating something for extended periods of time without it becoming a chore for me (always aching to do something new, even knowing it would end the same way, etcetera), so I just stopped working on it and don't believe I'll ever finish it; however, I'm more than willing to honor my promise of creating tutorials for you to try and make your own. On the tutorial itself... __________________________________________ What you'll learn here is emulating a line of sight for guards with all layers, in order to know if there's an optical obstacle between the guards and their target, the player; LBP is a 2D game, so it doesn't have built-in capabilities for three-dimensional interaction, and you must make it yourself. Also, note I won't get into detail about same-layer detection, since I didn't found out a satisfactory solution... You CAN do this with the same method I'll describe here, but it may not work as well as intended. What you want to do is a batch of five invisible sticker panel (or hologram if you don't own the pack) shapes; it doesn't matter which shape is as long as it physically works, so I'd recommend squares (circles may work, but since you'll want the shapes to stay parallel to themselves, a round shape makes it more difficult). One shape will always follow the guard, another will follow the player as long as it's close enough to be detected, and the three remaining will be in-between; those shapes will eventually work as active sensors for walls that depend on your position and the guard's. Click here for a visual representation of what you'll achieve (http://i45.tinypic.com/2q8yi5w.gif); the system will work as an approximation of the orange line. Also important is making them equally-spaced, for the perspective trick to work as intended. It was user Brannayen who figured out how to make this work, so he gets the credits for this part. = Of course, since the pieces move, it makes sense to include for each piece an anti-gravity tweaker set to 100% antigrav, 0% dampening, usual stuff. = The five shapes must be in the central layer and they must be always connected by elastic; = Two elastic pieces connecting each shape work best, since they must be always parallel, however, it should be noted that it likely increases the size of your panels, and large panels like the ones in the following screenshot aren't recommended. Whenever the sight range doesn't go too far (my guards had 72.0 radius on max range), I'd recommend using only one elastic for junction; = What worked for me was 60% strength and 0.0 length for each elastic (using one elastic for each junction), while the player-following piece had a microchip with 100% strength followers (ten on Brannayen's setup, shown on the screenshot), I can't remember what I actually used but it might be that too); the elastics and the opposing forces balance out in such a way that just works. Brannayen's build with 50% strength and two elastics per junction seemed to work independently of distance between player and guard. = Also, the guard-following piece had a microchip with four 100% strength followers. = Another important touch is look-at rotators, to make the pieces parallel; what works best is making all look-at rotators point at the guard, with max speed and strength just to be sure. The look-at rotators work differently in the following screenshot but it works as well, despite including a unnecessary tag into the equation. http://i50.tinypic.com/2nls2h.jpg In some situations, the system will go all haywire if you let the last panel follow you too far, although that seems to be easily remedied with using two elastics; the best way to remedy that without having to use two elastics is NOT letting the panel follow you far enough, but you can try changing specifications and see what you get. The system will still be a little wobbly no matter the configs, but it still works well. Now that you have the shapes moving the way they should, it's time to make your sight system: First, paste two thin panels in their respective thin layers (the ones adjacent to the mid layer) to each original panel you made in the previous steps, except for the one following the guard; they'll sense walls in the thin layers, so it's very important if your level has thin walls for you to hide.. Also note that you don't really need to have thin extensions for the panel following the player, it's even more realistic without, but maybe it's just more compatible with your level design if you just keep it. Anyways, what you want to have working, and you'll have to excuse me for the bad MS Paint drawing, is this: http://i48.tinypic.com/fd96rt.gif That's a top view representation of the sight system. The examples below highlight only the ACTIVE pieces, showing player and guard: http://i49.tinypic.com/xlaxyw.gif The idea now should be clearer, but let's go: = Each panel (except for the one following the guard, it's not necessary) must have a impact sensor that reacts only to an "obstacle" tag and set to "include touching". = There must be a way for your system to know which layer is the guard and which layer is the player. = Each of the nine possible player-guard combinations must, then, turn on their respective proper impact sensors. That way, if at least one of the sensors is on and active (i.e. touching a wall), the player is considered hidden. Also, it would be better if the shapes aren't too big, since you don't want the panels touching random obstacles that aren't really in the line of sight between player and guard. = Since the system isn't really perfect for its 2D-ness, it would be better to add thin extensions to all thick-layer obstacles (just like you did to the panels) to avoid frustration from the player. That's exemplified on the image below. http://i48.tinypic.com/nvw3g8.gif The first figure shows the player is at the guard's sight range; now, the guard can't really see you because he's facing a wall, right? The second figure shows that, in this scenario, only the dark-grey panel is working; if there's no thin extension of the wall (i.e. the obstacle covering its thick layer AND the thin layer on its left side), the panel won't be active, meaning the player would be caught even if the guard is staring at a wall. If there's the thin extension, the panel will activate (shown as green on the third figure), letting the game know that the guard can't see you. = Finally, it's important to remember this only tells the game whether there's a obstacle between player and guard or not. It does not take into account whether the guard is actually LOOKING at the player's direction. There must be a separate system for that, and I might get on that in the next tutorial, and maybe until then I'll find out a way to create a good same-layer detection system too. I hope that helped! I'm willing to see a working robust stealth engine on LBP2, so here's my first contribution to it! | 2013-01-09 04:28: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.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.