Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 253 254 [255] 256 257 ... 710

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1718977 times)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3810 on: March 30, 2018, 11:16:10 AM »

Mono is required because that's how things work - OpenAL takes a mono sound effect and makes it stereo with channel balance etc based on its location relative to the listener. Stereo effects play "as is", i.e. they aren't directional; all UI effects - such as button presses etc - are stereo.

As far as the bitrate, you just want the lowest to where the quality doesn't suffer. A higher bitrate means more ram and loading time, both in significant amounts.
Logged

Solinarius

  • Lieutenant
  • **
  • Posts: 97
  • Wind. Fire. All that kind of thing!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3811 on: March 30, 2018, 11:37:41 AM »

Good grief! Thanks for the quick response!

I think I only just noticed the SFX in question was mono. I've been using a few dozen SFX replacers that are stereo. I decided to give the Tac Laser an activation sound (which is very brief), but once I did that, SFX would mute erratically in battles of moderate size or greater. Sound channels full or is that a problem with stereo SFX? I only ask because I can't test it right now.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3812 on: March 30, 2018, 11:50:54 AM »

That's a bit weird, I'm not sure why they'd mute. UI channels are more limited, but IIRC these would still play on FX channels, despite being stereo.

But they won't work well either way - if they're stereo, they will not be directional. That is to say, if a tac laser fires from the right, it won't sound any different than when it fires from the left. You'll just always get the un-altered stereo sound playing back if the effect is a stereo sound.
Logged

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3813 on: March 31, 2018, 02:49:56 PM »

Hopefully a quick one that's been annoying me for a little while.

I had a concept for a hullmod for certain custom ships (ie. as a built-in mod) that affects the Combat Readiness lost when you attempt to refit a ship outside of a station or planet's dry dock. The basic idea was a "Mobile Refitting Equipment" or similarly named mod, which slightly reduces the amount of CR lost when you refit a ship in deep space - the practical role of such a ship and hullmod being for those players doing a lot of exploration and ship recovery interspersed with frequent fighting in the outworlds or just around the Core Systems.

Can anyone point me to where I might find files that relate to the Combat Readiness loss due to refitting outside of a dock? Or if such code is in fact obfuscated and unable to be tampered with?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3814 on: April 01, 2018, 09:35:33 AM »

There are settings to control this globally in settings.json, but there's nothing per-ship. You might be able to script it somehow, though.

"crLossMultForRefit":1,
"crLossMultForRefitWeapons":2,
"crLossMultForRefitHullmods":4,
Logged

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3815 on: April 01, 2018, 02:50:08 PM »

There are settings to control this globally in settings.json, but there's nothing per-ship. You might be able to script it somehow, though.

"crLossMultForRefit":1,
"crLossMultForRefitWeapons":2,
"crLossMultForRefitHullmods":4,

Interesting. My scripting capabilities are extremely limited, but I'll see what I can do with that.  ;) Thanks!
Logged

Blothorn

  • Commander
  • ***
  • Posts: 116
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3816 on: April 02, 2018, 03:29:43 PM »

I noticed that some modded ship system scripts keep instance data (e.g. ship location when the system was activated) as non-static class variables, but the vanilla scripts have only static variables and use CustomData for instance data. Can I rely on a 1:1 mapping of ships to ship system scripts, or are they re-used across ships/recreated for one ship?

(And if non-static data is not safe, is there a reason the methods are not static?)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3817 on: April 02, 2018, 03:35:09 PM »

Looking at the code, I'm fairly sure you can - a new instance of the script class gets created for each ship system instance. Vanilla stuff uses CustomData because, iirc, there used to only be a single shared instance of each script some time ago.

Static variables are only used for constant values; it would not be at all safe to use them to hold data that changes.

Note that this does *not* apply to hullmods - for those, there is only one instance of each script.
Logged

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3818 on: April 07, 2018, 02:04:58 AM »

Static variables are only used for constant values; it would not be at all safe to use them to hold data that changes.

May I ask why? I have several times utilized changing Static values, as Static (should) only indicates that all instances of a class share the variable value. Are you referring to "Final", or am I missing something here?

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3819 on: April 07, 2018, 02:29:04 AM »

Oh and sorry for double posting, but I had an unrelated question regarding fighters in the refit screen:

I'm trying to make a hullmod (on a fighter) which changes effect depending on the ship it is mounted on. Is there any way to, in the refit screen, get
   A: The fighter's associated ship?
   B: The fighter's associated wing?
   C: The fighter's associated fleet?

ShipAPI.getWing returns null, which means that A and B seem impossible to me, but i have not found any function to get C working. Am i missing a function, or is there simply no way for a fighter to know which ship it is mounted on before entering combat? It should be noted that the opposite does not seem to work, either (ShipAPI.getAllWings returns an empty list, so the carrier seems unaware of the fighters it carries until it enters battle).

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3820 on: April 07, 2018, 08:43:32 AM »

Static variables are only used for constant values; it would not be at all safe to use them to hold data that changes.

May I ask why? I have several times utilized changing Static values, as Static (should) only indicates that all instances of a class share the variable value. Are you referring to "Final", or am I missing something here?

Right, you're (naturally) correct about how static variables work. Where it gets really iffy is when you combine that with state transitions and/or loading a new game. Say you have a hullmod and a static variable, I don't know, holds a list of ships that are currently under the effect of that hullmod's... some kind of AoE field. And you're doing this as a way make sure that multiple AoEs don't affect the same ship.

So that's all well and good, but when you exit combat, that list is still around, unless you make sure to clean it up, and the elements in it may point to the combat engine /and/ to the campaign engine. So, that's one combat engine leak right there. Then you load a new game. That list is *still* around, and points to the old game engine, preventing it from being GC'ed. That's an even more severe leak of one campaign engine instance.

Less problematic issues are non-leaking bugs of the same variety, i.e. a counter or some such that doesn't get reset when another savegame is loaded, that sort of thing.

You certainly /can/ use changing static variables safely. It's just often a bit of a pain and it seems easier to use combat/campaign.getCustomData() which means you don't need to worry about these kinds of scoping issues.


Oh and sorry for double posting, but I had an unrelated question regarding fighters in the refit screen:

I'm trying to make a hullmod (on a fighter) which changes effect depending on the ship it is mounted on. Is there any way to, in the refit screen, get
   A: The fighter's associated ship?
   B: The fighter's associated wing?
   C: The fighter's associated fleet?

ShipAPI.getWing returns null, which means that A and B seem impossible to me, but i have not found any function to get C working. Am i missing a function, or is there simply no way for a fighter to know which ship it is mounted on before entering combat? It should be noted that the opposite does not seem to work, either (ShipAPI.getAllWings returns an empty list, so the carrier seems unaware of the fighters it carries until it enters battle).

Hmm, I think you're out of luck on this one - the fighters, as far as I recall, don't exist in the refit screen. I couldn't tell you if their hullmods even get their apply() method called - if they do, it's more of a "side effect" than a feature you can rely on continuing to exist.
Logged

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3821 on: April 07, 2018, 09:59:55 AM »

Hmm, I think you're out of luck on this one - the fighters, as far as I recall, don't exist in the refit screen. I couldn't tell you if their hullmods even get their apply() method called - if they do, it's more of a "side effect" than a feature you can rely on continuing to exist.

Interesting: they definitely get apply() called, and you can actually modify their Variants while in the refit screen: i was just looking for a way to do that dependant on the main ship. But OK, that's not intended behaviour; i'll have to find another way.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3822 on: April 07, 2018, 10:05:19 AM »

Ah - it probably creates a fighter as part of the rendering process. I /think/ it just creates one and renders it a bunch of times instead of creating one for every fighter in the wing, but yeah, that's (probably) not hooked up to the source ship etc; it's not even trying to replicate that data structure etc.
Logged

MajorTheRed

  • Captain
  • ****
  • Posts: 289
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3823 on: April 10, 2018, 08:58:23 AM »

Quick question : what determine if a ship is available within a civilian market or a military market, as well as the level of commission needed? Is it its tag (civilian, carrier...)? Or based on a calculation of some of its caracteristics? Or its use in the faction file?
For example, in Disassemble Reassemble mod, the Taurus gunship (combat frigate, no tag, 1 medium and 4 small mounts) is sometime to buy in standard market.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3824 on: April 10, 2018, 09:06:38 AM »

... you know, I don't actually remember, and that code is different in the in-dev version. I think it's 5 fp or less and a frigate = can be found in the open market, but I also think there's some other restriction in terms of what "shipRole" it's found in, as defined in the .faction file.
Logged
Pages: 1 ... 253 254 [255] 256 257 ... 710