Jump to content

Guide: Running AutoCiv Mod on 0 A.D. Alpha 27 (Temporary Workaround)


Tulughma
 Share

Recommended Posts

Introduction

I love playing 0 A.D. but found myself really missing some of the basic expanded hotkeys that AutoCiv provides. Instead of waiting for the official update, I decided to try tweaking the mod's code to make it work with Alpha 27. This also gave me a chance to better understand 0 A.D.'s modding system, even though I admit I have very limited knowledge of how everything works under the hood.

This guide is the result of my experimentation - a temporary solution that got AutoCiv running on Alpha 27 on my Mac. I want to acknowledge that this is just a hack, not a proper patch, and express my deep respect to the amazing 0 A.D. developers and to Nani's incredible AutoCiv mod. I'm sharing this workaround with the community in case others find it useful while waiting for the official update.

Installation Steps

1. Locate Mods Directory

Find your 0 A.D. mods folder based on your operating system:

  • Windows (Vista+): C:\Users\{name_of_user}\Documents\My Games\0ad\mods\
  • macOS: ~/Library/Application Support/0ad/mods/
  • Linux: ~/.local/share/0ad/mods/

2. Install Mod Files

Extract autociv.zip directly into the mods directory (don't create an additional autociv folder during extraction)

3. Update Dependency Version

Edit mod.json: Find line 7 and change it to:

"dependencies": ["0ad=0.27.0"]

4. Restructure Data Directory

  1. Locate the autociv_data folder
  2. Move it into the gui folder

Note: I kept getting the error "This part of the engine may only read from 'gui/', 'simulation/', 'maps/'," etc. Since I couldn't figure out how to change this restriction, I simply moved the folder and updated the paths accordingly.

5. Update File Paths

Add "gui/" before "autociv_data/" in following files:

autociv/gui/autociv_readme/autociv_readme.js (line 11):

const markdown = Engine.ReadFile("gui/autociv_data/README.md")

autociv/gui/common/botmanager.js (line 417):

let customNamesCivs = Engine.ReadJSONFile("gui/autociv_data/civilizations.json");

autociv/gui/options/optionsautociv.js (line 93):

g_autociv_optionsFiles.push("gui/autociv_data/options.json")

autociv/gui/options/pregame/mainmenuautociv.js (line 29):

let settings = Engine.ReadJSONFile("gui/autociv_data/default_config.json");

6. Update Font Path

In autociv/gui/options/options~autociv.js, change line 85 to:

return Engine.ListDirectoryFiles("gui/fonts/", "*").

Note: This tells AutoCiv to look for fonts within the mod's gui folder although it will not find them there. You don't need to move there the game's internal fonts folder for it to work - we're just avoiding accessing restricted parts of the engine.

7. Patch the Stats Bar

In autociv/simulation/components/GuiInterface~autociv.js, update line 214 to:

"team": 1, 

and line 215 to:

"hasSharedLos": true,

Note: Credit goes to Seleucids for this more elegant solution than my original fix.

8. Disable Game Setup Error

In gui/gamesetup_mp/gamesetup_mp~autociv.js, delete or comment out (by adding // in front of) line 11:

//input.onPress = () => confirmPassword()
and line 12:
 //input.onPress = () => confirmSetup()
 

9. Disable Hotkey Saving System

In gui/hotkeys/HotkeysPage~autociv.js, comment out line 18:

//Engine.ConfigDB_WriteFile("user", "config/user.cfg");
Note: Unfortunately, this means you won't be able to change hotkeys through the game settings interface. It's not ideal, but it was the only way I could get around the errors.

Known Limitations

  • Hotkey changes cannot be saved
  • Some multiplayer setup features are disabled
  • Stats bar doesn't show teams or count kills

Again, this is a temporary solution until an official update is released. I hope this helps anyone else who's missing their AutoCiv in Alpha 27!

  • Like 2
Link to comment
Share on other sites

14 minutes ago, Tulughma said:

In gui/hotkeys/HotkeysPage~autociv.js, comment out line 18:

//Engine.ConfigDB_WriteFile("user", "config/user.cfg");
Note: Unfortunately, this means you won't be able to change hotkeys through the game settings interface. It's not ideal, but it was the only way I could get around the errors.

You can replace this by following what was done here

https://gitea.wildfiregames.com/0ad/0ad/commit/281bb0b2ecfc21b1cdac5e53b1f76e4f944a0fa8
 

Which would probably be:
 

Engine.ConfigDB_SaveChanges("user");

 

  • Thanks 1
Link to comment
Share on other sites

I think @nani autociv should be in vanilla. why should it be a separate project, @seeh's version of autociv has a lot of features too.

if we could add them to vanilla it would be great,

plus 0AD should allow double press of a key as a single hotkey( not sure if I said it correctly)

for example in age of empires we can build houses using hotkey Q+Q,

that could makes things easy. AOE hotkeys seems practical.

  • Like 2
Link to comment
Share on other sites

6 hours ago, leopard said:

I think @nani autociv should be in vanilla. why should it be a separate project, @seeh's version of autociv has a lot of features too.

if we could add them to vanilla it would be great,

plus 0AD should allow double press of a key as a single hotkey( not sure if I said it correctly)

for example in age of empires we can build houses using hotkey Q+Q,

that could makes things easy. AOE hotkeys seems practical.

So far there is no pull request to integrate the features. It will require some work toadapt the code. Also not all features might make the cut. At the beginning autociv was just the game setup addon now there are a lot of features that need to be split and rewritten so they can be maintenable in the long run.

  • Like 3
Link to comment
Share on other sites

another bug

Spoiler

ERROR: Errors executing script event "Tick"
ERROR: JavaScript error: gui/session/objectives/autociv_statsOverlay.js line 82
g_InitAttributes.settings.PlayerData[state.playerNumber] is null
  stateStrength@gui/session/objectives/autociv_statsOverlay.js:82:28
  ■ @gui/session/objectives/autociv_statsOverlay.js:7:29
  update/entries</preStatsDefault<@gui/session/objectives/autociv_statsOverlay.js:257:80
  update/entries<@gui/session/objectives/autociv_statsOverlay.js:257:17
  update@gui/session/objectives/autociv_statsOverlay.js:254:38
  onTick@gui/session/objectives/autociv_statsOverlay.js:119:18

happens when u switch to gaia perspective as observer

@nani: happens when 'Symbolize the rating' option is on

Edited by sarcoma
Link to comment
Share on other sites

Atrik's version is wonderful! I found a tiny bug when hitting enter in the host game dialog (instead of clicking on the "continue" button). I did my best to find a solution, and here's my fix:

Edit autociv/gui/gamesetup_mp/gamesetup_mp~autociv.js and change line 19 from:

input.onPress = () => confirmSetup()

to:

input.onPress = () => confirmSetup(attribs.loadSavedGame)

 

  • Like 1
Link to comment
Share on other sites

On 08/02/2025 at 4:29 AM, Stan` said:

So far there is no pull request to integrate the features. It will require some work toadapt the code. Also not all features might make the cut. At the beginning autociv was just the game setup addon now there are a lot of features that need to be split and rewritten so they can be maintenable in the long run.

It would have to be one by one and with community support and feedback. Right?

Edited by Classic-Burger
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...