Fog of War

by Forum_account
Fog of War
A library to create an RTS-style "fog of war" effect. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Forum_account.FogofWar##version=1

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Forum_account.FogofWar##version=1

567 downloads
Version 1
Date added: Oct 10 2011
Last updated: Oct 12 2011
7 fans
The library uses image objects to create fog of war for clients. The map is covered with blackness that disappears as the player explores. Tiles within a certain range are completely visible, but previously explored tiles fade to gray when they're out of your range.

Multiple mobs can contribute to a client's sight so this is all set to include in an RTS game.

To use the library, here's all you have to do:

// initialize fog of war for the client
client.fog = new(client)
client.fog.init()

// define the mob's sight range and tell the library that this
// mob's sight contributes towards its client's visibility
fog_sight = new(src, client, 2)

Comments

Phat T: (Nov 7 2014, 5:07 am)
Why cant i change mob icon_state once i use fog
ImmeasurableHate: (Mar 27 2012, 3:00 pm)
ahh thanks.
Forum_account: (Mar 27 2012, 2:48 pm)
When you initialize the FogClient object you can pass it a z level to create fog for:

client.fog = new(client)
client.fog.init(1)

That'll make the fog only on the first z level.
ImmeasurableHate: (Mar 27 2012, 5:06 am)
Is there a way that you can only set this to a certain area if you dont want every map to have fog on it?