File based configuration options (for mods)

Suggestions that have been added to the game.

Moderator: ickputzdirwech

hoho
Filter Inserter
Filter Inserter
Posts: 681
Joined: Sat Jan 18, 2014 11:23 am
Contact:

File based configuration options (for mods)

Post by hoho »

From what I understand the latest update added the possibility for mods to write stuff to disk. I would think it would be nice if there was a nice unified way for mods (and the vanilla game itself too) to use config files for adjusting various parameters.

The most trivial things I'd like to be configurable would be stuff like recipe difficulty (amount and type of components), enabling/disabling features (e.g meteors in DyTech) and even stuff like more detailed alteration of resource spawns.

The now-added file writing feature technically allows all that but it would be nice if there was a "built-in" way of doing it using some simple file format (e.g json/.ini) so that it would both be easier to use for mods and to make it easier for users to understand.
ysor123
Inserter
Inserter
Posts: 23
Joined: Mon Jun 02, 2014 8:31 pm
Contact:

Re: File based configuration options (for mods)

Post by ysor123 »

I did not test whether the lua's loadfile is enabled, you could simply get a json encoder/decoder here:

http://lua-users.org/wiki/JsonModules

Load and use it :)
theit8514
Inserter
Inserter
Posts: 47
Joined: Sun Apr 20, 2014 2:11 am
Contact:

Re: File based configuration options (for mods)

Post by theit8514 »

Looking over the modding changes, I just noticed there's a write and remove file operations, but I don't see one for a read operation. That's interesting. I wonder what you would want to write from a mod that you wouldn't able to read back.

Anyways, most of the stuff you would like changed have to be done in data.lua. Last time I worked with data.lua there was no game object (got a nil error trying to access it. not sure if this changed in 0.10). Without the game object, even the current write/delete commands are unavailable.
muzzy
Fast Inserter
Fast Inserter
Posts: 187
Joined: Sat Nov 23, 2013 7:17 am
Contact:

Re: File based configuration options (for mods)

Post by muzzy »

The new modding write+remove all operate in the script-output folder, not per-save or anything either.

it's probably there for debug purposes, so mods can write their own log files or dump debug data or whatever...

Anyway, it's a fairly bad idea to let mods read some global config that isn't tied to the savegame. Configurable default settings when creating a new game, okay I suppose, but the mod shouldn't be reading config files directly to do that. It should be UI based in the game (user shouldn't edit the files) and there should be a specific API (or a callback that's executed once) for using it.
theit8514
Inserter
Inserter
Posts: 47
Joined: Sun Apr 20, 2014 2:11 am
Contact:

Re: File based configuration options (for mods)

Post by theit8514 »

Well, for per-save, there's always the glob. And if you wanted to make it configurable then you could pop-up a window on a new game with options that would write to glob and then never appear again.

This still wouldn't help with any data-level modifications, but would allow mods like DyTech to disable certain things (I'm looking at you solar panel damage).
hoho
Filter Inserter
Filter Inserter
Posts: 681
Joined: Sat Jan 18, 2014 11:23 am
Contact:

Re: File based configuration options (for mods)

Post by hoho »

Global configuration that is independent from specific save games for mods would be nice to have. Even better if the config also has an in-game GUI system attached and if the configs can be overridden per-save basis. I can see that allowing changing the config from within game to be quite useful and possibly even not too hard to achieve. There should just be a certain set of parameter types that mods can have as configurable and map some UI control to each one of these.

It's not probably as useful in current game but come multiplayer I can see this being very valuable. E.g playing on modded game people might want to tweak some parameters of mods and keeping them in-sync between all players would be much easier if people could just post their configs somewhere.

Similarly once mods start using the config stuff for various things it could make it possible to make a config pack that massively changes the game balance and/or features without actually touching any code at all.

[edit]

One possible way would be to have a parallel string to map exchange one to be added so that people could share their config options similarly to map generation ones.
Post Reply

Return to “Implemented Suggestions”