Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Nighteyes on September 17, 2009, 08:30:12 am

Title: Weapons.tbl bug?
Post by: Nighteyes on September 17, 2009, 08:30:12 am
$Pspew:
# +Time:

    * Defines the time in milliseconds between next particle(s) spewed
    * Syntax: Integer, milliseconds


this value won't go lower then 1... it can be nice if we could have even lower numbers here, since then we can use it to make denser particle spawns... especially for heavy artillery railgun type of weapons... right now at the lowest number of 1 you actually see the individual "blobs" and the only way to close these gaps is by making the actual effect bigger(that dosn't look good when a small ship is firing that weapon...)
Title: Re: Weapons.tbl bug?
Post by: portej05 on September 17, 2009, 08:56:23 am
This is a hard limitation of the engine, and is unlikely to change soon.
(it's based on an internal timer with not massive resolution).


Sorry!
Title: Re: Weapons.tbl bug?
Post by: Aardwolf on September 17, 2009, 10:27:17 am
Could it not be improved by, say, something like this:

Quote from: pseudocode by Aardwolf
newphase = phase + timestep * frequency

Where newphase is a local variable, probably the same type as phase, a member variable of the particle emitter, where timestep is the amount of time that has passed since the last physics update step, and where frequency is the number of particles emitted per second.

steps = floor(newphase) - floor(phase)

Where steps is a local integer variable.

oldpos = pos
pos = somefunc(oldpos)
...

That is, compute the new position (pos, but don't throw away the old position (oldpos) just yet.

for each integer i on the range (phase, newphase]
{
        frac = (i - phase) / (newphase - phase)
        ppos = oldpos * (1 - frac) + frac * pos
        emit_particle_at_pos(ppos)
}


Where emit_particle_at_pos is a stand-in for the particle emission call, using the argument ppos as the position of the emitted aprticle. Note that i may be equal to newphase, but cannot be equal to phase, thus ensuring that particles don't get emitted twice.

phase = newphase

Last but not least, update the phase.

If I've thought this through right, it would appear to evenly time the emission of the particles. However, using this technique might cause rapidly increasing numbers of particles, which could be bad for framerates.

The technique could also be fairly easily modified to create evenly spaced particles, id est the distance between each particle, rather than the time, would be equal.
Title: Re: Weapons.tbl bug?
Post by: Nighteyes on September 17, 2009, 01:23:59 pm
Aardwolf I don't really get you'r post... you mean there is a way to get the same effect in another methode?
Why is there a hard limit on this thing? why isn't it up to the modder to make sure its not breaking any limits?
Title: Re: Weapons.tbl bug?
Post by: Aardwolf on September 17, 2009, 05:54:14 pm
Nonono, I was just making a feature suggestion for the SCP guys, and providing a bit of "here's how" info.