Jump to content

How to modify 0 A.D.?


Nescio
 Share

Recommended Posts

Yeah, I understand that part, and I quite agree.

However, it's not entirely clear to me what to put into a separate file or patch. How to load a new js file into an existing one? And would you prefer to spin off just the resources part of the session.js file, or also population and the other lines concerning the top panel?

Link to comment
Share on other sites

Given that we consider population as a resource in some parts, I'd also split that. The function already handles just the top panel, or am I missing something? As for loading js files, look for the corresponding xml files that include things. There is also some diff to load most things instead of specific ones.

Link to comment
Share on other sites

  • 3 months later...

Hi there! I could use some help again to figure out what I'm doing wrong :)

 

27. Recently I reinstalled my operating system (Fedora 27). Unfortunately I did not succeed in getting phabricator working again. So I installed the dependencies listed at https://trac.wildfiregames.com/wiki/BuildInstructions#Fedora (including php-xml), git cloned libphutil and arcanist as described at https://secure.phabricator.com/book/phabricator/article/arcanist/ , and added the path to the .bash_profile file. However, when I try running `arc update` or any other `arc` command, I get the following error:

/usr/bin/env: ‘php’: No such file or directory

Any suggestions how to get phabricator working again? (@bb_?)

 

50. Because there were too many templates to comfortably work with, I moved all structures/{civ}_*.xml and units/{civ}_*.xml templates to {civ}/*.xml in my 0abc mod ( https://github.com/0abc/0abc-unified ). The game handles it unproblematically, however, the tech tree doesn't. How to fix this (in A22)?

Screenshot_from_2018-02-18_19-27-28.png

Any suggestions how to get the tech tree working again? (@s0600204?)

Edited by Nescio
ce
Link to comment
Share on other sites

47. maybe this from the arc install help gives a clue (I guess installing php7 in dnf would do the same trick):

Quote

Arcanist is written in PHP, so you need to install the PHP CLI first if you don't already have it. Arcanist should run on PHP 5.2 and newer. If you don't have PHP installed, you can download it from http://www.php.net/.

 

Link to comment
Share on other sites

On 18/02/2018 at 6:28 PM, Nescio said:

50. [...] I moved all structures/{civ}_*.xml and units/{civ}_*.xml templates to {civ}/*.xml in my 0abc mod

Therein lies the problem. (if you'd moved them to "structures/{civ}/*.xml" and "units/{civ}/*.xml" you wouldn't have the problem, and you'd have even fewer files in each folder.)

The simplest "fix" would be to move 'em back (or into the "{structures|unit}/{civ}/*.xml" folder layout).

A "code fix" wouldn't really be worth it, as A23 should be released within a month or so. Thus, any code "fix" for A22 would have to be replaced by another "fix" for A23; and would make it harder to upgrade your mod to be compatible with A23. Considering where the change would have to take place, a "code fix" would also be unpleasant.

  • Like 2
Link to comment
Share on other sites

On 05/11/2017 at 12:44 AM, leper said:

Moving the part that does the layout of the resource objects into a function and calling that from the function where you replaced horizontallySpaceObjects with verticallySpaceObjects. Possibly placing that in some other file if you want to. Mostly so in your mod (or someone else in a mod) can just replace that new function without having to ship a modified copy of session.js.

You added full copies of session.js and functions_utility.js to your mod, with small modifications. This is going to be hard to maintain. If the only thing you actually ship in your mod are two script files, one with the verticallySpaceObjects function, and one with the modified placement/layout function (which needs that part to be split from the function it is currently in), then the amount of work you will have to do when you upgrade to the next release will be reduced by a lot.

Done (I think): https://code.wildfiregames.com/D1324

 

 

On 22/02/2018 at 3:10 PM, bb_ said:

47. maybe this from the arc install help gives a clue (I guess installing php7 in dnf would do the same trick):

Thanks, `dnf install php-cli` did solve it indeed! Now arcansist works again, I could finally address the changes requested at https://code.wildfiregames.com/D906

 

 

20 hours ago, s0600204 said:

Therein lies the problem. (if you'd moved them to "structures/{civ}/*.xml" and "units/{civ}/*.xml" you wouldn't have the problem, and you'd have even fewer files in each folder.)

The simplest "fix" would be to move 'em back (or into the "{structures|unit}/{civ}/*.xml" folder layout).

A "code fix" wouldn't really be worth it, as A23 should be released within a month or so. Thus, any code "fix" for A22 would have to be replaced by another "fix" for A23; and would make it harder to upgrade your mod to be compatible with A23. Considering where the change would have to take place, a "code fix" would also be unpleasant.

Moving them back is easier said than done; 0abc contains nearly two thousand promoted unit templates (because each soldier can promote a dozen times). Furthermore, although I considered moving to `structures/{civ}/*.xml` instead of `{civ}/structure_*.xml`), I decided against, because having both units and structures of a single faction in the same folder makes some things easier, at least for me.

Will the tech tree accept my template reorganization in A23? And how much work would the "unpleasant" code fix be in A22? (Because not everyone will switch immediately to A23 when it's released.)

 

Link to comment
Share on other sites

12 hours ago, s0600204 said:

It should now. Not backport-able: you will need to update your mod to be A23-compatible to use it.

Thanks a lot! Eventually I'll update my mod to A23, but not before it's released.

PS Using your A23 patch as an example, I tweaked A22's `gui/structree/structree.js` file and was able to fix it within five minutes (that was a lot less "unpleasant" than I expected); 0abc's tech tree works again! Without you pointing the way I wouldn't have had any idea what to look for, therefore thanks again!

Edited by Nescio
Thanks again!
  • Like 1
Link to comment
Share on other sites

  • 2 months later...

How do you mean?

The button is active when a unit of any of the following class is idle.

var g_WorkerTypes = ["FemaleCitizen", "Trader", "FishingBoat", "CitizenSoldier"];

 

Link to comment
Share on other sites

16 minutes ago, (-_-) said:

How do you mean?

The button is active when a unit of any of the following class is idle.


var g_WorkerTypes = ["FemaleCitizen", "Trader", "FishingBoat", "CitizenSoldier"];

 

Yeah; now I want to replace "CitizenSoldier" with "Worker"; where can I find and modify the "g_WorkerTypes" variable?

Link to comment
Share on other sites

  • 3 weeks later...
  • 5 weeks later...
  • 3 months later...

Currently I'm working on my mod (  https://github.com/0abc/0abc-a23.git ) again, reorganizing templates. When I generate a skirmish map, it starts without any errors, but when I attempt to generate a random map, I get six errors, and then it quits:

ERROR: CCacheLoader failed to find archived or source file for: "simulation/templates/structures/gaia_fortress.xml"
ERROR: Failed to load entity template 'structures/gaia_fortress'
ERROR: Invalid template found for 'structures/gaia_fortress'
ERROR: CMapGeneratorWorker::LoadScripts: Failed to load script 'maps/random/rmgen-common/wall_builder.js'
ERROR: JavaScript error: globalscripts/Templates.js line 165 
TypeError: template is undefined 
   GetTemplateDataHelper@globalscripts/Templates.js:165:1
   readyWallElement@maps/random/rmgen-common/wall_builder.js:265:17 
   loadWallset@maps/random/rmgen-common/wall_builder.js:49:26
   loadWallsetsFromCivData@maps/random/rmgen-common/wall_builder.js:33:1 
   @maps/random/rmgen-common/wall_builder.js:8:20
   @maps/random/kerala.js:2:1
ERROR: CMapGeneratorWorker::Run: Failed to load RMS 'maps/random/kerala.js'

I haven't touched any map files or scripts, nor does a `gaia_fortress.xml` file exist, so I have no idea what causes these errors. And because I usually test with a AI vs AI skirmish map, but no random maps, I don't know when these errors where introduced by my mod. Can anyone help me identify and solve the problem? @elexis, perhaps?

(There are also 14 unrelated "Could not remove token 'ConquestCritical' ..." warnings, which can be solved with D1626  .)

Link to comment
Share on other sites

Just a guess but it's probably triggering the error on L240 of wall_builder.js, heres L239

But I have no clue how "gaia" could be in g_CivData. Maybe you modified "loadCivFiles" in globalscripts/Templates.js? Nevermind.

I think the wallsets templates are the issue. Your templates are different from the vanilla ones and as Stan mentioned, there is a <civ> element with gaia on the parent template which I could not find in vanilla. Maybe you didnt overrule that field in the individual civ templates?

Edited by Guest
Link to comment
Share on other sites

Thank you for your quick replies!

1 hour ago, stanislas69 said:

Did you apply you Gaia patch on your repository ? This looks like one of the fortress is using the wrong civ :)

59 minutes ago, (-_-) said:

Just a guess but it's probably triggering the error on L240 of wall_builder.js, heres L239

But I have no clue how "gaia" could be in g_CivData. Maybe you modified "loadCivFiles" in globalscripts/Templates.js? Nevermind.

I think the wallsets templates are the issue. Your templates are a *lot* different than vanilla ones and as Stan mentioned, there is a <civ> element with gaia on the parent template which I could not find in vanilla. Maybe you didnt overrule that field in the individual civ templates?

Adding or removing the <civ> element in the parent wallset template has no effect. And yes, all fortresses, wallsets, and other structures under simulation/templates/structures/{civ}/* overrule the civ element.

And even if a structure would have no <civ>, it results into only a warning, not an error. E.g. if I remove the <civ> from all wallsets (parent and children) in my mod, I get:

"WARNING: The "structures/athen/wallset_city" template has a defined civ of "undefined". This does not match the currently selected civ "athen".

This does not prevent a game from starting.

In other words, the problem is something else in my mod. And skirmish maps start without errors. Only random maps fail to generate.

Edited by Nescio
no syntax highlighting
Link to comment
Share on other sites

First thought about D900? Other mods with new civs had this issue too, so you may want to take a look around.

But given that it complains about "structures/gaia_fortress" might relate to some gaia patch?

It sounds like the rmgen wall_builder doesn't ignore gaia in your mod but might ignore it for the public mod.

Link to comment
Share on other sites

On 10/5/2018 at 4:19 PM, elexis said:

First thought about D900? Other mods with new civs had this issue too, so you may want to take a look around.

But given that it complains about "structures/gaia_fortress" might relate to some gaia patch?

It sounds like the rmgen wall_builder doesn't ignore gaia in your mod but might ignore it for the public mod.

Thanks for pointing out that patch; indirectly it helped me figure out what I did wrong in my mod. What caused the random map errors was that I had edited the "WallSets" in the {civ}.json files. After I reverted those to the default values, the errors disappeared, and random maps can now be generated again. 

Although I still don't understand why the error message complained about a (non-existent) 'structures/gaia_fortress', it is now gone.

Link to comment
Share on other sites

  • 3 months later...
On 1/12/2019 at 7:42 PM, Nescio said:

56. Something else I'm contemplating is replacing the AI's resource gain (Medium 100%, Very Hard 160%) with resource costs and build time multiplier(s), e.g. Very Easy 200%, Medium 100%, Very Hard 50%. Any suggestions on how to do that?

rP21256        changes the difficulty, so you can look where the difficulty is set. Then you could look where this variable is used.

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...