11-17-2024, 04:14 AM
Wachunga's Fog of War
Enhanced Edition
Version: 3.0
Enhanced Edition
Version: 3.0
fog of war (Noun)
- The uncertainty in situational awareness experienced by participantsin military operations.
- The shrouded concealment of enemy activity outside of areas observable by a player's forces.
Introduction by Wachunga
Wachunga Wrote:A map specified as having "fog of war" (fow) has tiles that are (fully or partially) obscured until the player gets within visual range. The amount of fow to disappear as the player moves depends on the visual range specified. Gamers with experience playing Real Time Strategy games like Warcraft, Age of Empires, etc. should be quite familiar with the concept.
This script supports two kinds of fog of war: static and dynamic.
Static fow is the kind that typically hides terrain in RTS games. It covers the entire map until the player explores the area, discovering the underlying terrain. Once static fow disappears from an area of the map, it stays gone indefinitely (even if loading a saved game, leaving the map and returning later, going to the menu, etc).
Dynamic fow is identical to the static kind except that it doesn't stay gone forever: as soon as the player leaves visual range of an explored tile, dynamic fow covers it again. This kind of fow is typically used to hide enemy units in RTS games.
Note: I've taken great pains to optimize this script as much as possible (which unfortunately reduces the readability of the code). There shouldn't be much visible effect on frame rate.
Features
- Allow both Static (removable) and/or Dynamic (persistent) fogs in a map
- Set transparency levels and visible ranges
- Allow for custom fog tiles, ranges and fog transparencies per map
- Option to remove excess overlapping fog defined and added into the config
- Two ways to define maps that have fogs
- Allow custom events to erase static fogs just like the player
- Two ways to define custom fog-removing events
- Script call to remove or restore fogs
- Script call to permit/revoke an event's ability to erase static fogs
- Fog complete and percent complete script calls
Demo
Box Com Link
* As a Box.Com demo, there is 'no preview'. Just click the DOWNLOAD button in the corner.
Instructions
All within the demo. I spent three hours working on them, they BETTER be good enough.
FAQ
I broke the script down into its individual classes for study. Then I went through and broke the larger methods into smaller units which allowed for easier study. Wachunga was a member of the RMXP SDK circa 2006 on up, but this was before the SDK was considered, so the original comments were not up to the RMXP SDK standard at the time.
Compatibility
Nothing was over-written. There were sections that aliased/attached code to existing methods within Game_Map, Game_Character, Spriteset_Map and the like.
Credits and Thanks
To Wachunga who crafted the original, and spawned other scripts of its ilk, and to Tepe who requested the feature for map erasing events that brought about this endeavor.
Author's Notes
B-FLAT
Terms and Conditions
Free for use, even in commercial works. However, due credit for myself, Wachunga and Tepe is required.