[Progress - 13th March] The Mod System

  • 9 Replies
  • 3070 Views
*

Mark

  • Wired Games
  • Administrator
  • Commander
  • *****
  • 284
    • View Profile
[Progress - 13th March] The Mod System
« on: March 13, 2016, 08:45:21 PM »
Hi all,

There are major changes happening under the hood in UNION, and that is because I am implementing the mod system.

In order to make modding as flexible and robust as possible all of the game content in UNION, including ships, equipment, UIs, maps and missions, will be be packaged as mods. UNION will come with a UNIONBase ("UNION Base Content") mod which will contain all of the content we create for the game.

Mods can require, and use the content of, other mods. So people will be able to do things like create their own mission pack mod which uses content (like the UIs, maps, ships and stations) from UNIONBase.

In the case if UIs, the game doesn't care which mod they come from as long as all UIs exist between them. Mods have a priority setting, with conflicting content (like UIs) being taking from the mod with the highest priority. UNIONBase is set to the lowest priority by default.

I am at the point now where mods are loaded into the game at start. At the moment they only contain spaceship templates (spaceship definitions) but I will be adding UIs and maps soon.

I am currently integrating mods with the server, so that clients can only connect to a server if they have all of the mods that the server is using.

There's nothing visual to show at the moment, so here is the current mod config file contents (all config/data files will be JSON):

Code: [Select]
{
"Key": "UNIONBase", /* Each mod must have a unique key */
"Version": 12, /* The mod's current version */
"Priority": 0, /* This mod's priority. If there are conflicts with other mod content the mod with the higher priority "wins" */
"MinimumUNIONVersion": 43, /* The minimum UNION version (release number) required by this mod */
"Title": "UNION Base Content",
"Description": "This  contains all of UNION's standard content, including spaceships, equipment, maps and missions.",
"IsEnabled": true,
"RequiredMods": [] /* A mod key and minimum version for each mod which this mod requires */
}


As always I'm more than happy to answer any questions.

Thanks for reading!

Mark
« Last Edit: March 13, 2016, 08:47:00 PM by Mark »

*

Blaze

  • Moderator
  • Lt. Commander
  • *****
  • 137
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #1 on: March 13, 2016, 08:51:05 PM »
Does "RequiredMods" require minimum version of a mod or of the game?

*

Mark

  • Wired Games
  • Administrator
  • Commander
  • *****
  • 284
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #2 on: March 13, 2016, 08:54:35 PM »
Does "RequiredMods" require minimum version of a mod or of the game?

The minimum version of the required mod. Here is a test mod config I have been using:
Code: [Select]
{
"Key": "Test",
"Version": 1,
"Priority": 5,
"MinimumUNIONVersion": 43,
"Title": "Test Mod",
"Description": "This is a test of the mod system",
"IsEnabled": true,
"RequiredMods": [{
"Key": "UNIONBase",
"MinimumVersion": 9
}]
}

Mods will not be able to use content from a mod which they have not included in RequiredMods. This will help to prevent missing content issues when the mod is distributed to other players.
« Last Edit: March 13, 2016, 08:56:53 PM by Mark »

*

Blaze

  • Moderator
  • Lt. Commander
  • *****
  • 137
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #3 on: March 13, 2016, 09:04:14 PM »
That makes more sense, yeah. Oh, the things we can do with that... People modding ships, people modding missions, people modding UIs, ... And the players combining mods. Aw, yeah!

I see that config/data will be JSON, but what about other content? For example, texture files. Overwriting textures could work, but what about adding new textures? People would probably love to design their own ships and include them without replacing the existing ships.

Damn, I'd like to know more info about all of the content you said will be possible to mod (ships, equipment, UIs, maps and missions,). :D

*

Mark

  • Wired Games
  • Administrator
  • Commander
  • *****
  • 284
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #4 on: March 13, 2016, 09:29:48 PM »
By default UIs are the only assets which are combined across mods (this is simply because they have to be, there can only be one active version of each UI).

Other than the UIs, mods normally add content (not replace it). So if, for example, you copy a ship from UNIONBase into a new mod and tweak it then that becomes a new ship in the game. Missions will have default/recommended ships, but when creating a server the host can override this with any available ships.


Something I was considering, and due to your question it's something I think I will do, is allow people to create mods which "extend" other mods. When you create an "extension" mod it's contents get merged with the contents of the mod it is extending.

So if UNIONBase has a texture called "KiteClass_Diffuse.png" and you extend it with a mod which has a texture called "KiteClass_Diffuse.png" then the original UNIONBase texture gets replaced with the extension mod texture. The same for any other files in the mod, including ships, maps, missions.

If there are multiple extension mods for a single mod then they would use the Priority setting to resolve conflicts (in cases where they replace the same ships, textures etc).

I have updated the mod config to reflect this:
Code: [Select]
{
"Key": "UNIONBaseExtensionTest",
"ExtendModKey": "UNIONBase",
"Version": 1,
"Priority": 5,
"MinimumUNIONVersion": 43,
"Title": "UNIONBase Extension Test Mod",
"Description": "This is a test of the mod extension system",
"IsEnabled": true,
"RequiredMods": [{
"Key": "UNIONBase",
"MinimumVersion": 9
}]
}

In the case of this mod it would merge it's content with the UNIONBase mod. A mod could only extend a mod which is in it's RequiredMods.

I will write about mod content formats in a new reply, to avoid this one being too long. :)
« Last Edit: March 14, 2016, 10:48:37 AM by Mark »

*

Mark

  • Wired Games
  • Administrator
  • Commander
  • *****
  • 284
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #5 on: March 13, 2016, 10:36:22 PM »
For mod contents, all data files are stored as JSON. These are Spaceships (which includes Stations, which are essentially stationary ships), Equipment (Turrets, Torpedo Launchers, Shields, Engines etc), Entities (any object which is not a spaceship), Maps, and Missions (different missions can share the same map).

Where data files reference objects, like spaceships or entities, they do so using the object's type and it's unique key:
Code: [Select]
"Object": "Entity/Asteroid1"Where Asteroid1 is the key of the object.

To reference objects in another mod you prepend the mod key, like this:
Code: [Select]
"Object": "OtherModKey/Entity/Asteroid1"Where OtherModKey is the key of the mod which contains Asteroid1. Note: OtherModKey must be in RequiredMods for this to work.

Where data files need to they can reference textures (stored as PNG files), audio (stored as OGG files) and models (stored as OBJ files). Different data files (i.e. different spaceships) can reference the same textures/audio/models.

Assets are referenced by filename, like this:
Code: [Select]
"DiffuseTexture": "Kite_Diffuse.png"All assets are referenced by filename, no matter what folder in the mod they are stored in. For this reason all filenames within a mod folder must be unique.

You can reference a file in another mod using by prepending the mod key:
Code: [Select]
"DiffuseTexture": "OtherModKey/Texture_Diffuse.png"OtherModKey in this example is not a folder, it is the key of the mod in which Texture_Diffuse.png can be found. Note: OtherModKey must be in RequiredMods for this to work.


UIs are stored as XAML files, and use SVG vectors (preferred) or PNGs for graphics.

Here is the code for one of the buttons in UNION:
Code: [Select]
<Button Style="{StaticResource RoleSelectButtonStyle}"
Visibility="{Binding Player.Crew[captain], Converter={StaticResource VisibilityIsPlayerConverter}}"
Command="{Binding ChangeViewCommand}" CommandParameter="captain">
<Canvas Width="40" Height="40" Margin="2">
<Path Style="{StaticResource RoleSelectButtonFillStyle}" Data="M 34.15 34.15 Q 40 28.3 40 20 40 11.7 34.15 5.85 28.3 0 20 0 11.7 0 5.85 5.85 0 11.7 0 20 0 28.3 5.85 34.15 11.7 40 20 40 28.3 40 34.15 34.15 Z"/>
<Path Style="{StaticResource RoleSelectButtonStrokeStyle}" Data="M 40 20 Q 40 28.3 34.15 34.15 28.3 40 20 40 11.7 40 5.85 34.15 0 28.3 0 20 0 11.7 5.85 5.85 11.7 0 20 0 28.3 0 34.15 5.85 40 11.7 40 20 Z"/>
<Viewbox Width="24" Height="24" Canvas.Left="8" Canvas.Top="8">
<Canvas Width="128" Height="128">
<Path Fill="#FFFF5F36" Data="{StaticResource CaptainIconLayer1}"/>
<Path Fill="#FFE2431B" Data="{StaticResource CaptainIconLayer2}"/>
</Canvas>
</Viewbox>
</Canvas>
</Button>

Paths are vectors, and Path's Data property is in SVG format (you can open an SVG vector and copy it's contents into the Path's Data property).

All of this needs to be documented, and it will be before release.


Thanks for reading!

Mark
« Last Edit: March 14, 2016, 10:23:07 AM by Mark »

*

Mark

  • Wired Games
  • Administrator
  • Commander
  • *****
  • 284
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #6 on: March 13, 2016, 11:46:08 PM »
All that I have spoken about above is the in relation to modding the game's content/assets.

We will also provide a C# modding API which will allow people to add or change functionality in the game.

Exactly what will be changeable is not nailed down, but I expect that at least weapon, armor and equipment behaviour will be moddable using the API.

*

Blaze

  • Moderator
  • Lt. Commander
  • *****
  • 137
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #7 on: March 15, 2016, 10:05:31 PM »
Other than the UIs, mods normally add content (not replace it). So if, for example, you copy a ship from UNIONBase into a new mod and tweak it then that becomes a new ship in the game. Missions will have default/recommended ships, but when creating a server the host can override this with any available ships.

Excellent!

Something I was considering, and due to your question it's something I think I will do, is allow people to create mods which "extend" other mods. When you create an "extension" mod it's contents get merged with the contents of the mod it is extending.

Yes!
So, that would include a possibility of a user creating a mod containing many new ships, let's call the mod "JohnsShipyard", and another user creating missions in a mod called "DeepSpaceLost", but the mod "DeepSpaceLost" requires mod "JohnsShipyard" in order to work. That's part of the new feature, correct?

Exactly what will be changeable is not nailed down, but I expect that at least weapon, armor and equipment behaviour will be moddable using the API.

What behaviour are we talking about, exactly? I know it's not stats, but I'm not sure what it is.

*

Mark

  • Wired Games
  • Administrator
  • Commander
  • *****
  • 284
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #8 on: March 15, 2016, 10:22:36 PM »
Something I was considering, and due to your question it's something I think I will do, is allow people to create mods which "extend" other mods. When you create an "extension" mod it's contents get merged with the contents of the mod it is extending.

Yes!
So, that would include a possibility of a user creating a mod containing many new ships, let's call the mod "JohnsShipyard", and another user creating missions in a mod called "DeepSpaceLost", but the mod "DeepSpaceLost" requires mod "JohnsShipyard" in order to work. That's part of the new feature, correct?

They are two separate, but related, features.

The first is "RequiredMod". This feature, for example, allows the mod "DeepSpaceLost" to require the "JohnsShipyard" mod and then use it's contents (ships, equipment, maps etc.).

The second is "ExtendMod". This features allows a mod to mod another mod. :) So say I wanted to play the UNIONBase mod but I wanted to tweak one of the maps in it. Rather than editing the map in UNIONBase I could create a new mod which extends UNIONBase. I would then copy the map I wanted to modify into the new mod and edit it there. Because the new mod extends UNIONBase it's copy of the map would be used in the game. This works for any content, including ships, equipment, models and textures. I hope that makes sense.

Exactly what will be changeable is not nailed down, but I expect that at least weapon, armor and equipment behaviour will be moddable using the API.

What behaviour are we talking about, exactly? I know it's not stats, but I'm not sure what it is.

The API would allow you to program entire new behaviour for weapons (as well as other things). This would allow you to, for example, create a turret which acts as a tractor beam.

*

Blaze

  • Moderator
  • Lt. Commander
  • *****
  • 137
    • View Profile
Re: [Progress - 13th March] The Mod System
« Reply #9 on: March 15, 2016, 10:28:21 PM »
I hope that makes sense.
Yes, it does.

The API would allow you to program entire new behaviour for weapons (as well as other things). This would allow you to, for example, create a turret which acts as a tractor beam.
Oh! Nice! That would make it possible for a comprehensive mod to create a whole race of aliens, and completely overhaul their weapons, and whatnot. Amazing! :D