Thanks!
I will try and explain how it works.
OBJECTS.CON
Code: Select all
ObjectTemplate.create Bundle e_Snow
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.hasCollisionPhysics 0
ObjectTemplate.hasResponsePhysics 0
rem ------------------------------------
ObjectTemplate.addTemplate e_Snow_RotationalBundle
rem *** Must have a geometry if addTemplated effect bundles are going to work! ***
ObjectTemplate.create RotationalBundle e_Snow_RotationalBundle
ObjectTemplate.geometry radarbun_tow_M1
ObjectTemplate.createInvisible 1
ObjectTemplate.hasCollisionPhysics 0
ObjectTemplate.hasResponsePhysics 0
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0/0/0
ObjectTemplate.setMaxSpeed 200/0/0
ObjectTemplate.setAcceleration 200/0/0
ObjectTemplate.setContinousRotationSpeed 200/0/0
rem -------------------------------------------
ObjectTemplate.addTemplate e_Weather_Snow
ObjectTemplate.setPosition 0/90/256
ObjectTemplate.setRotation 0/-90/0
That is the important piece that makes this work. I put the effect bundle onto a rotational bundle. The effect bundle is rotated sideways so that the verticle vector is now the horizontal vector. The rotational bundle spins the whole effect around so that randomly spawned snow sprites using CRD_UNIFORM are spread out evenly. They spawn on the verticle axis vector (which is now on the horizontal axis vector) and thus there needed to be a rotational bundle.
I couldn't get the reletivePositionInRight command to work with CRD_UNIFORM, despite whatever I used, it didn't work. They all still spawned in random places only on the vertical vector. (reletivePositionInUp). Hince the reason why I had to put it on a rotational bundle. (if you know a way of getting the ReletivePositionInRight to accept CRD_UNIFORM correctly, then please do tell.
)
It is also centered on the rotational bundle. So that from the center, each arm of the vertical axis of the effect spans 256 meters in both directions. Imagine it like those spinner things in some Car washes. It simply rains snow and the spinner just spins around spraying out the snow evenly.
EFFECTS.CON:
Code: Select all
ObjectTemplate.create Emitter em_Snow
ObjectTemplate.template Fx_Snow
ObjectTemplate.lodDistance 512
ObjectTemplate.timeToLive CRD_NONE/1/0/0
ObjectTemplate.intensity CRD_NONE/200/0/0
ObjectTemplate.relativePositionInUp CRD_UNIFORM/0/512/0
ObjectTemplate.positionalSpeedInUp CRD_UNIFORM/5/-5/0
ObjectTemplate.startRotation CRD_NONE/0/0/0
ObjectTemplate.looping 1
ObjectTemplate.addChild 1
ObjectTemplate.startAtCreation 1
ObjectTemplate.startProbability 1
ObjectTemplate.create SpriteParticle Fx_Snow
ObjectTemplate.texture e_Snow
ObjectTemplate.mipMaps 0
objectTemplate.drag CRD_NONE/0.1/0/0
ObjectTemplate.timeToLive CRD_UNIFORM/10/18/0
ObjectTemplate.size CRD_UNIFORM/0.08/0.15/0
ObjectTemplate.gravityModifier CRD_UNIFORM/0.1/0.2/0
ObjectTemplate.destBlendMode BMOne
objectTemplate.hasStaticColor 1
And that's the Effect bundle. It spawns 200 sprites per second. Each sprite has a CRD_UNIFORM setting for timeToLive that has them last from 10 to 18 seconds. My rough math puts that at a max of 4000 sprites that could be on the screen at once, though the timeToLive random factor will always meen there will be less then 4000, but 4000 is the theoretical limit. that this effect is set to produce. So it's about as close as I can get it without hitting the 5000 CTD ceiling. Now despite that being a CRAP LOAD OF SPRITES, it doesn't lag at all! At least not on my machine. My machine isn't some suped up rig that can run all the latest games at high settings either. So if it doesn't lag my machine, it really shouldn't lag yours either. And the effect quality setting might alter how this effect behaves as well. So some users can just turn down the effect quality setting if it lags them for whatever reason. One of my guess as to why it doesn't lag is the code for the SpriteParticles are as simple as they can get. There is no color over time setting, nor is there a size over time setting and nothing overly fancy is done with them other then the drag modifier. The rain in the King of the Hill map in DCX however uses Particles and they do some fancy things like change in size and move around and stuff. The game handles the physics for Particles differently then Sprites. Thus, the rain effects in DCX lags to hell.
The ObjectTemplate.positionalSpeedInUp also has a CRD_UNIFORM setting. It will spawn the flakes in from -5 to 5 speed. So they will have random directions to them much like how real snow is.
For rain, I pan to have that as a CRD_NONE with a constant direction so that I can slant the rain in a direction and it will not be random like the snow.
I added the lodDistance setting and set it as 512 meters. So in theory you should be able to place more the one effect bundle on the map and have them separated from each other by that amount. But I won't know if that can work properly or not. I also used to have a lod system set up for the bundle that has the rotational bundle. But it wouldn't behave in DesertCombat (not activating the effect like it should), thus I removed it and updated all my links.
I sent this code to DACV and he will soon test it in BFV. I do not know how this effect will behave in BFV since I don't have the game installed right now. There is also the possibility that BFV won't crash if you exceed 5000 sprites like BF42 does. So BFV might handle it better. I encourage those who have BFV to stress test this effect and see how BFV handles it. Also, you can add BFV specific commands to the effect and perhaps improve it's appearance in way that BF42 can't do.