Author Topic: SLDC: Shield Collision Tree, and you  (Read 3795 times)

0 Members and 1 Guest are viewing this topic.

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
SLDC: Shield Collision Tree, and you
I created a new chunk in POF CS2 - the Shield Collision Tree (SLDC chunk ID).  I just wrote, tested and commited FS2 engine support.

Some of you may have heard of this, some of you may have not - so I'll go through it.

When FS2 loads the SHLD (Shield) chunk it loads all the shield geometry into "Shield Info" but then it creates 8 octents (a shield triangle may appear in more than one).  When it's checking the shields of a ship it checks every shield triangle in each octent until it gets a collision.  So... best case scenario it has exactly the number of triangles to check (no duplicates).. worst case scenario it has duplicates and no hits....

inefficient.. slows down the entire game.


The SLDC chunk is a collision tree like that found in OBJ2's BSP data (infact PCS2 uses the same code to generate the trees, just different code to pack them into their appropriate data lists).  It should significantly improve performance in missions would many fighters.

All models saved with PCS2 that have a shield mesh will have an SLDC.
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Turambar

  • Determined to inflict his entire social circle on us
  • 210
  • You can't spell Manslaughter without laughter
Re: SLDC: Shield Collision Tree, and you
it's times like these i wish i had a hot chick i could command to flash her boobies at you.

seeing as i don't and my chest area is furry and generally unattractive, i'll just express gratitude and appreciation.

nice work Kaz.
10:55:48   TurambarBlade: i've been selecting my generals based on how much i like their hats
10:55:55   HerraTohtori: me too!
10:56:01   HerraTohtori: :D

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Re: SLDC: Shield Collision Tree, and you
 :lol:
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline blowfish

  • 211
  • Join the cult of KILL MY ROUTER!!!!!!!!!!1
Re: SLDC: Shield Collision Tree, and you
Cool!  How much of a performance boost can we expect from this?

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: SLDC: Shield Collision Tree, and you
What's the format of the chunk?  You didn't serialize it so it's not cross-platform.  A function needs to be added to byte-swap all of the elements, if needed, based on the platform.

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Re: SLDC: Shield Collision Tree, and you
bah good call taylor, sry.  it's intel order as normal - look for mc_sheck_sldc() which is where it's being walked and where you'd have to do byte-swaps (to temp vars obviously)

[edit]
if you have byte swaps in a macro just tell me the macro and i can do it

[edit]
think i found them

[edit more!]
ok.. i have INTEL_INT, INTEL_FLOAT, etc macros in place now... i am currently implementing a feature in the same section of the code so soon as i test it and see it's working ok i'll have the fix for this commited.
« Last Edit: February 11, 2008, 07:24:08 pm by Kazan »
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: SLDC: Shield Collision Tree, and you
The byte-swapping needs to be done on model load rather than in the mc function (byte-swapping isn't cheap, and should only ever be done once).  For an example of how it's done with the normal BSP data, have a look at swap_bsp_data() at the bottom of modelread.cpp.

  

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Re: SLDC: Shield Collision Tree, and you
The byte-swapping needs to be done on model load rather than in the mc function (byte-swapping isn't cheap, and should only ever be done once).  For an example of how it's done with the normal BSP data, have a look at swap_bsp_data() at the bottom of modelread.cpp.

i can do that.. revert the change i just made and do it that way :P
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir