Jump to content

How to modify 0 A.D.?


Nescio
 Share

Recommended Posts

17 hours ago, bb_ said:

 

28. after a little deeper look the error is fooling me... is this the exact error you get in the commandline when using current svn? also pinging our ai dev @mimo

 

Yes, can you give more details: A22 or svn? only when loading your mod or also in vanilla? if only with your mod, have you added some attack Bonuses?

Link to comment
Share on other sites

28.

1 hour ago, mimo said:

Yes, can you give more details: A22 or svn?

Both.

1 hour ago, mimo said:

only when loading your mod or also in vanilla?

It occures only in mid to late game, and not in every game. It happens in my mod, yes. I don't know if it also happens in vanilla, I never continue vanilla single player games beyond a few minutes.

1 hour ago, mimo said:

if only with your mod, have you added some attack Bonuses?

Yes, I certainly did. I already went through the templates looking for typos (e.g. “Bonus” or “Class” instead of “Bonuses” or “Classes”; missing or wrongly placed </>).

 

 

30. Found it: /gui/session/selection_details.js Changed it and it seems to work as intended :)

Link to comment
Share on other sites

49 minutes ago, Nescio said:

By the way, here is a new save game (attached) with the error message, maybe it could help.

savegame-0001.0adsave

I've not been able to run your mod: I first selected a skirmish map, and there were a lot of errors linked to skirmish templates. So i tried a random map, and then the game froze at startup. Have you tried to run it using the zip file from your git repository?

Anyway, can you add in line 312 of ai/common-api/entity.js (i.e. just before it crashes in your stack)

if (!bonusClasses) warn(" Template " + this._templateName + " with Attack " + uneval(this.get("Attack")) + " has no bonus with type " + type + " bonus " + b);

And copy here what is printed. That should help understand what happen.

Link to comment
Share on other sites

12 hours ago, mimo said:

I've not been able to run your mod: I first selected a skirmish map, and there were a lot of errors linked to skirmish templates.

That's probably because I implemented a new template tree; I haven't looked at skirmish maps, (I actually forgot they existed), because I always play random maps, but I'll look at it to see if I can easily solve those issues.

EDIT: there are indeed many error messages; I'll need to have a more careful look at this; thanks for pointing it out!

PS How and why are skirmish maps different from random maps?

12 hours ago, mimo said:

So i tried a random map, and then the game froze at startup.

Yeah, somehow generating random maps is quite slow; it usually stays at 99% for up to a few minutes. Loading an existing saved game is much faster though.

12 hours ago, mimo said:

Have you tried to run it using the zip file from your git repository?

No, I fetch the repository directly (git clone, git pull, git push); however, the zip contains exactly the same files, and I don't see why it would make any difference whether it's zipped or not. Anyway, I'll try it out now.

EDIT: if I place the zipped version in the mods folder, 0AD doesn't recognize it. After I unzipped it, it works exactly the same as the repository fetch with command line git (which was to be expected, because they contain the same files).

 

 

Have you tried running the mod under the stable a22 (which ought to work), or under the newer svn version (to which this mod is probably not fully compatible)?

 

 

12 hours ago, mimo said:

Anyway, can you add in line 312 of ai/common-api/entity.js (i.e. just before it crashes in your stack)

if (!bonusClasses) warn(" Template " + this._templateName + " with Attack " + uneval(this.get("Attack")) + " has no bonus with type " + type + " bonus " + b);

And copy here what is printed. That should help understand what happen.

Thanks! I'll try that and see what happens.

EDIT: here is the new output:

Quote

ERROR: JavaScript error: simulation/ai/common-api/baseAI.js line 41
TypeError: this.gameState is undefined
m.BaseAI.prototype.Init@simulation/ai/common-api/baseAI.js:41:2
m.BaseAI.prototype.HandleMessage@simulation/ai/common-api/baseAI.js:61:3

 

Edited by Nescio
updates
Link to comment
Share on other sites

Three other questions:

31. I'd like to display metal everywhere (costs, loot, market, etc.) consistently before stone; which files do I need to edit?

 

 

32. Likewise, I'd like to display crush armour and damage everywhere before hack (instead of after pierce).

 

 

33. Where are the player colours defined? I would prefer them to be brighter in my mod.

Edited by Nescio
ce
Link to comment
Share on other sites

7 hours ago, Nescio said:

Yeah, somehow generating random maps is quite slow; it usually stays at 99% for up to a few minutes. Loading an existing saved game is much faster though.
 

I don't think it is the map generation as this is much worse that in vanilla game. It should be something you do during initialization.

Link to comment
Share on other sites

2 hours ago, mimo said:

I don't think it is the map generation as this is much worse that in vanilla game. It should be something you do during initialization.

Something I do? I've only changed files in simulation/templates/ and simulation/data/ ; how does this affect random map initialization?

 

Anyway, any suggestions for that AI error?

 

7 hours ago, wowgetoffyourcellphone said:

Also in the top ribbon too?

Yeah: “everywhere”, “etc”, “consistently” :)

Edited by Nescio
ce
Link to comment
Share on other sites

1 hour ago, Nescio said:

Something I do? I've only changed files in simulation/templates/ and simulation/data/ ; how does this affect random map initialization?

 

I've no idea what is done in the mod (and don't have time to try to know), but just load a few maps with vanilla game and with your mod and you will see the difference

 

1 hour ago, Nescio said:

 

Anyway, any suggestions for that AI error?

No because this new error you get has nothing to do with the previous one. Are you sure you don't have a JS syntax error when adding the warning?

Otherwise, I've just tried a game between AIs with your mod and did not reproduce the error.

Link to comment
Share on other sites

13 hours ago, mimo said:

I've no idea what is done in the mod (and don't have time to try to know), but just load a few maps with vanilla game and with your mod and you will see the difference

To test I generated several random giant random maps with five players each:
Without 0abc: 25s, 23s, 24s, 18s, 5s
With 0abc: 115s, 183s, 162s, 138s, 165s
(of which it takes about 15s to get to 99%)
So it is indeed significantly slower, although I have no idea why. Does initialization time depend on the number of templates in existence?

13 hours ago, mimo said:

No because this new error you get has nothing to do with the previous one.

Yeah, the new output surprised me as well.

13 hours ago, mimo said:

Are you sure you don't have a JS syntax error when adding the warning?

No, I'm not; I just followed your earlier instructions:

On 10/09/2017 at 10:51 PM, mimo said:

Anyway, can you add in line 312 of ai/common-api/entity.js (i.e. just before it crashes in your stack)

if (!bonusClasses) warn(" Template " + this._templateName + " with Attack " + uneval(this.get("Attack")) + " has no bonus with type " + type + " bonus " + b);

And copy here what is printed. That should help understand what happen.

Anyway, I tried the above again, and now the following error messages are immediately and continuously produced when starting a game:

ERROR: JavaScript error: simulation/ai/common-api/entity.js line 13 TypeError: this._templateName is undefined m.Template<._init@simulation/ai/common-api/entity.js:13:7 m.GameState.prototype.getTemplate@simulation/ai/common-api/gamestate.js:149:9 m.GameState.prototype.findTrainableUnits@simulation/ai/common-api/gamestate.js:710:18 m.HQ.prototype.findBestTrainableUnit@simulation/ai/petra/headquarters.js:526:11 m.HQ.prototype.trainMoreWorkers@simulation/ai/petra/headquarters.js:430:20 m.HQ.prototype.update@simulation/ai/petra/headquarters.js:2234:3 m.PetraBot.prototype.OnUpdate@simulation/ai/petra/_petrabot.js:119:3 m.BaseAI.prototype.HandleMessage@simulation/ai/common-api/baseAI.js:64:2

ERROR: JavaScript error: simulation/ai/petra/_petrabot.js line 106 TypeError: this.gameState is undefined m.PetraBot.prototype.OnUpdate@simulation/ai/petra/_petrabot.js:106:2 m.BaseAI.prototype.HandleMessage@simulation/ai/common-api/baseAI.js:64:2

ERROR: JavaScript error: simulation/ai/petra/_petrabot.js line 106 TypeError: this.gameState is undefined m.PetraBot.prototype.OnUpdate@simulation/ai/petra/_petrabot.js:106:2 m.BaseAI.prototype.HandleMessage@simulation/ai/common-api/baseAI.js:64:2

ERROR: JavaScript error: simulation/ai/petra/_petrabot.js line 106 TypeError: this.gameState is undefined m.PetraBot.prototype.OnUpdate@simulation/ai/petra/_petrabot.js:106:2 m.BaseAI.prototype.HandleMessage@simulation/ai/common-api/baseAI.js:64:2

This happens both with and without my mod (no difference), so I suppose there is some js error now.

13 hours ago, mimo said:

Otherwise, I've just tried a game between AIs with your mod and did not reproduce the error.

Yeah, the earlier error message does not occur in every game in my mod, only in some, and if it does, in the mid to late game.

 

Actually the fact I don't understand the error is more annoying than the error itself.

Link to comment
Share on other sites

17 hours ago, mimo said:

In fact, there is a high chance that your bug is https://trac.wildfiregames.com/changeset/19981 and is thus already fixed in svn.

If that's the case, great :)

17 hours ago, mimo said:

Are you sure you also reproduced it in svn?

No, I'm not sure; I think I did a few days ago, but I'm now starting to doubt.

 

Anyway, thank you for your help and time, I do appreciate it!

Link to comment
Share on other sites

On 11/09/2017 at 11:59 AM, Nescio said:

31. I'd like to display metal everywhere (costs, loot, market, etc.) consistently before stone; which files do I need to edit?

Found it: /simulation/data/resources/metal.json ; that was extremely easy!

 

On 11/09/2017 at 11:59 AM, Nescio said:

32. Likewise, I'd like to display crush armour and damage everywhere before hack (instead of after pierce).

Now, which files do I have to edit for this?

 

On 11/09/2017 at 11:59 AM, Nescio said:

33. Where are the player colours defined? I would prefer them to be brighter in my mod.

And I'd appreciate some help to achieve this as well.

Link to comment
Share on other sites

(The somewhat hacky solution that will just cause issues once you have to upgrade from A22 would be to change the order of the entries in g_DamageTypes in gui/common/tooltips.js)

For 33. that will work for random maps and quite a few skirmish and scenario maps, though some of those specify the color explicitly. I might have a diff somewhere that removes a few of the explicitly set colors that are the same as the current default.

Link to comment
Share on other sites

32. Then I'll leave it untouched for now.

 

33. Great, many thanks! Now I can finally easily distinguish all other players on the mini map :)

 

34. And where are the text font colours of the mod selection screen defined? (Dark grey text on a dark grey background is quite difficult to read.)

Link to comment
Share on other sites

34. Thanks! So I edited the modmod.xml file, which works for all columns, except for the (folder), which I specified to be in yellow:

<column id="modFolderName" color="255 255 0" width="13%">
  <translatableAttribute id="heading">(Folder)</translatableAttribute>
</column>

Which, however, does not seem to show up:

Screenshot_from_2017-09-16_00-05-58.png

Is it because the values of all other columns are defined inside the mod.json files, except for the (folder), which is the location of the file? Then where is this colour specified?

Edited by Nescio
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...