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

A Fog Of War Effect for top down games

Archive: 6 posts


This effect will black out areas of the playing field until players approach, and optionally it will black them out again after players haven't been around for a while. It's designed to have minimal impact on the rest of your game's design.

First, the fog itself: On another tips thread (https://lbpcentral.lbp-hub.com/index.php?t=47043-Did-you-know-that...-(tidbits-of-logic-I-learned)) user jdteather314 just posted the discovery that the light on a stick decoration, which is normally always white, turns instead the color of whatever holo it is placed on. If you turn the holo brightness down to zero this decoration turns a very pure black. You can then enlarge the holo to an arbitrarily big size, and the decoration will become a large pure black circle that will cover everything underneath. (You could make this instead dark gray or whatever you like by tweaking the holo.)

This decorated holo will serve as one area unit of our fog. I'm going to call it the Dark Circle holo moving forward. If you wanted units that were a bit more square in coverage you might try using four decorations in square pattern instead of just one large circle. You get the idea. On the Dark Circle holo, add a microchip with a player sensor, a destroyer, and a tag. The player sensor should have a radius a bit bigger than the Dark Circle covers, and it should be wired to the destroyer, so that when players approach, the circle vanishes. I'm going to call the tag the Dark Circle tag, and it will be used below for replanting the fog.

If your game just has the fog disappearing permanently, then all that's left to do is cover the map with a grid of these dark circles. But that might make creating and tweaking kind of a pain, so read on for how to replant the fog, which could be used for initial planting as well when the game first starts up, so your create-time playing field stays fogless.

The Planting sites: Around your top down playing field, place a grid of Planting Sites, where ever you'd like a dark circle to appear. A Planting Site will be a piece of invisible holo with a microchip that contains a player sensor, a timer, a tag, and a tag sensor. The player sensor will have the same radius as the dark circle, and will be set to inverted mode, so it senses when players are no longer around. Wire it to the reset on the timer. The timer is a slow count up timer, set to the length of time before you'd want the fog to come back. The tag will be called the "Plant here!"tag. We want that tag on when both a) the timer has reached max, and b) there is no dark circle present. So you'll need to AND the output of the timer and the tag sensor, and wire the AND output to the Plant Here tag. The tag sensor is set to sense the Dark Circle Tag, but inverted, so it senses when one isn't around.

The Planter: This is the last bit. One more piece of invisible holo with a microchip on it. This time, the chip has a follower, a tag sensor, and an emitter. The emitter emits a dark circle. The emitter should be set to one shot input, infinite lifetime on the emissions outputs, and as many at once as you have planting sites. The follower follows Plant Here tags. It has a zero minimum radius and a gigantic maximum radius, as big as your playing field. Max its movement and strength settings as well; we want it to make haste. The tag sensor has a very small radius, and also senses Plant Here tags. It is wired to the emitter.

So the Planter runs around the map putting up Dark Circles whenever players haven't been around in a spot for a while, and those circles disappear as soon as a player nears. During create-time, you need only disable the planter to prevent the fog from getting in your way. Just make sure to enable it before you publish. I like to have a Debug tag turned on for create-time behaviors, and add a sensor to things like the planter to disable it's chip when that tag is present. This way I can have just one easy thing to turn off (the debug tag) when I publish.

Hope this helps. If you use it, please let me know, I'd love to come check out your level.

Happy Gadding.
2011-02-18 12:00:00

Author:
LittleBigDave
Posts: 324


Well, I say.... Quite a handy idea. But I myself would have just turned the darkness up on the map and used invisible LEDS to light up areas I wanted.2011-02-18 13:56:00

Author:
onaga666
Posts: 293


Well, I say.... Quite a handy idea. But I myself would have just turned the darkness up on the map and used invisible LEDS to light up areas I wanted.

It's just that then your overall game lighting becomes pretty driven by achieving this effect. It was actually avoiding that very issue that spawned this other plan. Certainly worth mentioning though.
2011-02-18 19:17:00

Author:
LittleBigDave
Posts: 324


Sounds neat, though I don't quite understand how it works, and I barely know what fog of war is either (I only know a bit about it from the episode of The Melancholy of Haruhi Suzumiya where the SOS brigade play a game against the Computer Club, who cheat because the SOS brigade have fog of war but they do not.)2011-02-18 21:22:00

Author:
Matimoo
Posts: 1027


^Fog of war is found in RTS games. It consists of a thick, black fog that covers the whole map in order to hide it. Player units/buildings are like light sources that dynamically dispel the fog, making scouts invaluable if you're looking for other player bases or resources. The fog usually creates itself back when the unit leaves, although only to a 50% state allowing you to see the actual map but not other players' units or bases.2011-03-20 18:56:00

Author:
Rovelius
Posts: 74


I'll just leave this here... https://lbpcentral.lbp-hub.com/index.php?t=53299-How-to-Make-Black-Holograms2011-03-21 06:49:00

Author:
Brian_Istenes
Posts: 151


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.