Part 2
We want our game moody, we want our game smooth.
We have a limited budget when it come to things we can render.
I our little dungeon, we allocate most of the rendering power to useful stuff. Trying to keep it at steady 60 fps on a phone may be a bit of a challenge with real-time lights and shadows.
I still wanted some basic fog in the map.
It's grey, it a bit lighter than the black background and it should be done with less than 10 particles per tile we want to cover.
It shouldn't draw the attention of the player, yet it should be clear and not look like the screen of the phone is a bit dirty.
Here is what we got!
The main attribute for our fog effect are:
-The particle graphics
This one was pretty simple, the best was round, a bit like a cloud
-The level of transparency of the effect
Tricky parameter, as you have the transparency of the particle mixed with the additional transparency of the effect. Overlapping particles create this fog-like effect where you can't distinguish the original particle easily if you have enough transparency. Too much transparency will look like a dirty screen if you use a grey fog. The line between those two trade off is really thin.
-The color of the effect
We reuse the same effect on other fogs like the "Fog of terror" that you can't cross unless you have a light. (Like in Zelda twilight princess at some point)
-The movement style and speed
the movement style shouldn't be computation heavy. One of the lightest algorithm that work well for what we want is the random-walk. Draw a random amount of acceleration for the particle and from the chaos of transparency shall rise the son of darkness, FOG. Anyway, very simple, very good. The speed would be slowly evolving fog that covered the area we required without looking like a square. Additionally we wanted to have an influence on the fog when the player moves through.
This is a more tricky thing to do efficiently. I ended up giving the tile a flow vector which is changed by any characters on the tiles and the flow vector is diminished every time a particle reads it. Additionally so that each particle of that tile wouldn't move at the same speed at the same time we make the particle react less if its further away from the character.
-The time to live of the particle before it fades out and a new one fades in
With the random walk movement of the tiles, the more time they wander, the more probable it is that some particle go over other tiles. This is easy to calibrate, just start the program, ad tweak until you are happy with the average spread of the particles.
Now another particle effect we wanted was in the menu, something to put on the borders.
Here we could be openhanded with the amount of particles.
We made 2 sharp grass shaped particle and a round one, all particles spawning around the border of the screen. The rest was using the same logic as the previous effect.
The rendering was changed to and we removed the effect alpha. The color was black so it would hide the limit of the phones screen.
and the result was:
This is our start screen, the fade in is also nice but that will be shown later in a video.