Always snap to grid

Legacy:Raven/RParticles

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

RParticles v. 1.2[edit]

RParticles is advanced particle engine for UT'99. It's written only in Unreal Script and therefore it works on Linux, Mac and Windows.

  • Up to 16 different templates in one Particle Emitter
  • Can fade in/out
  • 5 different states (TriggerControl/TriggerTurnsOff/TriggerTurnsOn/TriggerToggle/TriggeredBlast) in ExtendedEmitter
  • 2 different selection methods
  • 2 different burst methods
  • Collision detection
  • Performance mode
  • Available version for Unreal 1 (tested on 226 and 225f)
  • Much more :)

Class tree:

  • Actor
    • ParticleSystem - holds everything together
      • BasicParticle - particle class
      • EmitterCombiner - Emitter Combiner is used for merging many emitters into one effect
      • Force - affects BasicParticle velocity (not ParticleEmitter)
      • ParticlePath - changes BasicParticle Destination
      • ParticleAlter - affects ParticleEmitter configurations (particles velocity)
      • ParticleAnimationStorage - stores animation info for particles (for coders)
        • UT2k4FireAnimations - animations for UT2k4Fire2
      • ParticleEmitter
        • ExtendedEmitter - extended version of ParticleEmitter. Contain working states
        • WeaponEmitter - emitter for weapon effects. Can be destroyed.
        • FireEmitter - holds fire effects together
          • UT2k4Fire - fire preset form UT 2004
          • UT2k4Fire2 - fire preset from UT 2004 (with ParticleAnimationStorage)
        • ParticleTest - sample particles
          • Sample1
          • Sample2
          • Sample3

CTF-TFC-Variatto with RParticles
Simple Torch created using RParticles
UT2k4 and UT'99 emitter
UED shot

UT'99 version download link: [1] (tested on 436).

Unreal 1 download link: [2] (tested on 226 and 225f - version 1.2).

Archive content:

  • RParticles.u
    • 3 samples and 2 working fire templates included
  • Help file

Tarquin: Please give images clear and sensible names. '222' does not describe what this image does.

Raven: Sorry for that. I've updated that image with better name - RPartices.jpg.

Tarquin: Thanks :) This is for UT? Might be an idea to clearly state that at the top of this page. Oh, and don't forget to mark them as custom classes.

Raven Yes, it's for old UT'99. Everything added (I hope). And little update will come soon (new sizing method (infinity/user defined)). Actually it's finished, but i need to test it on-line.

Tester: If you have 1ghz and MX440 like me do not use this! It killed my fps down to 10fps in a single cube room!!!

Xian: I'll take a look at it when I have time. UT99 has always been my true love, never bene a fan of UE2. BTW, I suggest you check out this subpage. Working together with Shadow might help you both. I don't know if you have performance issues (as in FPS drops) with your script yet, but Shadow might be able to help you there if you do. Exchanging ideas, coding together, who knows ?! He is also planning on porting a new RenDev for OGL (not sure about D3D) to include motion blur and such. You could ask him to include your distance fog, once it's fixed. Good luck !

-> Shadow: Well currently while rewriting my particle system I made up my mind coding 4 different particle systems (yes..). All four a very different but still compatible to each other. I'm maybe going to code a 5th particle system which will be native, covering voxel particles, advanced particle techniques and maybe in-UnrealED preview, but still keeping the other 4 for leaving platform independence intact. The reason for 4 different particle systems is the contrast between crapload + growing functionality VS. user friendlyness + performance optimizations. Most of the code is only executed when it's really needed resulting in a performance boost. They're also (currently) around 30+ performance options dealing with visibility, culling, dynamic lod, respawning, recycling algorithms. One of the completely new features is a build-in support for simulated pixel shaders allowing particles with dynamic color, U/V size, combiners and so on. All particle systems, of course next to all other extensions, will be intensely tested online too by the help of some guys from UnrealED.de making shure it'll work fine in multiplayer/network too. The extended Render containing the StaticMesh Extension and the Hardware PostProcessing will be for both Direct3D8/9 and OpenGL1.4/2.x . Also there's no need of implementing his distance fog since I had distance fog years ago for LSoNP and both methods (his and mine) are nearly the same. I already helped Raven several times concerning his scripts, lastly on his particle system. Giving a slight prediction the particle systems should run smoothly on a machine like 1-2 GHZ, 256/512 MB Ram, 64 MB GFX Card. My own pc isn't the best and also partially broken too so you can trust me (2.5 GHZ, 256 MB Ram (originally 512 MB, but one ram slot is broken), 64 MB GFX Card (GeforceFX 5200)). The final pack will contain around ~20 basic emitters and ~100 additional emitters which are all ready-to-use.

Hope I made everything clear for you Xian ;)

Xian:

Edit: After checking your code... I don't understand your idea:

class ParticleSystem;
 
simulated function int RandFloat(float max)
{
 local int num;
 local float delta;
 num = max;
 delta= max - num;
 
 if (rand(100)<delta*100) num++;
 return num;
}

So... num (initially 0) becomes max (say... 3.0f). Delta becomes max - num, that is 3.0f - 3.0f, which is 0. Then, if a Random 0-99 number is smaller than delta * 100 (that is, 0 100, which is 0), increase the num, which was initially max (3.0f in our example). Seems like a lot of assigning and operator calls which are not efficient in the aging UE1 framework. You either forgot something (maybe a RandRange() call) or you wanted to just reset delta (which is reset to 0 by default).

Also:

class ExtendedEmitter;
 
//=============================================================================
// Set's bOn on or off. cleintside function
//=============================================================================
function SetOn(bool btun)
{
    /*if(Level.NetMode != NM_DedicatedServer)*/ bIsOn=btun;
}

To make a function clientside, you need to declare it as simulated. Also, you extend ParticleSystem which extends Actor. Role is ROLE_Authority by default and RemoteRole is ROLE_DumbProxy. In order to ensure proper replication, a simulated function call requires a RemoteRole of ROLE_SimulatedProxy. Which you do not have.

	simulated function Trigger( actor Other, pawn EventInstigator )
	{
                if (bIsOn)
                {
                    SetOn(false);
                }
		else
                {
                    SetOn(true);
                }
	}

This part in ExtendedEmitter.TriggerToggle.Trigger() could have been written as:

	simulated function Trigger( actor Other, pawn EventInstigator )
	{
            SetOn(!bIsOn);
	}

Also:

class ParticlePath;
 
simulated function Touch(Actor Other)
{
     if(BasicParticle(Other) != none) BasicParticle(Other).Destn=NextPoint;
}

Would be better written as:

simulated function Touch(Actor Other)
{
     if ((NextPoint != None) // No reason to check the rest of the code if we don't have 'NextPoint'
     && (BasicParticle(Other) != None))
         BasicParticle(Other).Destn = NextPoint;
}

These are just a few glances I had within the first minutes. The code is interesting, but it seems you lack some optimizations in the code. I estimate that if you would optimize all of it, you'd get a speed-up of at least 25% per whole package (note, not 25% increase per class, but as a whole, so around 5% maybe per running class, which is still good).

Please note that UE1 and UScript in general is slow, so take any optimization you can get. It can definitely help you and others :)


Credits:

  • USU team for release UltimaUnreal particle system (it was a base or very first TCO particle system, and now not much of it left in the code right now :P)
  • TCO Team for early betatesting :)

Version history:[edit]

  • v. 1.2a (Unreal 1 version)
    • new SpawnOffset vestor in Particle_EffectArea[16]
  • v. 1.2
    • ParticleEmitter is now fully ClientSide.
    • States TriggerControl/TriggerTurnsOff/TriggerTurnsOn/TriggerToggle/TriggeredBlast was moved to ExtendedEmitter because of replication which was required in order to make this states work
    • WeaponEmitter for any effects which have to be spawned/destroyed during game (like Explosions, etc.)
  • v. 1.1 (unreleased)
    • new Particle_EffectArea[16] struct to override defult spawn area
    • new Particle_Mesh[16] struct which allows to play animations while bUseMesh in Particle_Display[16] is true
    • new Particle_Destination[16] struct which gives ability to decide about optional destination
    • new ParticlePath actor used to give particles specified path (can be used only if DestinationType != DEST_None)
    • new features in Force actor
    • few optimizations in replication block
  • v. 1.0
    • few optimizations
    • fixed critical error which in some situations can lead to crash !!
  • v. 0.9.0.8
    • added new, advanced, velocity functions (Particle_InvertVelocity[16] inside ParticleEmitter)
  • v. 0.9.0.7
    • optimized ParticleEmitter.uc
    • optimized BasicParticle.uc
  • v. 0.9.0.6
    • added new EmitterCombiner.uc actor
  • v. 0.9.0.5
    • added new ESizing enum. It describes whenever particle should shrinks/grows endlesly or stop when it reaches specifed size
  • v. 0.9.0.4
    • added new srtucture: SSize where all size related variables was moved (ParticleDrawScale/ParticleDrawScaleVariance/ParticleGrowth)
    • new option, which allow to cyclically changing particle size (shrinking/and growing), has beed added
    • new sample (Sample3.uc) which shows cyclically changing particle size
    • few smaller or bigger improvements
  • v. 0.9.0.3
    • added new global setting which can be forced to use instead of template Particle_Main.
  • v. 0.9.0.2
    • fixed bug in TriggeredBlast state in ParticleEmitter.uc
    • added ParticleAnimationStorage.uc to store animation info (override strange bug with static array in an static array of structures).
    • added Force.uc actor to change particle velocity (affect only this particles that touches it)
    • new icons
  • v. 0.9.0.1
    • added new presets (UT2k4Fire/UT2k4Fire2)
    • few changes in ParticleEmitter.uc

Category:Legacy Mapping
Category:Legacy Custom Class (UT) \\