• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

"Modular" Modding support for BNH

Hammie

Storm Engine developer
Staff member
Storm Modder

Modules​

One of my goals for Beyond New Horizons is to make the game even more modding-friendly, both in terms of making modifications, but also in terms of sharing your modifications with the rest of the community. To achieve this, I’m introducing “Modules”.

The game will soon come with a new modules folder (different from the old MODULES folder in Pirates of the Caribbean). This folder will have a core module, which will - in time - contain all the base game content. And yes, users will be able to create their own modules containing their own modifications and content. These modules can then easily be shared with others: drop them in the modules folder to install, delete them from the modules folder to uninstall.

How it works​

The engine has been enhanced with full TOML (TOML: Tom's Obvious Minimal Language) support, able to read TOML config files directly from scripts. Most configuration will happen through TOML config files going forward.

Every module will need to have a module.toml file in the root directory (ex.: /modules/<my_mod>/module.toml), containing all the basic information about the mod.
The core module config looks something like this:
Code:
name = "core"
version = [15, 0, 0]
enabled = true
description = "New Horizons core module. Contains required files for the base game to run."
authors = [
    "PiratesAhoy!",
]
And that is pretty much all that is needed to create a new mod, have it loaded by the engine, and have it show up in-game.

Configuration files​

To make modding (and development) of the game easier, while at the same time reducing possible conflicts between mods, we are moving most of the game data and configuration out of the script files and into TOML files.
Code:
[storyline.free_play]
dir = "FreePlay"

[storyline.free_play.start]
location = "Tutorial_Deck"
port = "QC_port"
model = "47_JRMMSub"
first_name = "Julian"
last_name = "McAllister"
nation = "england"
player_type = "rebel"
difficulty = "seadog"
pirate_flag = 5
personal_flag = 30
ship = "BrigRoyal"
ship_name = "Defiance"

[storyline.free_play.start.date]
hour = 13
min = 20
sec = 33
day = 14
month = 5
year = 1682

[storyline.free_play.variables]
CHANGING_RELATIONS = 1
ISLA_DE_MUERTE = 0

Currently only the basic storyline information has been migrated to module configs, but over time more and more content will be converted.

Example mod​

Let’s say you want to create a very simple mod that replaced the default starting ship for the free-play storyline. All you need to do is create a new mod, and override the storyline.free_play.ship value.

/modules/brigantine-start/module.toml:
Code:
name = "brigantine-start"
version = [1, 0, 0]
enabled = true
depends = ["core"]
description = "Example mod"
authors = ["PiratesAhoy!"]

/modules/brigantine-start/config/storyline/brigantine_start.toml:

Code:
storyline.free_play.ship = "Brigantina1"

That’s it! Launch the game, start a new free-play game, and see how the brigantine is now the default selected ship.

To share your newly created mod, just zip the brigantine-start folder and share it. Never been easier!
 
This is a WIP proposal, so I would love to hear your feedback, concerns or ideas!
:type1
 
personally, i think its like changing what i assume is 20 years of known methods ect, but i also think it might be a good way to change stuff up going forward. with various storm engine games using the tried and true ways, it might not work out well, but i dunno. just my opinion, and its your thing, your choice.
 
Hi Hammie,
I like the idea, and it would also make porting content to other engines much easier. On the other hand, begginfokillz is also quite right that it's a risk to change the tried and true ways. Quite likely you get stuck in the middle and then we have part of the configuration in .c files and other parts in TOML files, the engine needs to support both and modders get confused.
That said, do you have any intersting TOML files already, like characters, towns or ships (perferably towns actually). I would like to try my hand on creating UE level based on that if you could give me an example. Or if not, I'm offering help in translating some files from .c to TOML.
 
Last edited:
well for ships, you have in ships_init.c this loop

for (idx=0;idx<SHIP_TYPES_QUANTITY;idx++)
{
makeref(refShip,ShipsTypes[idx]);
..
}

and then the attributes get set for refShip.
What would that look like in a TOML file?
 
What would that look like in a TOML file?
The exact setup is still to be determined, but I expect it will look somethings like this:

A `ships` folder with one or multiple config files containing entries of a `ship` table. With each ship getting a named entry based on their id.

Code:
[ship.caravel_1]
model = "caravel1"
class = 6
weight = 300
capacity = 2000
max_crew = 78
min_crew = 13
price = 30600
hp = 1250
sp = 200

can_encounter = true
can_buy = true
is_trade = true
is_war = false

speed_rate = 11.3
turn_rate = 65
acceleration = [6, 2.5, 2.5]
braking = [0.4, 0.5, 2.0]

waterline = -0.1
closest_point = 0.20
best_point = 0.65
rig = "Xeb"

deck = "ShipDeck5"
cabin = "Cabin_small"
has_cargo_hold = true
has_cannons_deck = true

periods = [1.0, 0.6, 0.0, 0.0, 0.0, 0.0]

[ship.caravel_1.nations]
england = 0.2
france = 0.2
holland = 0.2
portugal = 0.6
pirate = 0.2
spain = 0.6
america = 0.0
sweden = 0.2

[ship.caravel_1.cannons]
caliber = 4
max_caliber = 4
count = 32
front = 2
back = 4
 
Perfect, thanks a lot, that's exactly what I needed to know. I will then do it in the same way for locations, which is what's currently most important to me. (Mind you, I will just "translate" the locations_init.c file, not touch the engine source code.)
 
Back
Top