Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Modding - Naming Format Control  (Read 5913 times)

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Modding - Naming Format Control
« on: July 05, 2011, 01:36:16 PM »

I think I suggested this somewhere else but it was under another thread, I decided to make it its own suggestion. I'd like more control over the ship strings. There's a couple different places where string data about the ship is composed for display, but each one is slightly different.

It would be fantastic if, for each of these instances, a mod could override the format for a given ship and display something else. Since certain formats are used in different places, there would really have to be several format strings and associated overrides.

Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23947
    • View Profile
Re: Modding - Naming Format Control
« Reply #1 on: July 05, 2011, 04:34:54 PM »

Hmm. I do see what you're saying, that would be quite useful for some mods *cough* SC2 *cough*.

This is the kind of thing that would make mods incompatible with each other, though. That's not a problem - some mods will have to be marked as "total conversions" and preclude other TC mods from being used, or something like that - but that's not in place yet.

The other part of it is the naming format is rather haphazard at the moment.

I think it's a good idea to expose this, just don't want to hack something in - will take a closer look at it when re-organizing some of this stuff.
Logged

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Modding - Naming Format Control
« Reply #2 on: July 05, 2011, 05:09:53 PM »

This is the kind of thing that would make mods incompatible with each other, though.

Not exactly. Conflicts really are an issue, so the way I saw this working was in the form of Mission API overrides. For each ship you add to a fleet in the mission plugin code, you could optionally specify overrides for any of those strings. I think this way would be minimally intrusive and shouldn't conflict.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23947
    • View Profile
Re: Modding - Naming Format Control
« Reply #3 on: July 05, 2011, 05:34:48 PM »

Ah, but the ships you add through a mod would be available elsewhere - for example, when picking ships for a custom battle. So it couldn't be specified in the mission API for that.

Hah, that raises an interesting point - technically, someone could refit the SC2 mod ships with other weapons, once the refit screen is in place. And they could try to fit SC2 weapons onto other ships. Will probably have to add flags to exclude ships from being refitted / weapons from being used to refit.

Nothing technically wrong with cross-equipping things from different mods, except for possibly wildly mismatched scales/visual style/etc.
Logged

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Modding - Naming Format Control
« Reply #4 on: February 28, 2012, 10:54:59 PM »

Reviving this thread; new idea on implementation.

You were worried that mods would conflict; here's how to allow them to co-exist. For each display format, however many you want there to be, define a system default for each one in the form of a C-style formatting string (token-matching). Every ship that does not explicitly override this would simply use the system default formatting strings for each format type.

However, whenever a ship is actually instantiated, have the ability to provide a configuration object defining overrides for the enumerated system default formats. That way, no memory is wasted unnecessarily (flyweight pattern), and every individual ship can have an interesting and unique name display if the ship is special. I could see this being used for mission flag ships and such, or even "alien" ships that within the fiction of the universe make no distinction of class or variant etc, making them seem even more alien.

And yes my motivation is still SC2
Logged