Jump to content

CustomColors mod - replace default player colors


Mentula
 Share

Recommended Posts

Dear all,

Long ago (A24 was the current version) I made a mod to replace in-game player colors. It was never published on the forum, although it is publicly available on my GitLab. Better leaving a trace here on the forum than out in the internet wilderness.

The mod is named CustomColors and the current version 0.27.1 is compatible with Alpha 27.

When I developed this mod, there were already other mods implementing color changing - and maybe it is still the case today, but the existing solutions were not satisfactory to me, as those mods replaced colors everywhere... including replay files! Hard-coding colors onto replay files has some disadvantages (noticeable f.e. when when sharing replay files with others or when playing replays).

So I opted for a more flexible solution and the CustomColors mod was the result. Perhaps one day the possibility of customizing player colors will be a built-in feature of the game.

Color replacement, in two screenshots

Here is where colors can be changed:

options.png.bc12a29724b7508bc444d1658a405036.png

And here is how the result looks like:

gamesetup.png.8388651ccdac33cde1c3215af5b4deaa.png

Installation

Click here to download the latest release. Install following the official 0 A.D. guide: How to install mods?

Alternative downloads: Latest Release (.pyromod) | Latest Release (.zip) | Older Releases

Contribute

The public repository is at this page. Everybody is very welcome to contribute, suggest, fork or simply give feedback. Have fun!

  • Like 7
  • Thanks 2
Link to comment
Share on other sites

1 hour ago, sarcoma said:

i had to disable autociv to see the settings tab

same thing happens with moderngui

moderngui + autociv dont have that problem

Some mods overwrite existing options, instead of adding to them. We must ask authors to fix this behavior, as it breaks compatibility with other mods.

It is clear from this code by @Atrik for example: g_Options, as well as the whole init() function, are overwritten. This is not good, as the original behavior will be "forgotten". I am surprised to hear it is an issue with autociv; I discussed with @nani in May '23 and he made a fix.

A general recommendation to modders: use proxies to wrap functions, instead of overwriting them! See here for inspiration.

  • Like 2
Link to comment
Share on other sites

1 hour ago, Mentula said:

i had to disable autociv to see the settings tab

when mods overwrite the main menu or something (maybe bad) as a workaround it could help set your mod behind. or automatically set your mod behind. then you need to identify what mods that are and then set you mod behind automatically and then automatically reload the game. Engine.SetModsAndRestartEngine(["mod",...clean_array])

Edited by seeh
Link to comment
Share on other sites

14 hours ago, Mentula said:

Long ago (A24 was the current version) I made a mod to replace in-game player colors. It was never published on the forum, although it is publicly available on my GitLab. Better leaving a trace here on the forum than out in the internet wilderness.

The mod is named CustomColors and the current version 0.27.1 is compatible with Alpha 27.

Oh wow, I missed this. I almost was going to to try making this options myself! Thanks @Mentula.

Link to comment
Share on other sites

1 hour ago, Mentula said:

It is clear from this code by @Atrik for example: g_Options, as well as the whole init() function, are overwritten.

To be precise, this code is adding options if there are already existing one in a global variable, all mods could do this, it would also be working fine.

Link to comment
Share on other sites

20 minutes ago, seeh said:

when mods overwrite the main menu or something (maybe bad) as a workaround it could help set your mod behind. or automatically set your mod behind. then you need to identify what mods that are and then set you mod behind automatically and then automatically reload the game. Engine.SetModsAndRestartEngine(["mod",...clean_array])

This workaround (i.e. changing the mod order) did not work in A26. It should work, but it didn't, possibly because of a bug. Not sure about A27.

In practice, autociv (and other overwriting mods) took precedence over CustomColors (and other proxying mods) regardless of the order mods were loaded. This is why I asked nani for the fix :)

 

Link to comment
Share on other sites

15 minutes ago, Atrik said:

all mods could do this

A mod should be agnostic about the existence of global variables outside the public mod (such as g_autociv_optionsFiles).

 

It is clear where this issue comes from, @Atrik: your options.js file is a copy of options~boongui.js, which was last updated in 2021. Back at that time, autociv options were not compatible with other mods, so boonGUI had to implement this "dirty trick" (i.e. to include autociv's global variables) to function properly. Nowadays, this problem does not persist anymore: autociv supports option compatibility, so other mods (including yours) can be free from autociv's global variables.

If you'd like me to send an update to your repo with a fix, please let me know. It can also be quickly amended by looking at nani's autociv code or other code (here or here)

  • Like 1
Link to comment
Share on other sites

19 minutes ago, Mentula said:

It is clear where this issue comes from, @Atrik: your options.js file is a copy of options~boongui.js, which was last updated in 2021. Back at that time, autociv options were not compatible with other mods, so boonGUI had to implement this "dirty trick"

OR, mods in a26 were aligned on a solution to add options after nani's mod and you suggested something else. Indeed I didn't write this code, but overwriting some functionality of the game such as  the one that are here in option is the concept of a mod. Your approach might be slightly better in some ways but also you are asking existing mods to adapt to you instead because you didn't want to get along with using autociv purposely created global variable (that was also a easier way to add options).

Edited by Atrik
Link to comment
Share on other sites

2 hours ago, Mentula said:

did not work in A26. It should work, but it didn't, possibly because of a bug. Not sure about A27

its works in both. maybe you want look at autocivP implementation

Edited by seeh
Link to comment
Share on other sites

Nice mod. A suggestion: In addition to the individual colors you could add one long string that contains all colors at the bottom that can be easy copy / pasted like:

255 255 200 249 249 199 ....

So one can share their carefully crafted color scheme here. This would also drive user engagement. But what do you guys think? Leave a like and a comment down below.

  • Like 3
Link to comment
Share on other sites

3 hours ago, ffm2 said:

Nice mod. A suggestion: In addition to the individual colors you could add one long string that contains all colors at the bottom that can be easy copy / pasted like:

255 255 200 249 249 199 ....

So one can share their carefully crafted color scheme here.

You can export/import your color scheme from/to local.cfg:

[customcolors]
1 = "21 55 149"
2 = "150 20 20"
3 = "86 180 31"
...
16 = "80 80 80"

 or alternatively, from/to user.cfg:

customcolors.1 = "21 55 149"
customcolors.2 = "150 20 20"
customcolors.3 = "86 180 31"
...
customcolors.16 = "80 80 80"
  • Like 2
Link to comment
Share on other sites

2 hours ago, Seleucids said:

Nub question: what are the commands for setting colours?

In option, you define what color you want to steal, then every game you aren't this color, yours will be swaped with the player who has the one you want :wine: (As well as you customizing this color in the first place ofc)
Example: Set color 1 to your favorite red, then set "Replace Own Color" to 1.
 

Spoiler

image.thumb.png.d1d9b611c445194c12882a43066a21c5.png

 

Edited by Atrik
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 09/02/2025 at 10:13 PM, Mentula said:

Better leaving a trace here on the forum than out in the internet wilderness.

The mod is named CustomColors and the current version 0.27.1 is compatible with Alpha 27.

Thanks. I not missed something. But :) i will give it a try :) 

Link to comment
Share on other sites

Spoiler

screenshot0013.thumb.png.580d6496a01f89a571686f23a926e50b.png

I've got frustrated of not being able to find 16 colors well distinct of each others, so I added an option to force only 8 colors to be used. So with this option you could only define the 8 first colors, and they will also always appear in order.

 customcolors.zip@Seleucids
For the mod above, there are no default config, boolean options are bugged, check and uncheck to actually set to false :laugh:
Or here is the configuration I'll set as default for ModernGUI with a good color palette that is nice for any game size from 1v1 to 4v4. (That config can be used for Mentula's original version as well ofc, I kept them cross-compatible).

Spoiler

customcolors.1 = "255 20 20"
customcolors.10 = "185 0 89"
customcolors.11 = "0 157 174"
customcolors.12 = "255 95 180"
customcolors.13 = "255 201 127"
customcolors.14 = "250 250 250"
customcolors.15 = "146 146 154"
customcolors.16 = "2 2 2"
customcolors.2 = "255 154 0"
customcolors.3 = "255 227 2"
customcolors.4 = "10 210 0"
customcolors.5 = "17 214 255"
customcolors.6 = "0 84 255"
customcolors.7 = "63 0 184"
customcolors.8 = "160 0 255"
customcolors.9 = "187 93 0"

 

Edited by Atrik
Ups, small oversight bug
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...