Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: New Collision Class  (Read 2164 times)

Morrokain

  • Admiral
  • *****
  • Posts: 1595
  • Megalith Dreadnought - Archean Order
    • View Profile
New Collision Class
« on: September 19, 2014, 06:49:18 PM »

I would like:
Code
collisionClass: "SHIPS_AND_ASTEROIDS_no_FF"

Essentially a way for a projectile or beam to ignore enemy fighters and only be able to hit ships and asteroids without automatically damaging your own ship.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: New Collision Class
« Reply #1 on: September 19, 2014, 09:19:13 PM »

Ahh, unfortunately, adding new collision classes is surprisingly problematic.
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: New Collision Class
« Reply #2 on: September 20, 2014, 02:36:01 AM »

But if your name is Alex, ANYTHING is possible!
Logged

MesoTroniK

  • Admiral
  • *****
  • Posts: 1612
  • I am going to destroy your ships
    • View Profile
Re: New Collision Class
« Reply #3 on: September 20, 2014, 02:51:42 AM »

It can be done by scripting the projectile in its entirety, although that is not an ideal solution.

Morrokain

  • Admiral
  • *****
  • Posts: 1595
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: New Collision Class
« Reply #4 on: September 22, 2014, 12:45:41 PM »

Ahh, unfortunately, adding new collision classes is surprisingly problematic.

Darn.  >:( I was hoping it would be fairly easy to just take enemy fighters out of the projectile class and just call it a new id. Programming never seems that simple though lol. Should of known. What is problematic about it? Just hard to do/time consuming or does it require changing the way the base game works?

It can be done by scripting the projectile in its entirety, although that is not an ideal solution.

Since almost every single weapon projectile would need this in my mod.. I feel like it would be a huge strain to the cpu if i could even manage to do it.
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: New Collision Class
« Reply #5 on: September 22, 2014, 03:28:17 PM »

Hey Morrokain, it's not a huge strain on the system in practise, I have a far more complex collision detection/ smart flak fuse system than what you're calling for and it works fine. Honestly you'd only need to write the script once.

Basically you shoot only NO COLLISION class projectiles, every frame you filter out your projectiles.

Do a check against nearby entities using lazylib, make sure it isn't the source ship. If it's any other ship or an asteroid entity, apply damage to the intersection point using lazy lib.

Done, fairly straight forward, you could knock out that script in half an hour or so.

All that said I probably wouldn't recommend it, as everyone else uses the same collision classes, and this keeps the game balanced and fair
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: New Collision Class
« Reply #6 on: September 22, 2014, 08:01:18 PM »

Ahh, unfortunately, adding new collision classes is surprisingly problematic.

Darn.  >:( I was hoping it would be fairly easy to just take enemy fighters out of the projectile class and just call it a new id. Programming never seems that simple though lol. Should of known. What is problematic about it? Just hard to do/time consuming or does it require changing the way the base game works?

Well... each new collision class increases the complexity of the *code* setting up the collision handlers quadratically. Which isn't that bad, really - not with the current number of classes - but it's also not something I want to mess with for something not used by vanilla. It's also a case of being pretty confident I wouldn't be able to test the code thoroughly and make sure it stays working w/o having a vanilla use case.
Logged