Author Topic: Surface shields.  (Read 12246 times)

0 Members and 1 Guest are viewing this topic.

Diff, release build, debug build, test mod.

This is a reimplementation of the old "surface shields" feature I wrote back in the day. This code is not currently in the CVS repository. This allows a ship without a shield mesh to have a shield. Shots that strike the hull of a surface-shielded ship will simply disappear and do damage to its shields rather than the hull, as though they struck a shield mesh instead of the hull.

Note that there is no graphical impact effect for surface shields. Some types of shots (laserish weapons, like the Subach HL-7) will simply disappear when striking a surface shield, while others (missiles, beams) will make an explosion effect.

This patch also gives an implicit surface shield to ships with a normal shield (i.e. the kind with a shield mesh). This is to work around a very mysterious bug in which shots will sometimes pass right through the shield mesh when they shouldn't (because the shield is up and should have absorbed it). Shots that pass through the shield mesh like this will strike the surface shield instead of damaging the hull (unless the shield is depleted, obviously).

The implicit surface shield could conceivably pose a compatibility issue because this means you can't fly through a shield mesh and fire at a ship's hull from inside its own shield. Your shots will then strike the implicit surface shield instead of its hull. In order for this to matter, you would have to have a shield mesh big enough that you can fit a fighter inside of it. As far as I know, nobody has ever done this. For this reason, I do not believe this is a problem. If the purity police demand it, though, the implicit surface shield can be removed.

To test surface shields, load up the included test mod in one of the test builds. In the tech room mission simulator, run the single mission "Surface Shield Test". You'll be put in a Bakha (because I like Bakhas :D) with four different ships that will just sit still. They are a Cain (modified to have a surface shield), a Rakshasa (with no shield), a Seraphim (with a normal shield), and a Mjolnir (which is specified to have shields in the table but has no shield mesh -- a :v: oversight that causes it to have no shield in the retail game, and it does not have a surface shield only because the "surface shields" flag is not present in ships.tbl). Use the change primary weapon type cheat (type "www.freespace2.com" while in game to enable cheats, then hit 0 while holding down ~ repeatedly to change your primary weapon) to change your primary to SRed, which I've changed to be relatively weak and not shield-piercing. You can use it to test how the surface shields work with non-shield-piercing beams. Beams that do pierce shields, like LRed, are not affected by surface shields at all, and you can test them this way too.

Please post comments. If everyone approves, I will commit this to CVS.

Added to the website.//redmenace
« Last Edit: February 10, 2005, 12:50:11 am by 887 »

 

Offline Lynx

  • 211
Cool, just what we needed!:yes:
Give a man fire and he'll be warm for a day, but set fire to him and he'll be warm for the rest of his life.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
if you've got everything other than rendering sorted out I could probly get that working.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Black Wolf

  • Twisted Infinities
  • 212
  • Hey! You! Get off-a my cloud!
    • Visit the TI homepage!
Awesome :) If this gets CVSed, TI will be making use of it - it works exactly how we described Aesir shield tech. :yes:
TWISTED INFINITIES · SECTORGAME· FRONTLINES
Rarely Updated P3D.
Burn the heretic who killed F2S! Burn him, burn him!!- GalEmp

 

Offline Fury

  • The Curmudgeon
  • 213
This will be optional feature, right?
Since TBP fighters do use shields but without shield mesh, only to protect against shockwaves and explosions.

 

Offline Lynx

  • 211
Just replace the shield hit sound and anim with an empty file.
Give a man fire and he'll be warm for a day, but set fire to him and he'll be warm for the rest of his life.

 
Quote
Originally posted by Mr. Fury
This will be optional feature, right?
Since TBP fighters do use shields but without shield mesh, only to protect against shockwaves and explosions.

Yes. Use ships.tbl flag "surface shields" to enable, otherwise uses normal behavior, which is a bit quirky, but whatever hacks you come up with will still work, with the exception that you cannot fly inside a ship's shield mesh and hit its hull from under its shields.

Is this okay? Should I commit it?

 

Offline Lynx

  • 211
Yeah, please commit it. WCS is in dire need of it, and it wouldn't hurt TBP either as far as I see.
Give a man fire and he'll be warm for a day, but set fire to him and he'll be warm for the rest of his life.

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
It's AWESOME, i could include my X wing model without assigning shield into the model :D

 
Surface shields have been committed to CVS.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
hey could you do me a favor, make a stub function called add_surface_shield_hit(ship* shipp, vector *position, matrix*orientation, float radius, int life) and call it with the apropriate data when ever your system is used, I'll build a rendering system next time I update my code, unless someone beats me to it

and for everyone else, is it ok if the texture is defined on a per ship basis as a static bitmap (ie not an ani but a single texture that fades out)? it will make things _vastly_ easier and faster to the point that I don't think it's realy it
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 
Okay, looking at the code I have...

Basically the function you're asking for would be something like add_shield_point but for surface shields.

I can give you a ship *. Straightforward.

The position and orientation will come out of an mc_info struct, as is the case for add_shield_point. Is that okay?

I don't know what to give you for radius and life. add_shield_point has no such thing. What should I do here?

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
add something to the weapon table entry or use some procedural code (like the head radius)
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline ShadowWolf_IH

  • A Real POF Guy
  • 211
    • CoW
wasn't someone asking for a way to simulate the grav wells in the New Jedi Order books?  this may very well be a viable solution.
You can't take the sky from me.  Can't take that from me.

Casualties of War

 
Quote
Originally posted by Bobboau
add something to the weapon table entry or use some procedural code (like the head radius)
The head radius is only present on laser-like weapons. Other weapons will not necessarily have surface shield specific parameters in the table. Then what do we use?

Unless I'm mistaken, normal shields use a hit effect with a fixed life and radius. Is there some reason we can't do the same thing for a surface shield hit effect?

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
is there a way to make the decal render slightly off the hull so that it looks like its hitting an imaginary forcefield.
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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
yeah, well I  want to do this new system diferently
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 
Okay, then, but we still have a compatibility issue. What do we do when no radius / life parameters are given in the table?

And are you sure it's okay that surface shield hit effects will look so different from normal shield hit effects?

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
yeah

well... ok for missles use the models radius
model_get(a_wepon_pointer->modelnum_or_whatever_the_variable_was)->rad

make a default life of /*pulls number out of ass*/ 1100 (ms)

this is basicly a totaly new effect so it can be done however I/you/we like. and for the problem with going under another ship's sheild if youu are looking for a way to get around this simply do a check to see if the polymodels sheild mesh has any triangles if it does then don't use surface shields
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 
Actually it's set to give surface shields to all ships that either specify it in the table or do have a shield mesh, in order to fix the mysterious bug I described above. So if somebody yells about this, I can just change it so that it won't give a surface shield to ships just because they have a shield mesh.