"Core" ‒ Total Conversion & Mod Support

General feedback and discussion of the game.

Moderator: Forum Moderators

User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: "Core" ‒ Total Conversion & Mod Support

Post by ancestral »

Currently, I cannot make a mod that will change the size of the in-game character dialog text. Would using another “core” allow me to override theme files in data/gui and alternate font files in fonts?
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: "Core" ‒ Total Conversion & Mod Support

Post by fabi »

ancestral wrote:Currently, I cannot make a mod that will change the size of the in-game character dialog text. Would using another “core” allow me to override theme files in data/gui and alternate font files in fonts?
GUI2 reads the WML definitions differently. Thus you can not yet load them from a core.
The fonts might be possible, not sure.

Both things should be doable during the 1.13 cycle.
Please fill a bug report for the GUI2 issue.

I will investigate how the font status is.
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Support for Total Conversions and mods

Post by Pentarctagon »

fabi wrote:
Pentarctagon wrote:What do I put in the "path" key in order to load everything in default plus something else?
Sorry for answering that late.

You use the file-path to your toplevel file (mostly called "_main.cfg") in the same syntax like it is used for wml inclusions.
Then, in your file you use the inclusion syntax and include just the Wesnoth core's data/_main.cfg.
After that inclusion you include your own stuff.
So it would be:

Code: Select all

path="/path/to/add-on"
?
fabi wrote:
Also, how does an add-on specify it's a coremod?
What exactly do you mean by "coremod"?
A core that provides everything to be compatible with Wesnoth's add-ons?
Basically yeah. All the cores currently included are in data/cores.cfg, and are specified between a set of [core] tags. Where would the equivalent of cores.cfg be located for an add-on? In the same directory as _main.cfg?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Support for Total Conversions and mods

Post by fabi »

Pentarctagon wrote:So it would be:

Code: Select all

path="/path/to/add-on"
?
That works.
In this case we look for a _main.cfg at your add-ons toplevel.
If none found every file and subdir in that path is included, just like "{/path/to/add-on}" in any wml file would have done.
http://wiki.wesnoth.org/PreprocessorRef ... ive_.7B.7D

edit: But the same _main.cfg at your toplevel will be loaded twice because we also load the _main.cfg of every add-on.
edit: This means also that your core is loaded in the default core additionally.
Maybe better put everything into a folder which defines the core:

Code: Select all

path="/path/to/add-on/core/data/_main.cfg"
but

Code: Select all

path="/path/to/add-on/core/data"
should work as well.
All the cores currently included are in data/cores.cfg, and are specified between a set of [core] tags. Where would the equivalent of cores.cfg be located for an add-on? In the same directory as _main.cfg?
The file must be called "cores.cfg" and it must be located at the toplevel directory of your addon.

Thus I suggest the following file structure for an add-on providing cores:

Code: Select all

server.pbl
cores.cfg
_main.cfg  <-- for loading stuff no matter which core is selected. The engine still reads this entry point to every add-on.
cores/
cores/core1/
cores/core1/README.txt
cores/core1/data/
cores/core1/data/_main.cfg   <-- This is the entry point to your first core. This path should go into path=
cores/core1/data/ai/
cores/core1/data/campaigns/
...
cores/core2/...
...
In case you have only one core just strip the "cores/" level.
edit: In most cases the toplevel _main.cfg will just be empty.
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: "Core" ‒ Total Conversion & Mod Support

Post by Pentarctagon »

So I tried this:

Code: Select all

[core]
    id=music
    name= _ "Music"
    rank=20
    icon="data/core/images/icons/circlet_winged.png"
    image="data/core/images/icons/circlet_winged.png"
    description= _ ""
    path="/userdata/data/add-ons/Music/cores/core1/data/_main.cfg"
[/core]
but any value for the path besides "/" results in it saying "File not found".
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: "Core" ‒ Total Conversion & Mod Support

Post by iceiceice »

Pent: I think maybe you should use "~" instead of "/userdata/data", otherwise afaik it will look for a folder called userdata (?)

fabi: Shouldn't the selected core somehow be factored into the filesystem code, like in the "get_wml_location" function or something? Or is it intended that all of the paths for anything in a coremod should be relative to userdata and add-on directories. If it were like that then I think you could write stuff that would work with multiple different cores no matter which was loaded, but maybe it's a bad idea for some reason...
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: "Core" ‒ Total Conversion & Mod Support

Post by Pentarctagon »

iceiceice: Yes, that was it. The correct path was:

Code: Select all

path="~add-ons/Music/cores/core1/data/_main.cfg"
Though now it gives the error:
Wesnoth wrote:Error loading custom game configuration files. The game will try without loading add-ons.

Details:

Mandatory WML child missing yet untested for. Please report.
which is rather unhelpful. The current setup has "Music/cores.cfg" with the [core] defined and an empty "Music/_main.cfg". Everything that used to be in the add-on that I'm trying to convert to a core was copy/pasted into "Music/cores/core1/data/<images, macros, etc>". The error also continues to occur even if the only thing in "Music/cores/core1/data/" is an empty _main.cfg.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: "Core" ‒ Total Conversion & Mod Support

Post by Xudo »

As far as I know, currently Wesnoth loads all add-ons present in userdata directory.
I hope that only one "core" will be loaded at a time. If I load custom core, all mainline stuff will not be loaded and interpreted.

How are you going to differ players with different "cores" in multiplayer?
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: "Core" ‒ Total Conversion & Mod Support

Post by fabi »

Pentarctagon wrote:Though now it gives the error:
Wesnoth wrote:Error loading custom game configuration files. The game will try without loading add-ons.

Details:

Mandatory WML child missing yet untested for. Please report.
which is rather unhelpful. The current setup has "Music/cores.cfg" with the [core] defined and an empty "Music/_main.cfg". Everything that used to be in the add-on that I'm trying to convert to a core was copy/pasted into "Music/cores/core1/data/<images, macros, etc>".

The message should be right.
I have introduced extra messages whenever the path= attribute does not point to a valid location.
And other errors.

So I guess you don't hit an entry point that gives enough wml to work with.

Maybe you did not adjust the include paths in your _main.cfg (and other) files?
Just copying the files won't be enough.

I suggest to use this include syntax:

Code: Select all

{./path}: The path is resolved relative to the location of the current file containing this inclusion.
edit: Assumed you have the same file system structure as the default core this allows to easily switch between your and default core content
just by adding or removing the leading dot.
The error also continues to occur even if the only thing in "Music/cores/core1/data/" is an empty _main.cfg.
Yes, sure. The game looks for a [game_config] tag first. The empty _main.cfg can't provide one.
Thus the engine dies with the error message you see.
Xudo wrote:As far as I know, currently Wesnoth loads all add-ons present in userdata directory.
I hope that only one "core" will be loaded at a time. If I load custom core, all mainline stuff will not be loaded and interpreted.
Wesnoth looks in every add-on's toplevel directory and reads the _main.cfg from there.
If this file includes your whole core then it is loaded every time.
Make sure your toplevel _main.cfg does not do that.

The only change I made to the add-on loading mechanism is a method to allow loading only active core compatible add-ons.
How are you going to differ players with different "cores" in multiplayer?
Every core comes with his unique id.
But there is no implementation in place yet.
Suggestions welcomed
iceiceice wrote:fabi: Shouldn't the selected core somehow be factored into the filesystem code, like in the "get_wml_location" function or something? Or is it intended that all of the paths for anything in a coremod should be relative to userdata and add-on directories. If it were like that then I think you could write stuff that would work with multiple different cores no matter which was loaded, but maybe it's a bad idea for some reason...
You ask about making the path= the wml toplevel address reachable by including {/}?
I have thought about that.
But how can the designer reach default content then?
The current solution just does not touch how we include files and it seems to be working.

I have always thought that nearly every core is using at least some of the default stuff,
at least data/ai and data/lua are candidates most mods won't replace that early.

The difference between a mod and a total conversion is the add-on compatibility,
not the amount of default content loaded.

Whenever your core provides every mainline macro, unit, terrain, image and sound file you can claim it compatible.
Technically.

Remember that default content usually is used but not included by add-ons again.
The only add-on type which should include (meaning by the {[~]<path>} syntax, not in sense of make use)
default core content should be the core type.
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: "Core" ‒ Total Conversion & Mod Support

Post by Pentarctagon »

fabi wrote:The message should be right.
I have introduced extra messages whenever the path= attribute does not point to a valid location.
And other errors.

So I guess you don't hit an entry point that gives enough wml to work with.

Maybe you did not adjust the include paths in your _main.cfg (and other) files?
Just copying the files won't be enough.

I suggest to use this include syntax:

Code: Select all

{./path}: The path is resolved relative to the location of the current file containing this inclusion.
edit: Assumed you have the same file system structure as the default core this allows to easily switch between your and default core content
just by adding or removing the leading dot.
The error also continues to occur even if the only thing in "Music/cores/core1/data/" is an empty _main.cfg.
Yes, sure. The game looks for a [game_config] tag first. The empty _main.cfg can't provide one.
Thus the engine dies with the error message you see.
Perhaps a more descriptive error message would be appropriate, rather than one that says to report it as a bug?

Also, is there anything else that's required to be there other than [game_config]? Maybe I'm misinterpreting how this is supposed to be used. My intention was to use it as a way to add to mainline, such as making additional right-click menu_items appear in campaigns, rather than replace anything.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Post Reply