Author Topic: Weapons.tbl bug?  (Read 1528 times)

0 Members and 1 Guest are viewing this topic.

Offline Nighteyes

  • 211
$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...)

 
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!
STRONGTEA. Why can't the x86 be sane?

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
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.
« Last Edit: September 17, 2009, 10:32:40 am by Aardwolf »

 

Offline Nighteyes

  • 211
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?

  

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Nonono, I was just making a feature suggestion for the SCP guys, and providing a bit of "here's how" info.