Mod management

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
Magnate
Space Dragon
Posts: 425
Joined: Sat Nov 08, 2014 3:44 pm

Mod management

#1 Post by Magnate »

Hi all,

Has any thought been given to how to manage mods? The example I have in mind is this: I want to play two games, interchangeably, using one installation. One totally vanilla, default settings, one with non-default hull costs, tech costs, part costs, combat rounds, weapon damage scaling, structure scaling etc. etc. etc. At the moment the two games need different config.xml files and different resource paths. I think I can do this as the game is now, but it's cumbersome because I need to duplicate the *entire* resource folder, when all I'm doing is changing a couple of values in text files.

The way most games approach this is that there's a default/ resources folder - like we have now - and a mods/ folder. Inside that is a modname/ subfolder, which contains the changed files. So the game reads the default resources, and then reads over the top the changed values from the mod's resources.

If this doesn't already exist, how complicated would it be and is it a welcome idea? I'm quite happy to experiment and submit a pull request if I can get it working. (I'm not familiar with C++ so I'll have a little learning curve but happy to try.)

CC

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Mod management

#2 Post by o01eg »

It's a possible but current parser supposed to parse file before the game starts. If it's fine to restart the client with different options we can provide mods option at start and then server and client parsers will scan default folder and mods ones.

Maybe it's a much more simple solution then send parsed data from the server to the client.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Mod management

#3 Post by Ophiuchus »

Magnate wrote: Sat Oct 03, 2020 10:32 am The way most games approach this is that there's a default/ resources folder - like we have now - and a mods/ folder. Inside that is a modname/ subfolder, which contains the changed files. So the game reads the default resources, and then reads over the top the changed values from the mod's resources.

If this doesn't already exist, how complicated would it be and is it a welcome idea? I'm quite happy to experiment and submit a pull request if I can get it working. (I'm not familiar with C++ so I'll have a little learning curve but happy to try.)

CC
It would be great to have such a feature. The way/order in which files are read would have to be changed (have a look at AppInterface). Also there needs to be a way to decide what happens with multiple definitions/what to skip. The easiest/KISS implementation would be on file name level. Start with the mod dirs, remember the file names already read and skip parsing files with the same name later on. Of course this is rather hackish and not very modular - but doing a "good" implementation in my opinion needs a lot of work on design level and also would need quite some restructuring.

Some details else one has to consider: starting unlocks, starting assets, macros, multiple definitions in a single file, adding/changing/removing definitions, interaction with universe generation scripts, interaction with AI scripts, (multi-language) stringtable changes/additions.

o01eg already gave some insight into the server side of things (especially multiplayer without AI). Transferring content definitions from server to client would solve part of the syncing issue (client and server using the same content) but as far as i understood the infrastructure for doing that is missing (?).

This KISS implementation would at least work well for adding definitions (and usually badly for removing/changing stuff) which is probably 80% of what we want.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Post Reply