Cellular Automata based wildfire for FlightGear/CVS --------------------------------------------------- Copyright (C) 2008 - 2010 Anders Gidenstam * These programs are free software; you can redistribute them and/or modify * them under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA NOTE: Screenshots and photos are Copyright (C) Anders Gidenstam 2006 - 2010. All rights reserved. Please contact me (webmaster at gidenstam.org) if you'd like to use a photo or screenshot. News ---- 2010-03-01: Wildfire is included in FlightGear 2.0.0. 2010-01-03: New version of the Crash tender vehicle. 2009-06-01: The Catalina in FlightGear/CVS is capable of fire fighting. No need for the diff anymore. 2009-01-19: Wildfire is now available in FlightGear/CVS. Updated Crash Tender for FlightGear/CVS. The last version available in old/ probably works with FlightGear 1.9.0/1.9.1 except for sharing over MP. 2009-01-11: Updated version for FlightGear/CVS which is not compatible with 1.9.0 or 1.9.1. It also cannot communicate with older versions of WildFire. 2008-12-21: Updated version for FlightGear/CVS and 1.9.0. 2008-12-18: Updated: New version for FlightGear/CVS and 1.99.5-rc2. 2008-11-17: Updated: New version for FlightGear/CVS. 2008-07-12 Updated: New version for FlightGear/CVS. 2008-06-23 Updated: Fixed a bug in mp_broadcast.nas. 2008-06-15 Updated: Adapted to recent changes in the Nasal library. 2008-06-07 Updated: New improved fire particle systems and a small update to the crash tender. 2008-04-22 Updated: Added a small configuration dialog and a diff for adding a menu entry to data/gui/menubar.xml. 2008-04-08 Updated: Now loading and saving of event logs works. It is also possible to skip ahead to a chosen point in time (specified as #seconds from the epoch) when loading a saved log. This should allow multiple players to restore a log to a consistent shared state (untested). 2008-04-06 Updated everything. And added crash-n-burn.nas which makes YASim aircraft start a fire when they crash. 2008-04-01 Added an ugly 3d model for foam contaminated cells. Note, there are some bugs in the cellular automaton model that among other things can lead to some cells being reported as burning even after being extinguished. I hope to fix these things soon. 2008-03-31 I could not resist turning Alexis Bory's nice looking crash tender into a fire fighter. His model is included in my Crash_tender archive. It is originally available in http://scenemodels.flightgear.org/download/SharedModels.tgz Installation (No longer needed as Wildfire is included in FlightGear/CVS) ------------------------------------------------------------------------- - Copy wild_fire.nas to $FG_ROOT/Nasal/. - Copy the directory Models/WildFire to $FG_ROOT/Models/. - Update preferences.xml to enable the MP property used by WildFire: Inside the element add the element, i.e. the lines below: - OPTIONAL: Update $FG_ROOT/gui/menubar.xml using menubar.diff and patch or manually add this last inside the Environment menu element. nasal Usage ----- A fire is started by calling wildfire.ignite(pos) where pos is a valid geo.Coord instance. Example: starting fires by ctrl+shift+click: Put this Nasal fragment somewhere where it is run at startup. (E.g. in a block in preferences.xml.) setlistener("/sim/signals/click", func { if (__kbd.shift.getBoolValue()) { if (__kbd.ctrl.getBoolValue()) { var click_pos = geo.click_position(); wildfire.ignite(click_pos); } } }); Configuration properties ----------------------- These properties can be set at runtime, in preferences.xml or in any other way supported by FlightGear. /environment/wildfire/enabled : bool Enables/disables the whole WildFire module. On disable the current state is lost. Can be used to reset WildFire. /environment/wildfire/share-events : bool Enables/disables sending and receiving of fire events over the multiplayer network. /environment/wildfire/fire-on-crash : bool If true a fire will start if the aircraft crashes. /environment/wildfire/models/enabled : bool Enables/disables rendering of the 3d models. (That is, fire, smoke, soot and foam.) /environment/wildfire/save-on-exit : bool If set the current log of Wildfire events is saved in ~/.fgfs/Wildfire/fire_log.xml . /environment/wildfire/restore-on-startup : bool If set Wildfire will load and execute the events in ~/.fgfs/Wildfire/fire_log.xml . This recreates the fire state as it where when the log was saved. NOTE: A long event log or one that covers a long period of time will take a a lot of time to recreate. Storing and reloading of the CA state, as opposed to the event log, is not supported yet. API --- ignite : func (pos, source=1) pos - fire location : geo.Coord source - broadcast event? : {0, 1} Start a fire. resolve_water_drop : func (pos, radius, volume, source=1) pos - drop location : geo.Coord radius - drop radius m : double volume - Not used : double source - broadcast event? : {0, 1} Extinguishes any fires in the cells within r of pos and makes the cells nonflammable. resolve_retardant_drop : func (pos, radius, volume, source=1) { pos - drop location : geo.Coord radius - drop radius m : double volume - Not used : double source - broadcast event? : {0, 1} Identical to resolve_water_drop. resolve_foam_drop : func (pos, radius, volume, source=1) { pos - drop location : geo.Coord radius - drop radius m : double volume - Not used : double source - broadcast? : {0, 1} Extinguishes any fires in the cells within r of pos and makes the cells nonflammable and foamy. load_event_log : func (filename, skip_ahead_until=-1) filename - getprop("/sim/fg-home") ~ "/Wildfire/" ~ filename skip_ahead_until - skip from last event to this time : double (epoch) fast forward from skip_ahead_until to current time. x < last event - fast forward all the way to current time (use 0). NOTE: Can be VERY time consuming. -1 - skip to current time. Loads an event log. The skip_ahead_until argument can be used for synchronizing a restored fire state among multiple players. save_event_log : func (filename) filename - getprop("/sim/fg-home") ~ "/Wildfire/" ~ filename Saves an event log. print_score = func Print a summary of the current wildfire state. /Anders