I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Legacy:EricBlade/Emitters

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

I've made some pretty neat looking weather emitters, and wanted to share them with everyone, since they did take me quite a while of toying with the parameters (even with guidance from UDN and Unrealwiki, the Rain one took me most of a day to tweak out).. I think it'd be really awesome if others wanted to share some of their emitter codes as well, as this is practically an arcane science, especially if you're totally new to this sort of thing.. (before working with Land of the Dead all my game experience has been in text-based games, both MUD and Web)

Rain[edit]

class WeatherRain extends Emitter;
 
DefaultProperties
{
	bStatic = false
	bNoDelete = false
	 Begin Object Class=SpriteEmitter Name=RainEmitter0
	 	StartVelocityRange=(Z=(Min=-25000,Max=-25000))
	 	LifeTimeRange=(Min=0.0175,Max=0.0175)
	 	MaxParticles=400
	 	UseDirectionAs=PTDU_Up
	 	StartSizeRange=(X=(Min=0.1,Max=1.0),Y=(Min=10,Max=30))
	 	StartLocationRange=(X=(Min=-250,Max=250),Y=(Min=-250,Max=250),Z=(Min=300,Max=400))
	 	UseCollision=True
	 	DampingFactorRange=(X=(Min=10000,Max=10000),Y=(Min=10000,Max=10000),Z=(Min=10000,Max=10000))
	 	AcceptsProjectors=True
	 	MaxCollisions=(Min=1,Max=1)
	 	Texture=Texture'DATextures.Weather.Rain'
            Name="RainEmitter0"
	 End Object
	 Emitters(0)=SpriteEmitter'UZGEffects.WeatherRain.RainEmitter0'
	 AmbientSound=Sound'DASounds.Environment.Rain'
	 SoundVolume=148
}

For the Rain example, the texture is something that looks vaguely like a raindrop, and it has an ambientsound attached that sounds like a slow rainfall. This is not a downpour type of rain, with a 400 particle maximum, it runs fairly smoothly on my 2ghz pc, actually up to around 900 or so particles before i really notice any serious degradation. Of course more intensive games like UT2k4 would probably be harder hit, but if you're running that, you've probably got better hardware than I do :) I use this with a special WeatherEffect actor that attaches the emitter to the player, so that you don't have to cover the entire level with the effect. I think it looks pretty stunning.

Fog[edit]

class WeatherFog extends Emitter;
 
DefaultProperties
{
	bStatic = false
	bNoDelete = false
	 Begin Object Class=SpriteEmitter Name=FogEmitter0
	 	FadeIn=True
	 	FadeInEndTime=10
	 	FadeOut=True
	 	FadeOutStartTime=12
	 	MaxParticles=40
	 	ResetAfterChange=True
	 	StartLocationRange=(X=(Min=-128,Max=128),Y=(Min=-128,Max=128),Z=(Min=0,Max=0))
	 	AcceptsProjectors=True
	 	SpinParticles=True
	 	StartSizeRange=(X=(Min=128,Max=256),Y=(Min=128,Max=256),Z=(Min=128,Max=256))
	 	AutomaticInitialSpawning=True
	 	DrawStyle=PTDS_Brighten
	 	LifetimeRange=(Min=90,Max=90)
	 	StartVelocityRange=(X=(Min=-20,Max=20),Y=(Min=-10,Max=10),Z=(Min=-1,Max=-10))
	 	WarmupTicksPerSecond=1
	 	RelativeWarmupTime=1
	 	Texture=Texture'DA_Particles1.fog1'
		 Name="FogEmitter0"
	 End Object
	 Emitters(0)=SpriteEmitter'UZGEffects.WeatherFog.FogEmitter0'
}

This nifty Fog effect has a few advantages over using the traditional distance fog. First, which is mentioned in the Fog page, is that it can swirl and move and drift and such, like real fog normally would, as compared to distance fog (though distance fog can be used for some pretty scary effects!).. and the second thing, which I like the most about it, is that it's not nearly as uniform as the distance fog .. and the third thing is that it can be used to cover just a certain area (like, in an outdoor area, you could have it just over a lake in the distance) or used at a specific level, to just cover the ground without obscuring everything. Ground fog can be put to some incredible mood enhancing effects. I have not managed to get this to work very well with the WeatherEffect class yet, as the player moves way too fast for the particles to catch up, but I hope to find a way around that. Also, this one needs a LOT more tweaking for use in individual areas, than the rain does. For the rain, you can pretty much just increase the affected area and the number of particles to add more/less, but for the fog, you need to also do that, and mess with the velocities, start location, particles, a lot more to get it to cover the right area without turning it into a complete and total whiteout.

Discussion[edit]

EricBlade: I would love for anyone to comment, or add your own tips or codes/settings, the more we all have available, the better we all become :)