Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Galemp on May 22, 2008, 09:07:17 pm

Title: Shivan Comm Node particle spew
Post by: Galemp on May 22, 2008, 09:07:17 pm
When the Shivan Comm Node is in its death throes, it spews out a LOT of big fluffy particles. I've looked at the model and at the table and I can't figure out where this effect is coming from. Does anyone have any idea how it was implemented, and if we can reproduce it in other models?
Title: Re: Shivan Comm Node particle spew
Post by: Vasudan Admiral on May 22, 2008, 09:38:17 pm
According to the wiki:
"the mission designer progammed the CommNode to self-destruct when the crystal is destroyed; this is not a hard-coded feature."

Self destruct causes the crazy particle spew AFAIK.
Title: Re: Shivan Comm Node particle spew
Post by: Goober5000 on May 22, 2008, 10:25:31 pm
I assume it's because it's got the "knossos" flag.  IIRC, the only function for this flag is to change the explosion behavior.

EDIT: Okay, having just searched in the code base, I take that back.  One of the functions is to change the explosion.  The other (naturally) is to handle special warpin/warpout.

But here's the code you're probably looking for:
Code: [Select]
// create little fireballs for knossos as it dies
if (knossos_ship) {
if ( timestamp_elapsed(shipp->next_fireball)) {
vec3d rand_vec, outpnt; // [0-.7 rad] in plane
vm_vec_rand_vec_quick(&rand_vec);
float scale = -vm_vec_dotprod(&objp->orient.vec.fvec, &rand_vec) * (0.9f + 0.2f * frand());
vm_vec_scale_add2(&rand_vec, &objp->orient.vec.fvec, scale);
vm_vec_normalize_quick(&rand_vec);
scale = objp->radius * frand() * 0.717f;
vm_vec_scale(&rand_vec, scale);
vm_vec_add(&outpnt, &objp->pos, &rand_vec);

float rad = objp->radius*0.2f;
int fireball_type = FIREBALL_EXPLOSION_LARGE1 + rand()%FIREBALL_NUM_LARGE_EXPLOSIONS;
fireball_create( &outpnt, fireball_type, OBJ_INDEX(objp), rad, 0, &objp->phys_info.vel );
// start the next fireball up in the next 50 - 200 ms (2-3 per frame)
shipp->next_fireball = timestamp_rand(333,500);

// emit particles
particle_emitter pe;

pe.num_low = 15; // Lowest number of particles to create
pe.num_high = 30; // Highest number of particles to create
pe.pos = outpnt; // Where the particles emit from
pe.vel = objp->phys_info.vel; // Initial velocity of all the particles
pe.min_life = 2.0f; // How long the particles live
pe.max_life = 12.0f; // How long the particles live
pe.normal = objp->orient.vec.uvec; // What normal the particle emit around
pe.normal_variance = 2.0f; // How close they stick to that normal 0=on normal, 1=180, 2=360 degree
pe.min_vel = 50.0f;
pe.max_vel = 350.0f;
pe.min_rad = 30.0f; // * objp->radius;
pe.max_rad = 100.0f; // * objp->radius;
particle_emit( &pe, PARTICLE_SMOKE2, 0, 50 );

// do sound - maybe start a random sound, if it has played far enough.
do_sub_expl_sound(objp->radius, &outpnt, shipp->sub_expl_sound_handle);
}
}
Title: Re: Shivan Comm Node particle spew
Post by: blowfish on May 22, 2008, 10:27:56 pm
IIRC, the only function for this flag is to change the explosion behavior.

It also sets the deathroll time.
Title: Re: Shivan Comm Node particle spew
Post by: Goober5000 on May 22, 2008, 10:31:23 pm
It also sets the deathroll time.
That kind of falls under the "explosion behavior" concept, doesn't it? :p
Title: Re: Shivan Comm Node particle spew
Post by: blowfish on May 22, 2008, 10:51:27 pm
I guess so...
Title: Re: Shivan Comm Node particle spew
Post by: Nuke on May 23, 2008, 01:05:01 am
id love to add particle spewers as part of the glowpoint code. set glowpoint to type 2 and set pspew in the ship table and it would use the glowpoint position/normal as the spew point. then you can turn them on and off with sexps.
Title: Re: Shivan Comm Node particle spew
Post by: Wanderer on May 23, 2008, 01:13:22 am
Couldn't you just script them?
Title: Re: Shivan Comm Node particle spew
Post by: Nuke on May 23, 2008, 02:50:24 am
yea, probably. but doing it in c you could do it with greater speed, and i find that sometimes when dealing with particles you need all the speed you can get.
Title: Re: Shivan Comm Node particle spew
Post by: shiv on May 24, 2008, 12:26:55 pm
I have a nice idea. SCP Team could code table-defined explosions so in tables so user could define explosions (like particle spew and particle animation) in tables. Also other things like particle smoke (when ship's damaged) would be definable.
Title: Re: Shivan Comm Node particle spew
Post by: blowfish on May 24, 2008, 12:33:53 pm
Good luck getting that to happen anytime soon...
Title: Re: Shivan Comm Node particle spew
Post by: Galemp on May 24, 2008, 01:20:41 pm
I have a nice idea.

Ideas are cheap. Give 'em an actual way to make it happen and put some effort into it.
Title: Re: Shivan Comm Node particle spew
Post by: Mobius on May 24, 2008, 01:49:12 pm
Well if the changes are limited and simple we could see a test build in no time, right? :D
Title: Re: Shivan Comm Node particle spew
Post by: blowfish on May 24, 2008, 01:50:10 pm
Well if the changes are limited and simple we could see a test build in no time, right? :D

Learn to code before you make assumptions like that :rolleyes:
Title: Re: Shivan Comm Node particle spew
Post by: Mobius on May 24, 2008, 01:52:57 pm
I can't code but changes like this are obviously easier to do than many others...just look at the requests...