CSimpleParticleSystem(tests, sample code when it works) - Page 3

CSimpleParticleSystem(tests, sample code when it works)

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Yeha
Posts: 96
Joined: 13 Aug 2004, 19:12

Post by Yeha »

Gravity is fixed.

DelaySpawner is an explosion type that spawns a new explosiongenerator after a specified time, used like any other explosion types like this.

Code: Select all

	[DelaySpawner]
	{
		[properties]
		{
			delay=30;
			explosionGenerator=custom:NewExplosionGenerator;

		}
		water=1;
		air=1;
		ground=1;
		count=1;	
	}
This will create the explosion "NewExplosionGenerator" after 30 frames.


[KnoX]ElementalGizmo:
For the custom explosion generator and the effects it can use you can find some info in the wiki here:
http://taspring.clan-sy.com/wiki/Custom ... Generators
it's a work in progress though so it isn't fully updated on all the explosion types.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Ok... but what if I don't want the explosion to occur until 30 frames, period? Is there any way to do that, short of COB scripting? If I have to do it via COB, that will work, but it'll be bloody inflexible and hard to maintain.

The reason I'm asking is because I want to code things with specific event timing- first do A, then do B, then do C. Not do ABC, then re-do B. If that makes any sense :-)
Yeha
Posts: 96
Joined: 13 Aug 2004, 19:12

Post by Yeha »

That would be something like this:

Code: Select all

[InitialExplosion] //this is the explosion that get called when the event happens
{
	[DelaySpawner]
	{
		[properties]
		{
			delay=10
			explosionGenerator=custom:A;
		}
	}
	[DelaySpawner]
	{
		[properties]
		{
			delay=20
			explosionGenerator=custom:B;
		}
	}
	[DelaySpawner]
	{
		[properties]
		{
			delay=30
			explosionGenerator=custom:C;
		}
	}
	//anything extra that should happen immidiately can go here
}

[A]
{
	//do 10 frame delayed stuff
	[SimpleParticleSystem]
	{
	...
	}
}

[B]
{
	//do 20 frame delayed stuff
}

[C]
{
	//do 30 frame delayed stuff
}
You can allso chain them by putting delayspawner for B in A and so on if you prefere.
Last edited by Yeha on 18 Nov 2006, 05:13, edited 2 times in total.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Oh... nevermind. I'm an idiot. It requires an explicit reference to another ExplosionGenerator file! So I basically just have to split up the Nuke a bit... okies... minor problem, easily solved...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

HOLY !*@*#!

I will now be able to make proper fire.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

DOUBLE HOLY !*@#*!*!

Just wait until you see this... omg... having a time-delay RULES. No more faking it with trickery, and far less code... Yeha, you just made FX 100% easier to work with. This rules.

It actually made CPU usage go DOWN, because the total number of FX being executed is apparantly lower... the new Nuke is prettier, yet even less laggy than before, even with the z-buffer sort.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Ok, here's a progress shot, before I need to go do some other stuff for awhile:

Image

As you can see, it's not perfect yet. I will probably have to add more particles to the smoke column, and I am still debating the colors a bit- dark smoke looks really cool, but it isn't (strictly speaking) very realistic. The dynamic color-map stuff looks really nice in this version, and the overall effect is very smooth from birth to death, so keep that in mind- while it's not perfect, it's far better than a still shot can show you.
Last edited by Argh on 18 Nov 2006, 08:45, edited 1 time in total.
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

Zomg drool
[KnoX]ElementalGizmo
XTA Developer
Posts: 266
Joined: 24 Aug 2006, 01:33

Post by [KnoX]ElementalGizmo »

OOOW thanks Yeha. Would be nice to see a picture with highlighted examples of which each script does, for those of us of a smaller IQ lol

Development is a beautiful thing :P
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

How well does that scale up, performance-wise?
Last edited by Kloot on 15 Dec 2007, 16:03, edited 1 time in total.
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Post by Noruas »

Image
How did you get the animation or FX to work on a unit, id like to make krogoth stompings and such, please enlighten me or show a link!

Oh, and i am also having problems with explosionspike and explosionsphere, says its not a class.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

@Kloot:

Scaling won't be as big of an issue as you'd think. The main problem will be the sheer number of particles, and/or the sizes required. I think you can do a very big Nuke without slowing FPS by a lot more than my version, but there is obviously a linear cost associated with each new particle system. The key is to keep that number as low as possible- adding new particles has a much lower cost overall, but obviously ain't free ;)

However, Spring wasn't really meant to display things on that scale very well, and I strongly suspect that it wouldn't be very practical to make a Giant Nuke using the methods I am here. Instead, I'd probably use a different technique to convincingly depict massive destruction- there are all sorts of visual techniques now available with the sheer variety we now have at our disposal.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Some sample code. Semi-realistic fire FX. Quick and dirty, but visually effective. Not truly "realistic" in some senses of the word, but serviceable, fast on framerate, and pretty. If I can get a superior texture done for this, then it should be fairly realistic while in motion. My current texture isn't quite cutting it.

Note how I'm basically making use of repeaters here, with time delays. I have found that doing so runs quite a bit faster than the alternatives (which were all kludgy anyhow). The framerate hit on this, even though it's being z-sorted, is quite low.

Just change the texture references (use circularthingy for the fire, one of the smokes for smoke, for example, or steal from NanoBlobs) and attach to an explosion to view:

Code: Select all

//////////////////////////////////////////////////////Argh's GPL Generic Fire Script
//////////////////////////////////////////////////////You may use this for any purpose, so long as you obey the terms of the Gnu Public License.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[KNIGHT_EXPLOSION_FX]
{
[particlesystem_KNIGHT_EXPLOSION_FX01]
	{
		class=CSimpleParticleSystem;
		[properties]
		{
		sizeGrowth=-0.01;
		sizeMod=1.0;
		pos=0, 1.0, 0;
		emitVector=0, 1, 0;
		gravity=0, -0.25, 0;
		colorMap=1.0 1.0 1.0 0.1     1.0 1.0 0.0 0.1     1.0 0.5 0.0 0.1      0.1 0.03 0.0 0.1;
		Texture=ConeFragments;
		airdrag=1.0;
		particleLife=60;
		particleLifeSpread=10;
		numParticles=30;
		particleSpeed=3;
		particleSpeedSpread=1;
		particleSize=2;
		particleSizeSpread=1;
		emitRot=0;
		emitRotSpread=90;
		directional=0;
		}
	air=1;
	water=1;
	ground=1;
	count=1;
	}
[delayspawner01_Knight_FireColumn]
	{
		class=CExpGenSpawner;
		[properties]
		{
		delay=0 i1;
		explosionGenerator=custom:KNIGHT_FIRE_COLUMN_01;
		}
	water=1;
	air=1;
	ground=1;
	count=120;
	}
[delayspawner01_Knight_SmokeColumn]
	{
		class=CExpGenSpawner;
		[properties]
		{
		delay=10 i1;
		explosionGenerator=custom:KNIGHT_SMOKE_COLUMN_01;
		}
	water=1;
	air=1;
	ground=1;
	count=120;
	}
[groundflash]
   	{
      	flashSize = 40;
      	flashAlpha = 0.9;
      	circleGrowth = 0.1;
      	circleAlpha = 0.3;
      	ttl = 260;
      	color = 1, 0.5, 0.15;
	air=1;
     	ground=1;
      	water=1;
	}
}


[KNIGHT_FIRE_COLUMN_01]
{
[particlesystem_FIRE_COLUMN_01_01]
	{
	class=CSphereParticleSpawner;
		[properties]
		{
		sizeGrowth=-0.05;
		sizeMod=1.0;
		pos=5 r-10, -5, 5 r-10;
		emitVector=0, 1, 0;
		gravity=0, 0.01, 0;
		colorMap=1.0 0.5 0.15 0.01     1.0 1.0 1.0 1.0     1.0 1.0 1.0 1.0      0 0 0 0.01;
		Texture=Fire;
		airdrag=1.0;
		particleLife=60;
		particleLifeSpread=10;
		numParticles=1;
		particleSpeed=0.000001;
		particleSpeedSpread=0;
		particleSize=5;
		particleSizeSpread=1;
		emitRot=0;
		emitRotSpread=0;
		directional=0;
		}
	air=1;
	water=1;
	ground=1;
	count=1;
	}
}

[KNIGHT_SMOKE_COLUMN_01]
{
[particlesystem_SMOKE_COLUMN_01_01]
	{
	class=CSphereParticleSpawner;
		[properties]
		{
		sizeGrowth=0.05 r0.1;
		sizeMod=1.0;
		pos=5 r-10, 15, 5 r-10;
		emitVector=0, 1, 0;
		gravity=0.003 r-0.006, 0.03, 0.003 r-0.006;
		colorMap=0.5 0.5 0.5 1.0     0.4 0.4 0.4 1.0    0.3 0.3 0.3 1.0    0.2 0.2 0.2 1.0    0 0 0 0.01;
		Texture=SmokeHeat_Alpha2;
		airdrag=1.0;
		particleLife=120;
		particleLifeSpread=10;
		numParticles=1;
		particleSpeed=0.000001;
		particleSpeedSpread=0;
		particleSize=2;
		particleSizeSpread=0.5;
		emitRot=0;
		emitRotSpread=0;
		directional=0;
		}
	air=1;
	water=1;
	ground=1;
	count=1;
	}
}

Slight edit... changed some timing and a few minor details.
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

Screenshots? Or even a short video? That would be great
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Too busy right now. The next version of NanoBlobs is "due" by tomorrow.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Argh wrote:Too busy right now. The next version of NanoBlobs is "due" by tomorrow.
Yay!
Post Reply

Return to “Engine”