Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: API for events in combat?  (Read 2577 times)

Ava_N

  • Ensign
  • *
  • Posts: 3
    • View Profile
API for events in combat?
« on: September 27, 2017, 07:26:17 PM »

Hi forum people!

Is there an API or library that gives access to combat events? Things like "ship got new target", "ship fired missile", "ship destroyed", etc. I was trying to add more events to Combat Chatter, and there seems to be no easy way of doing it.
 I've also looked at the source for a few other mods that have things trigger on combat stuff (Combat Alarms and Combat Analytics). Looks like everyone is saving values they want every frame and checking them the next frame to catch the edge signal.

So I'm guessing the answer is probably "no", but it doesn't hurt to ask.

If the answer is in fact "no", would people be interested in a library that made this easy?
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: API for events in combat?
« Reply #1 on: September 28, 2017, 05:26:33 AM »

A library does sound helpful.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: API for events in combat?
« Reply #2 on: October 03, 2017, 12:00:45 AM »

I certainly would. +1
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: API for events in combat?
« Reply #3 on: October 03, 2017, 12:39:33 PM »

The simple answer is, there are a bunch of things that can't even be detected right now, because the game loop doesn't allow access to them without such a library. 

For example, it's unclear when, exactly, a ProjectileAPI has done damage, unless you check that last frame, didDamage() was false, because it keeps returning true even though the game engine has applied the damage and the projectile's now fading out.  So we have to track the projectiles that did damage this frame manually.

And there's no common way to detect if we use the built-in damage functions, either.  If that existed, it would be useful. 

But getting modders here to adopt that universally is asking a lot, unfortunately, and it's not really worth using unless it's universally adopted.  So I'd probably build something like this and pitch for it to be included in LazyLib, since that's the only semi-mandatory code repo that the modders here are willing to adopt in large numbers :)
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Ava_N

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: API for events in combat?
« Reply #4 on: October 03, 2017, 09:34:06 PM »

So I'd probably build something like this and pitch for it to be included in LazyLib, since that's the only semi-mandatory code repo that the modders here are willing to adopt in large numbers :)

Good point, it's also easier for end-users to install one thing instead of five different things.
Logged