Author Topic: Requests concerning explosions and impact effects  (Read 4219 times)

0 Members and 1 Guest are viewing this topic.

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Requests concerning explosions and impact effects
Well (IMO & IIRC) position is just the starting position of the particle and velocity only moves it so its 'sort of relative'.. So do not add the position to the velocity.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline IPAndrews

  • Disgruntled Customer
  • 212
  • This site stole my work
Re: Requests concerning explosions and impact effects
Do we have to do everything by scripts now? What about making TBP's shadow ships bleed black blood when they're shot instead of those glowing firey bits?
Be warned: This site's admins stole 100s of hours of my work. They will do it to you.

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Requests concerning explosions and impact effects
and why does lua crash when you try to multiply vectors?
Dunno this one.. i have changed all my vector multiplications into divisions (a * vec == vec / (1 / a) ). Its real pita like the 'plr' issue is from time to time.

Do we have to do everything by scripts now? What about making TBP's shadow ships bleed black blood when they're shot instead of those glowing firey bits?
Scripts are usefull when there is no code support for certain features like animated (2D-bitmap)  secondaries or flaks or othersome such things. So we can sort of expand the game a bit in certain areas with scripts.

Making shadow ships bleed black blood isnt that simple (for me atleast)... As i'm not sure that i can get the hit position with 100 % accuracy using current variables and functions. However we can disable the normal spewed particles (firey bits)... Replacing those it not so simple...

http://www.hard-light.net/wiki/index.php/Ships.tbl#.24Impact_Spew:
http://www.hard-light.net/wiki/index.php/Ships.tbl#.24Damage_Spew:
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Requests concerning explosions and impact effects
i finally realised why my thing didnt work, when i had the particles spawned with a loop i just set their positions relitative to the objects coords (cause it was linked), but now im just using the wepons position and velocity , which are in world coordinates. because its in world coordinates it will no longer accept my fairly 2d coords, while looking right at the same time. the effect would appear correct when you fire it right down the world z axis. but if you durn and fire it in an arbitrary axis it would look whack. so i just need to generate my effect and rotate the coords so that theyre along the axis of motion. i could use a crash corse in 3d vector math. anyone know an online resource, something with code examples. ive looked but most the sites i found werent very helpfull or confused me completely, or had notation that i just couldnt comprehend.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Requests concerning explosions and impact effects
create a vector that defines the rotation and then use weapon.Orientation:unrotateVector(vector)
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Requests concerning explosions and impact effects
hey thanks that works now. still needs some tweaking. throwing out a particle every frame still doesnt make enough of them for the ffect to look good. gotta use smaller particles, more of them, and more than a few per frame.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Requests concerning explosions and impact effects
ok this is crude, but cool. its for my mod but i tweaked it to work with a maxim. use the attached jpeg texture, because the game doiesnt have one that looks good with the effect.

Code: [Select]
#Global Hooks

$GameInit:

[

hypacstex = gr.loadTexture("hypacs")
nullvec = ma.newVector(0,0,0)

]

$Simulation:

[

ft = ba.getFrametime()

for i=1, mn.getNumWeapons() do
weapon = mn.getWeaponByIndex(i)
local name = weapon.Class.Name
if name == "Maxim" then
for i=1, 20 do
local vel = weapon.Orientation:unrotateVector(ma.newVector(math.sin(i*18*0.01745)*0.5,math.cos(i*18*0.01745)*0.5,100))
local zadd = weapon.Orientation:unrotateVector(ma.newVector(0,0,i*1.6-1))
ts.createParticle(weapon.Position+zadd,vel,2,0.4,"Bitmap",-1,false,hypacstex)
end
end
end

]

#End

anyway its a crude rip of the q2 railgun effect. its slow and not quite smooth. what i want to know is if the effect can done in c code (better than mine of course). it could fairly easily be added as an option for particle spew as it can run on the same basic parameters. maybe add a new $type: paramater as an option to the existing particle spew where you can specify string valuse for optional effects, like this spiral and maybe others as well. it could use the same $count: $time: $velocity: $radius: $life: and $bitmap: parameters. $scale, which usually determines the scatter of particles, could designate the radius of the spiral. perhaps other special paramaters, such as $helix length: could designate how long a full 360 is. plus it could set the groundwork for additional pspew types.

*edit* added my texture cause the maxim one makes my effect suck. btw why cant we attach dds files?

[attachment deleted by admin]
« Last Edit: July 30, 2006, 07:41:46 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Requests concerning explosions and impact effects
Hey...

Code: [Select]
for i=1, mn.getNumWeapons() do
...
      for i=1, 20 do
...
Are you sure that works (as it should, that is)? I would swap the second i to j or something.. I had troubles earlier with a bit similar script
Do not meddle in the affairs of coders for they are soggy and hard to light

  

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Requests concerning explosions and impact effects
i assumed that variables defined on a for or function line are considered local. and it would apear so in this case, as the effect looks the same whether i replace all the is in the second for with js or not. i like the effect, but it doesnt look dence enough without running a loop every frame to create a few particles, of course then you get that stuttering you see if you use the effect at anything other than 60 fps (and it will slice it in half with use). the q2 railgun just ran a single loop to generate all the particles in one pass, as it was pretty much an insti hit weapon. my script actually spawns a helix segment at each frame, and im still trying to figure out how to properly scale it to match the space covered by the weapon during the frame (wepon speed * ba.frametime()) unfortunately all i managed to do is get the effect to look even more whack. even if they are scaled correctly im defining there velocity not their position so the segments seldom lign up. but no mater what i do it causes anything from a minor stutter to a complete slowdows. i cant make the effect playable wi6thout severly sucking the life out of the game. i think if the code was handeled in c, it could be done without severely crippling the performance.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN