Forest fires gadget
Moderator: Moderators
Forest fires gadget
I was thinking of making a gadget that let's trees cacthc fire and let the fires spread to nearby trees.
Curerently I envisaged the following work flow:
- Catch trees dead in FeatureDestroyed Callin
- Spawn a CEG that looks like fire and smoke
- Make units nearby become damaged by it
- Manage the spreding of the fire
All that is cool and doable, but is there not a better way? Like using a default fire ceg that also handles the damages effect. Seems I'm inventing the wheel here.
Also, it would be nice to be able to start the fire before the tree has been destroyed, is there really no FeatureDamaged callin? Workaround: make the tree feature an unit? Or better ideas?
Curerently I envisaged the following work flow:
- Catch trees dead in FeatureDestroyed Callin
- Spawn a CEG that looks like fire and smoke
- Make units nearby become damaged by it
- Manage the spreding of the fire
All that is cool and doable, but is there not a better way? Like using a default fire ceg that also handles the damages effect. Seems I'm inventing the wheel here.
Also, it would be nice to be able to start the fire before the tree has been destroyed, is there really no FeatureDamaged callin? Workaround: make the tree feature an unit? Or better ideas?
Last edited by Jools on 01 Nov 2011, 23:31, edited 1 time in total.
Re: Forest fires gadget
cegs are not damage dealing..
use a weapon...
I did some hacky shit like this for TD(videos on youtube), CA took it and did their fire code for units on fire...
use a weapon...
I did some hacky shit like this for TD(videos on youtube), CA took it and did their fire code for units on fire...
Re: Forest fires gadget
use Spring.SetFeatureHealth or Spring.DestroyFeaturesmoth wrote:cegs are not damage dealing..
use a weapon...
Re: Forest fires gadget
Yes, for killing the feature, but all that is moot if I can't catch the feature being damaged before it's desroyed. Units have a UnitdDamaged callin, but there seems to be no equivalent for features.
Or maybe just monitor all features (7000 in the map) in gameframe and do something when the health changes. Would be really slow I guess.
Or maybe just monitor all features (7000 in the map) in gameframe and do something when the health changes. Would be really slow I guess.
Re: Forest fires gadget
no that is silly.
do ceg, any features near by within burn distance..?
yes?
add to table of features..
only cycle that table.
do ceg, any features near by within burn distance..?
yes?
add to table of features..
only cycle that table.
Re: Forest fires gadget
in 0.83 FeatureDestroyed gets some more parameters so you can ie tell how a feature was destroyed. Some other advances too iirc. Maybe have a look if there is something else added that is helpful.
For now I'd do as in your first post except of using CEG for damage use Spring.SetFeatureHealth or Spring.DestroyFeature.
But for the spreading/burning you deal the damage yourself so there is no need for FeatureDamaged() in that case.
For now I'd do as in your first post except of using CEG for damage use Spring.SetFeatureHealth or Spring.DestroyFeature.
That is only a problem for the starting of the fire: Atm you can only start the fire when a feature gets destroyed, not on damage. (beside watching explosions or something)Yes, for killing the feature, but all that is moot if I can't catch the feature being damaged before it's desroyed.
But for the spreading/burning you deal the damage yourself so there is no need for FeatureDamaged() in that case.
Re: Forest fires gadget
That's correct. I just wanted to have it possible that several trees burn at the same time, or that fires spread before the tree is completely destroyed, but maybe this is an acceptable compromise anyway (many simultaneous fires cause lag).
Is there a way of knowing the current windspeed and direction? Lua_Constgame has max and min, but no direction.
Is there a way of knowing the current windspeed and direction? Lua_Constgame has max and min, but no direction.
Re: Forest fires gadget
Spring.GetWind
y u no bookmark http://springrts.com/wiki/Lua_Scripting
y u no bookmark http://springrts.com/wiki/Lua_Scripting
-
- Posts: 1398
- Joined: 17 Sep 2008, 04:36
Re: Forest fires gadget
Because he can just ask in the forum and have you look it up for him.
Also, was this feature lost somewhere over the years? http://www.youtube.com/watch?v=NyrzagbyXas
Also, was this feature lost somewhere over the years? http://www.youtube.com/watch?v=NyrzagbyXas
Re: Forest fires gadget
That was the first thing I thought of after reading the thread title.luckywaldo7 wrote:Because he can just ask in the forum and have you look it up for him.
Also, was this feature lost somewhere over the years? http://www.youtube.com/watch?v=NyrzagbyXas
Re: Forest fires gadget
Nah, he wants to add it for general features while the engine forest fires are just supported by native trees (:= engine drawn ones).
There is for a very long time the request to extend this via a featuredef tag.
There is for a very long time the request to extend this via a featuredef tag.
Re: Forest fires gadget
No, the engine version also works on 3rd party trees/features, but it's kinda bad: there's no visible fire and the spread mechanism can't be controlled in any other way than by altering the model radius. It's also too fast and too inclusive, either nothing burns or all trees in the whole forest burn.
The fact that it's too fast means that it influences game startegy too much, you can set a forest on fire and destroy too much of the enemy base too fast.
It also skips leaving a wreck after the feature has been destroyed.
Also, I'd like to have the fire spread only in the direction of the wind at the moment.
The fact that it's too fast means that it influences game startegy too much, you can set a forest on fire and destroy too much of the enemy base too fast.
It also skips leaving a wreck after the feature has been destroyed.
Also, I'd like to have the fire spread only in the direction of the wind at the moment.
Re: Forest fires gadget
Spring.SpawnCEGsmoth wrote:cegs are not damage dealing..
( string "cegname",
number posX = 0, number posY = 0, number posZ = 0,
number dirX = 0, number dirY = 0, number dirZ = 0,
number radius = 0, number damage = 0
) -> nil
Re: Forest fires gadget
Hmm, i have actually ran into that before, but I thought it was just a parameter passed to the ceg so it could look different based on damage recieved.
I dont think spawnceg deals damage...
I dont think spawnceg deals damage...
Re: Forest fires gadget
Does it matter really? You can set damage with Spring.AddUnitDamage() anyway and get the affected units from the position of the feature.
I also want to add that I probably can't make a better looking gadget than the one included, but the primary concern with the included forest fire function is that it merits big collision volumes of the trees. I want to keep the volumes small for improved gameplay.
Actually, I thought about having a spherical volume offset from the ground, so that unts like flashes can fire under the trees, but arcing projectiles would be caught in them. However, this makes it hard to dgun the trees, so I still thought a cylindrical collision volume is best. But I want the cylinder to be so small that it just covers the stem of the tree. It seems that such small volumes disables the built in fire mechanism. Hence, I need an own one.
It would actually be optimal to have a collision volume dependent on the type of projectile: I'd like to have a small cylindrical volume for solid projectiles and a large spherical for flame type weapons. But I guess this is not possible.
I also want to add that I probably can't make a better looking gadget than the one included, but the primary concern with the included forest fire function is that it merits big collision volumes of the trees. I want to keep the volumes small for improved gameplay.
Actually, I thought about having a spherical volume offset from the ground, so that unts like flashes can fire under the trees, but arcing projectiles would be caught in them. However, this makes it hard to dgun the trees, so I still thought a cylindrical collision volume is best. But I want the cylinder to be so small that it just covers the stem of the tree. It seems that such small volumes disables the built in fire mechanism. Hence, I need an own one.
It would actually be optimal to have a collision volume dependent on the type of projectile: I'd like to have a small cylindrical volume for solid projectiles and a large spherical for flame type weapons. But I guess this is not possible.
Re: Forest fires gadget
that is part of the spawn ceg function, not cegs themselves, unless that has changed..FLOZi wrote:Spring.SpawnCEGsmoth wrote:cegs are not damage dealing..
( string "cegname",
number posX = 0, number posY = 0, number posZ = 0,
number dirX = 0, number dirY = 0, number dirZ = 0,
number radius = 0, number damage = 0
) -> nil
Re: Forest fires gadget
How else to spawn CEG with lua?smoth wrote: that is part of the spawn ceg function, not cegs themselves, unless that has changed..
Behe might be right though, not sure.
-
- Posts: 1398
- Joined: 17 Sep 2008, 04:36
Re: Forest fires gadget
I like where you are going with this. :DJools wrote:No, the engine version also works on 3rd party trees/features, but it's kinda bad: there's no visible fire and the spread mechanism can't be controlled in any other way than by altering the model radius. It's also too fast and too inclusive, either nothing burns or all trees in the whole forest burn.
The fact that it's too fast means that it influences game startegy too much, you can set a forest on fire and destroy too much of the enemy base too fast.
It also skips leaving a wreck after the feature has been destroyed.
Also, I'd like to have the fire spread only in the direction of the wind at the moment.
Disregard me then please, and carry on.
Re: Forest fires gadget
realistic forrest fire, are difficult. Because the physics involved are difficult. First there is a grass fire, which heats and drys the outer bork of the trees who are set aflame, drying the leafes, which burst into fire in a cloudlikeflame.
Also sometimes, smoke-gases form a "big ernie"
http://www.youtube.com/watch?v=XsfwiRfv ... re=related
http://www.youtube.com/watch?v=tg8t3OVt ... re=related
This will be good.
Also sometimes, smoke-gases form a "big ernie"
http://www.youtube.com/watch?v=XsfwiRfv ... re=related
http://www.youtube.com/watch?v=tg8t3OVt ... re=related
This will be good.
Re: Forest fires gadget
Cool, all this helps. I have already thought of making different probabilities of the fire spreading via bushes and trees. I think we start with something and then when it works it can be improved.
I can't really design CEG:s so I'm reusing old ones. Currently I'm working with one called "napalam". It's quite okay, but i'd like to make it a bit smaller to minimise lag etc.
The spreading formula will be interesting to make. As of now I thought that the area of contagion should be proportional to feature height and momenetary wind speed. Then maybe spreading from trees should be more likely than from bushes, but contagion to bushes should be more likely than to trees. Maybe also read some customParam that can be added to feature.
I can't really design CEG:s so I'm reusing old ones. Currently I'm working with one called "napalam". It's quite okay, but i'd like to make it a bit smaller to minimise lag etc.
The spreading formula will be interesting to make. As of now I thought that the area of contagion should be proportional to feature height and momenetary wind speed. Then maybe spreading from trees should be more likely than from bushes, but contagion to bushes should be more likely than to trees. Maybe also read some customParam that can be added to feature.