Jump to content

New Civs


mattusili
 Share

Recommended Posts

I propose to look at the Rise of the East mod, you can download it and look how it works. Currently it is impossible to add more civs to extend 0 A.D. properly, so you need to replace existing ones (this is what 'Rise of the East' do) or make your own mod from scratch (not extending 0 A.D.).

Are you sure it is impossible to add more Civs? You can add a new civ file I think.

Link to comment
Share on other sites

Right, but can't that JS file be edited to include a new civ? :)

You can edit it in your local copy, but the question is how you will distribute your mod. I think you can copy this file into your mod and it should override standard (0 A.D.'s) one, but in this case it will be compatible with 0 A.D. only until it is unchanged in 0 A.D. and it will be incompatible with other mods which distribute their own version of this file. It is why I said 'Currently it is impossible to add more civs to extend 0 A.D. properly'. You definitely can find some workaround now, but for true support of moddable civilizations list we need to not hardcode it.

Link to comment
Share on other sites

You can edit it in your local copy, but the question is how you will distribute your mod. I think you can copy this file into your mod and it should override standard (0 A.D.'s) one, but in this case it will be compatible with 0 A.D. only until it is unchanged in 0 A.D. and it will be incompatible with other mods which distribute their own version of this file. It is why I said 'Currently it is impossible to add more civs to extend 0 A.D. properly'. You definitely can find some workaround now, but for true support of moddable civilizations list we need to not hardcode it.

Gotcha. (y)
Link to comment
Share on other sites

  • 4 weeks later...

I don't think they're "hard coded," they're just difficult to add at this point by editing a bunch of javascript files.

[...]but for true support of moddable civilizations list we need to not hardcode it.

What he said.

Edited by SMST
Link to comment
Share on other sites

Just to set the record straight here, Rise of the East does not replace any current faction (even with the current implementation of mod support), and no mod needs to. It will be simpler in the future, but currently there is one aspect that is "hard-coded."

There are two ways of installing the Chinese civilization. Because there are two folders that are automatically recognized by the game (public and internal, hence "hard-coded"), you can download the mod and rename the folder to internal and the game will load the data.

Alternatively, if you've got the binaries and not a compiled version, you can run the following script to load any mod folder:

./pyrogenesis -mod=FOLDERNAME

This is only necessary for team members who already have an internal folder anyway.

In the future, we plan to have the game recognize any and all folders in the mods folder and allow you through a simple GUI prompt to load or disable certain folders to your liking. I'd like this to happen sooner rather than later, but alas, I'm somewhat biased on the matter.

Hope that clears things up. :)

Link to comment
Share on other sites

HOOOLD on a second, everypony. Why were civs hardcoded in the first place?

I don't think they're "hard coded," they're just difficult to add at this point by editing a bunch of javascript files.

He doesn't mean that it's hard coded in the game's EXE, only that proper mod support for civs is not implemented yet. I could be wrong.

Here is part of the Indentity.js file:


11 "<element name='Civ' a:help='Civilisation that this unit is primarily associated with'>" +
12 "<choice>" +
13 "<value a:help='Gaia (world objects)'>gaia</value>" +
14 "<value a:help='Carthaginians'>cart</value>" +
15 "<value a:help='Celts'>celt</value>" +
16 "<value a:help='Hellenes'>hele</value>" +
17 "<value a:help='Iberians'>iber</value>" +
18 "<value a:help='Persians'>pers</value>" +
19 "<value a:help='Romans'>rome</value>" +
20 "</choice>" +

This is the definite list in the code file, this is why I said 'hardcoded'. But this is a javascript file, i.e. script, so Michael is right, you don't need to have developer tools and recompile the engine (an executable file) to implement changes, you can just edit this file with a regular text editor and your changes will be in the game. This is not much different from a config file editing. And if we will just move this list into separate config file (to not have it hardcoded in this sense), this still will not solve the discussed issue.

More details about engine and mods support: 0 A.D. (as a product) consist from the engine 'pyrogenesis' and the mod ('public'). Engine compiled from C++/C/asm source code into a platform specific executable file. Mods are folders with resources, config files and scripts; they are platform independent and don't require to recompile the engine to implement changes.

You can create your own mod with any civs you want. You can fork the public mod and add civs to it.

The problem only arise when you want to add civ into existing public mod (i.e. extend public mod with your own mod). Even in this case you can copy the Indentity.js into your mod, add a civ into it and it should work correctly with the public mod. It is just not a perfect solution, because you will need to update your mod when the Identity.js is changed and you will not be able to enable multiple such mods simultaneously. We need a mechanism like what Ben implemented for setup screen: there is a separate json file for each civ (in the civs folder, and the loadCivData function in the functions_civinfo.js, so you can just add corresponding civ files into your mod and this will not conflict with civ files added by another mod.

Rise of the East does not replace any current faction (even with the current implementation of mod support)

Hm, maybe I misunderstood something, but how do you add new civs in this case and what is this:


<Identity>
<Civ>celt</Civ>
<SelectionGroupName>units/chin_infantry_spearman_b</SelectionGroupName>
<SpecificName>Chang Mao Bing</SpecificName>
<History></History>
<Icon>units/chin_infantry_spearman.png</Icon>
</Identity>

Link to comment
Share on other sites

Hm, maybe I misunderstood something, but how do you add new civs in this case and what is this:


<Identity>
<Civ>celt</Civ>
<SelectionGroupName>units/chin_infantry_spearman_b</SelectionGroupName>
<SpecificName>Chang Mao Bing</SpecificName>
<History></History>
<Icon>units/chin_infantry_spearman.png</Icon>
</Identity>

That appears to be a typo. :P The project has thankfully advanced a little since our initial debut almost a year ago. We may have used 'celt' as our civ code for our demo release for simplicity's sake then, but all of our sim files now use 'chin' as the civ code.

Adding a new json file was all we needed to add China as a faction, giving them a civ profile (http://media.moddb.com/images/mods/1/17/16770/civprofile.1.jpg), validating 'chin' as a civ code and defining a faction emblem for when the player is using them. I'm not sure about selecting them for random maps, as at the time, that wasn't really possible with the present state of the game. Perhaps now we would have had to include them in the Identity.js file (which, as you said, would prevent you from using multiple faction mods simultaneously), which would mean we would need to invent a more intuitive way of adding new factions to that list (perhaps automatically populating that list using available json files?).

Link to comment
Share on other sites

  • 2 years later...

Thx for advice, but during proces of adding new civ I have to edited file Identity.js? When I opened it, it looks a little different from this version which I found on forum. After editing the civ code and loading the game engine crash, because error in file Identity.js. When I delete all my changes everything is working fine.

Link to comment
Share on other sites

Thx for advice, but during proces of adding new civ I have to edited file Identity.js? When I opened it, it looks a little different from this version which I found on forum. After editing the civ code and loading the game engine crash, because error in file Identity.js. When I delete all my changes everything is working fine.

This thread seems to be out of date, With some digs I find that you must make a file in the binaries/data/mods/public/civs folder.

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