Jump to content

Hyrule Conquest


Recommended Posts

HouseErrorThing.thumb.png.be603e6634d234b286fc22910b2d85bb.png

Can be the solution because this line that you quoted was generic :

1 hour ago, The Undying Nephalim said:

 let plan = new m.ConstructionPlan(gameState, "structures/{civ}_house");

 Since there is a directory for each civ, Petra must be looking for a "gerudo" and "hylian" directory. This house.xml file exist in every civilization directory, except for hellenes nations which is normal because three different civs have same graphics, and carthaginians for some reasons (they have a strange name before house.xml - maybe due to there new scaffolding & damage variants feature ?). Maybe your should stack all gerudo actors in a gerudo directory, same for hylians, and remove this A, since variants are specified in the .xml file :

<group>
  <variant frequency="1" name="House A">
    <mesh>structural/maur_house_a.dae</mesh>
    <props>
      <prop actor="props/structures/mauryans/house_a_struct_b.xml" attachpoint="root"/>
    </props>
  </variant>
  <variant frequency="1" name="House B">
    <mesh>structural/maur_house_b.dae</mesh>
    <props>
      <prop actor="props/structures/mauryans/house_b_struct_b.xml" attachpoint="root"/>
    </props>
  </variant>
  <variant frequency="1" name="House C">
    <mesh>structural/maur_house_c.dae</mesh>
    <props>
      <prop actor="props/structures/mauryans/house_c_struct_b.xml" attachpoint="root"/>
    </props>
  </variant>
  <variant frequency="1" name="House D"><mesh>structural/maur_house_d.dae</mesh>
    <props>
      <prop actor="props/structures/mauryans/house_d_struct_b.xml" attachpoint="root"/>
    </props>
  </variant>
</group>

I'm not good at this so it's maybe completely wrong, but it's an idea.

Link to comment
Share on other sites

@Arcana33: you're not explaining it right. You're talking about the art actors which is something completely different from the simulation templates (and the latter is what the AI is looking for).

Petra looks for a {civ}_house.xml in /simulation/templates/structures (and '{civ}' should be replaced with the civilization code as defined in civ.json such as 'athen_house.xml')

Link to comment
Share on other sites

9 hours ago, The Undying Nephalim said:

<p class="error">ERROR: JavaScript error: simulation/ai/petra/headquarters.js line 1452

TypeError: gameState.getTemplate(...) is null

@The Undying Nephalim I asked someone who actually know something about prog and then we found something. In the error, it specifies that the error is line 1452.

let popBonus = gameState.getTemplate(house).getPopulationBonus();

Since the error type is "gameState.getTemplate(...) is null", and inside these brackets is house, we searched above how "house" was specified, we got to line 1450.

let house = gameState.applyCiv("structures/{civ}_house");

So if you want to integrate this into the code :

this.buildings =
    {
        "ai_buildfield": {
            "default": [],
            "hylian": [ "structures/hylian_farmsteadA" ],
            "gerudo": [ "structures/gerudo_pigfarmA" ]
        },
        "ai_buildhouse": {
            "default": [],
            "hylian": [ "structures/hylian_housesA" ],
            "gerudo": [ "structures/gerudo_housesA" ]
        },
    };   

You might make it here.

It's just a possibility, after all !

@niektb I can't find where the civ.json file is. Where is it, so I can try to find an answer here (even if I most likely won't since I haven't the Hyrule Conquest files).

Edited by Arcana33
Link to comment
Share on other sites

The civ.json files are in simulation/data/civs

And why don't you follow simply the 0ad naming scheme, i.e. calling your houses "structures/hylian_house" if the civ code for that civ is "hylian"? you have in the Identity component some GenericName and SpecificName (which are those seen by the player) that you can change as you like, but the template name itself should not change until somebody write the code for the AI to adapt itself to any template name.

  • Like 3
Link to comment
Share on other sites

7 minutes ago, Arcana33 said:

In fact, as he says, all buildings between each faction are radically different, so making as the game is coded for is too mind-blowing to be done properly (I hope you understand my poor English).

 This does not have much sense:

- either you have something which acts analogously to the standard game (a xzorkut for example which has the same purpose as a field and you can expect that the ai will be able to deal with it if you rename it as "field" )

- or your buildings are completely different, with different purposes, and you have to write an ai to deal with them.

  • Like 2
Link to comment
Share on other sites

Yes, logical (the old way is more confusing than this one). But in that case, where could this error come from ?

Since I'm there, could I ask two questions ?

  1. @The Undying Nephalim Are you considering traducing your game in other languages ? If yes, could I help to traduce it in French (since I'm a native speaker) ?
  2. Will there be a subforum completely dedicated to Hyrule Conquest mod, since the Hyrule: Total War community is big ?
Edited by Arcana33
Link to comment
Share on other sites

4 hours ago, mimo said:

 This does not have much sense:

- either you have something which acts analogously to the standard game (a xzorkut for example which has the same purpose as a field and you can expect that the ai will be able to deal with it if you rename it as "field" )

- or your buildings are completely different, with different purposes, and you have to write an ai to deal with them.

The latter is the problem. The current example is that the Gerudo have no farm, but the AI is busy desperately trying to make a farm before moving on.

some factions won't have houses, some won't have standard buildings at all. The problem (as I understand) is that the AI is getting hung up on building a nonexistent building, rather than just moving on to the next task

Link to comment
Share on other sites

5 hours ago, mimo said:

And why don't you follow simply the 0ad naming scheme, i.e. calling your houses "structures/hylian_house" if the civ code for that civ is "hylian"? you have in the Identity component some GenericName and SpecificName (which are those seen by the player) that you can change as you like, but the template name itself should not change until somebody write the code for the AI to adapt itself to any template name.

Mimo is right. If you name the buildings along the standard way, as close to the standard format as possible, and even trick the AI with giving class names to things and making the AI treat them according to class and get some kind of approximation of real gameplay out of the AI without having to write an entirely new AI. Classes and template names are not seen by the player, only VisibleClasses is seen by the player, put custom classes there. :)

Link to comment
Share on other sites

5 hours ago, mimo said:

And why don't you follow simply the 0ad naming scheme, i.e. calling your houses "structures/hylian_house" if the civ code for that civ is "hylian"?

Some of my factions are going to have few, if any buildings similar to the 0AD scheme other than a civil center. One of my factions is composed entirely of giant walking creatures that spawn units instead of buildings. I suppose I can try and use the same naming convention for those, hopefully it will work out.

Is it possible to have faction specific AI that is tied to the Petra AI? It might help out with some of the more asymmetrical factions that don't use houses and fields and the normal selection of buildings.


 

Link to comment
Share on other sites

55 minutes ago, LordWahu said:

The latter is the problem. The current example is that the Gerudo have no farm, but the AI is busy desperately trying to make a farm before moving on.

some factions won't have houses, some won't have standard buildings at all. The problem (as I understand) is that the AI is getting hung up on building a nonexistent building, rather than just moving on to the next task

I'm pretty sure that can't happen: if there is no farm, the ai won't try to build any. There are some maps with disabled farms (like survival of the fittest) , and that works.

Houses is another story: the ai use them for the population bonus. If you don't have houses, it won't know how to increase population, so the code is currently not protected against no houses (better have a dummy ai in that case).

Link to comment
Share on other sites

3 minutes ago, The Undying Nephalim said:

Some of my factions are going to have few, if any buildings similar to the 0AD scheme other than a civil center. One of my factions is composed entirely of giant walking creatures that spawn units instead of buildings. I suppose I can try and use the same naming convention for those, hopefully it will work out.

Is it possible to have faction specific AI that is tied to the Petra AI? It might help out with some of the more asymmetrical factions that don't use houses and fields and the normal selection of buildings.


 

Everything is possible, but that will need quite some change in the code.

Link to comment
Share on other sites

I've switched the naming conventions to that of 0AD and the AI seems to be working mostly fine. Their build up workers and houses and barracks and guard towers and everything.

However, neither of my two factions have fields or corrals so every once in awhile they are trying to build them and the AI freaks out with a looping error:

<p class="error">ERROR: JavaScript error: simulation/ai/petra/worker.js line 836<p class="error">ERROR: JavaScript error: simulation/ai/petra/worker.js line 836
	let maxGatherers = gameState.getTemplate(gameState.applyCiv("structures/{civ}_field")).maxGatherers();

Is there anyway I can make it so the game just ignores this part of the AI since these two factions do not have fields or corrals?

Link to comment
Share on other sites

yep, seems that there is a missing protection in that function when the field template does not exist. You should add

if (!gameState.getTemplate(gameState.applyCiv("structures/{civ}_field")) return false;

before the line let maxGatherers = ...

That should be enough

  • Like 1
Link to comment
Share on other sites

35 minutes ago, mimo said:

yep, seems that there is a missing protection in that function when the field template does not exist. You should add

if (!gameState.getTemplate(gameState.applyCiv("structures/{civ}_field")) return false;

before the line let maxGatherers = ...

That should be enough

That seems to have solved it, although it needed an extra ).

That should do for the AI of these two factions, I'll revisit this when I get to some of the more weirder factions. ;)

  • Haha 1
Link to comment
Share on other sites

26 minutes ago, The Undying Nephalim said:

That seems to have solved it, although it needed an extra ).

That should do for the AI of these two factions, I'll revisit this when I get to some of the more weirder factions. ;)

I feel like you're going to have a bad time when it comes to maintaining your changes. Make sure you work very closely with the team and maybe you can get some of your changes implemented into the public mod code when applicable.

  • Like 1
Link to comment
Share on other sites

1 minute ago, wowgetoffyourcellphone said:

I feel like you're going to have a bad time when it comes to maintaining your changes. Make sure you work very closely with the team and maybe you can get some of your changes implemented into the public mod code when applicable.

I suspect what I might end up doing is having two different versions of the mod. One using the latest public build and then another with the dev version. As I mentioned my problem is that I try and bring out frequent releases. If you track my history with the total war version of the mod I generally released two new factions every 3-4 months and I hope to do the same with the 0AD incarnation of the mod. I don't want to have to wait around for months until the devs release a new public version of 0AD so that I can release my mod to the public. I also worry that asking people to download the dev version to play my mod might be too complicated for the average player. I get complaints from people about getting my total war version of the mod to work when it turns out they installed it in the wrong folder. :rolleyes:

  • Haha 2
  • Confused 1
Link to comment
Share on other sites

Components (which is why they are sometimes called cmpSomething) can either be C++ or JS (or C++ interface with JS implementation). So in that specific case you should be looking at files in source/simulation2/components/, specifically CCmpVisualActor.cpp. For some more information about components read up about entity-component systems (in general and [1] and then possibly the docs about how to write those (which are not only useful for that, but might also help understanding how to use them if you are looking for slightly more details).

The rough idea I had (as a follow-up to D842) would be to reuse cmpPosition in cmpVisualActor's Update to get whether we are currently floating, and if yes switch to "swim" instead of "walk".

Also note that changing C++ code will require a rebuild of the engine, see [3].

[1] https://trac.wildfiregames.com/wiki/SimulationArchitecture
[2] https://svn.wildfiregames.com/docs/writing-components.html
[3] https://trac.wildfiregames.com/wiki/BuildInstructions

  • Like 1
Link to comment
Share on other sites

18 hours ago, wowgetoffyourcellphone said:

I feel like you're going to have a bad time when it comes to maintaining your changes. Make sure you work very closely with the team and maybe you can get some of your changes implemented into the public mod code when applicable.

Yeah, I definitely agree that getting any generic, multi-purpose changes added to the main game is the best case scenario to limit future maintenance. I think the things like swimming in water, etc. are probably generic enough to be added because there are a lot of modders that would like those features.

 

17 hours ago, The Undying Nephalim said:

...I generally released two new factions every 3-4 months and I hope to do the same with the 0AD incarnation of the mod. I don't want to have to wait around for months until the devs release a new public version of 0AD so that I can release my mod to the public.

There are new public releases for 0 A.D. around twice a year. While that's not as fast as 3-4 months, it might be worth waiting. I think for your more ambitious players that can't wait, they would need to apply your mod to the dev version of the game. If most of your players use windows, then they could use the autobuilt exe in the dev version and wouldn't have to build it themselves. This makes it much easier to use the dev version because your players won't have to worry about setting up all of the dependencies needed for compiling. The only other option is to package the dev version, but that's a significant time investment for something that is potentially buggy.

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