Jump to content

Help with my first test mod please...


krt0143
 Share

Recommended Posts

Hi guys. :hi:Please bear with me, I'm a fairly experienced modder, but totally new to 0AD.

 

What I'm trying to do at this point is to just get a hang for the /mods folder structure and how things are connected.

So I created a little test mod, put a "/Test" folder in /mods, added the required "mod.json", then added "art" and "simulation" folders in it (and so on), and finally copied an existing Briton hero's templates and art, and just changed the name. Can't get more basic...

Now it appears inside the game, and the game loaded it without complaining, but when I try to start a skirmish game using the Britons, the game spams a dozen chat line errors I don't have the time to understand... The only thing I manage to spot is the conclusion, the game didn't manage to "validate" my mod. What does that even mean? (And what can I do about it?...)

 

Is there a way to stop or record those errors the game emits and almost immediately removes? They don't seem to be stored anyway, and having those error logs would really help to understand what the game is unhappy about, especially when I start to do more elaborate things than duplicating existing resources!...

I mean, if I don't even manage to create a copy of an existing unit, how am I supposed to do anything halfway serious? :(

Thanks in advance.

Link to comment
Share on other sites

1 hour ago, krt0143 said:

Hi guys. :hi:Please bear with me, I'm a fairly experienced modder, but totally new to 0AD.

 

What I'm trying to do at this point is to just get a hang for the /mods folder structure and how things are connected.

So I created a little test mod, put a "/Test" folder in /mods, added the required "mod.json", then added "art" and "simulation" folders in it (and so on), and finally copied an existing Briton hero's templates and art, and just changed the name. Can't get more basic...

Now it appears inside the game, and the game loaded it without complaining, but when I try to start a skirmish game using the Britons, the game spams a dozen chat line errors I don't have the time to understand... The only thing I manage to spot is the conclusion, the game didn't manage to "validate" my mod. What does that even mean? (And what can I do about it?...)

 

Is there a way to stop or record those errors the game emits and almost immediately removes? They don't seem to be stored anyway, and having those error logs would really help to understand what the game is unhappy about, especially when I start to do more elaborate things than duplicating existing resources!...

I mean, if I don't even manage to create a copy of an existing unit, how am I supposed to do anything halfway serious? :(

Thanks in advance.

Don't worry that the learning curve in creating mods in 0ad is very fast, with a little time you will be able to create units, civ and structures with ease.

  • Like 2
Link to comment
Share on other sites

The mod.json is pretty simple, I don't see how anyone could make an error there:

{
	"name": "mytest",
	"version": "0.1",
	"label": "Boudicca copy",
	"description": "Adds a copy of Boudicca to the Britons",
	"dependencies": ["0ad=0.0.26"]
}

Anyway, I managed to make it go away. Don't ask, I don't know...

But it's probably related to my new question: The specific hero file points to a template, which points to a template, which points to a template! I understand this is the famous "include" principle, but I noticed there is some duplicate information in those files, like cost and resistance for instance. Do those values stack or did I misunderstand?

What if I assemble them all to one (differently named) file? I would, but I'd have to know what to do with the redundant entries.

 

What I'm trying to do right now is to make Boudicca available from the very beginning (just so I can see if it works without having to play for 15 minutes), and also create her from the Town Center. I copied the 3 relevant hero templates, renamed them, and it worked indeed. Unfortunately I'll have to play a little to see if the other heroes have been affected or not.

Yes, it's easy indeed, but not really newbie-friendly. Programmers will have it easier.

  • Like 1
Link to comment
Share on other sites

1 hour ago, krt0143 said:

Anyway, I managed to make it go away. Don't ask, I don't know...

But it's probably related to my new question: The specific hero file points to a template, which points to a template, which points to a template! I understand this is the famous "include" principle, but I noticed there is some duplicate information in those files, like cost and resistance for instance. Do those values stack or did I misunderstand?

The 'child' template inherits the values from the 'parent' and may update that information and/or add new qualities. So template_unit_champion_infantry_spearman.xml has a cost defined but units/gaul/champion_fanatic.xml, which inherits the champion infantry spearman template has a section giving a new cost profile to the unit.

So they don't stack, they are just the new values.

1 hour ago, krt0143 said:

I copied the 3 relevant hero templates, renamed them, and it worked indeed. Unfortunately I'll have to play a little to see if the other heroes have been affected or not.

Sounds like it worked.

Another way to do this would be to add this to the <identity> section of hero_boudicca.xml:

    <Requirements>
      <Techs datatype="tokens">-phase_city</Techs>
    </Requirements>

Since heroes inherit the requirement to be in phase city, the - sign means it is removed for boudicca.

Then to train her from the CC, add a line to <Trainer> in structures/brit/civil_center:

      units/brit/hero_boudicca

 

  • Like 1
Link to comment
Share on other sites

Sorry for having suddenly disappeared yesterday, but newcomers are definitely unwelcome here: Being a nasty noob I am apparently only allowed 3 posts in 24h. That sure helps having a meaningful discussion. :shocking:

(Yes, yes, I know, it's in case I suddenly reveal myself being an eeevil spammer (who spent many hours trying to understand the game and post relevant stuff, just for a chance to shortly advertise his fake meds); I sure question the point, since my first posts needed moderation anyway, moderators know I'm not a spammer.)

Anyway, until I eventually get to be a full person one day, I'll need to cram everything in 3 posts/day.
Here goes:

 

22 hours ago, Gurken Khan said:

Might wanna check out the cheats which for example advance you a phase or two: https://0ad.fandom.com/wiki/Cheats

:laugh: Yes, I see what you think, but no... My goal here is not to give me a GF, or make me invincible, but just to learn how to make new types of units. I chose to make a copy of a hero unit because they are unique, and thus easier to control: When you buy Boudicca in the game she comes as spear-chucking cavalry (according to the description), I made a sword-wielding infantry unit out of her, just to be sure who is who.

(Besides if I really needed an overpowered unit to make the game easy, I'd make the arsenal a first age building: Nothing can resist a couple rams...)
 

22 hours ago, real_tabasco_sauce said:

The 'child' template inherits the values from the 'parent' and may update that information and/or add new qualities. So template_unit_champion_infantry_spearman.xml has a cost defined but units/gaul/champion_fanatic.xml, which inherits the champion infantry spearman template has a section giving a new cost profile to the unit.

Thanks. So, identical values are replaced. Interesting.

1. What about duplicate <Identity> tags with different or identical contents (like "<VisibleClasses datatype="tokens">Soldier Hero</VisibleClasses>", "<VisibleClasses datatype="tokens">Infantry</VisibleClasses>", "<PreferredClasses datatype="tokens">Unit+!Ship</PreferredClasses>")?

I guess at least the different types stack, but what about the contradicting ones? Replacement, here too?

2. What is resource cost "op", compared to the non-"op" ("<wood>200</wood>" and "<wood op="add">-50</wood>"? Is this a modifier, like "add -50 to 200" (which would mean "150")?
There is a similar issue in Resistances: "<Hack>8</Hack>" and "<Hack op="add">4</Hack>".

I'm trying to get rid of DLL Hell... I'll be making a whole civilization, but I do not need cascading templates, it will not have thousands of mostly similar units...  :rolleyes:

3. What are those ".cached.xmb" binary files I find all over the place? (How do you read them? Do you need to read them, or are they just a compiled version of the .xml file? The only ones not having an .xml sibling seem to be maps. )

-----------------------------------

4. I tried the Map editor and it crashes a lot. More often than not, actually. I can even make it reliably crash on command by asking it to generate a "huge" map of the "Caledonian Meadows" type...  :rolleyes:
And even when it doesn't crash long enough for me to manage to save a generated map (just a randomly generated map with 2 added houses, so I know it's mine), it is unplayable in the game (gives errors, errors, and the houses I've placed are missing)...
Is this normal? I guess not, so what am I doing wrong?

I guess the "Actor Editor" (in /system) hasn't been updated in ages, it doesn't recognize any file I've asked it to open (in Windows), but I would had expected the map editor to be halfway stable. What do you people use to make maps?

-----------------------------------

5. And let's get to the "piece de resistance". I would had posted a new thread about it, but since I'm a underprivileged newcomer I'll have to stuff it in here:

Civilization data?

Let's assume I would want to add the Celts as a civilization, where I would need to declare it, before even starting to add units?

All civilization definitions seem to be in /public/simulation/data/. But, looking at the definitions in /civs I get the nagging feeling I'm again in DLL Hell, and those files reference some other file, which this time isn't mentioned... Where would that be? For instance, where do you find the full screen name and description of any given civilization?

Are there some files which say which units every civilization can have? Or do they just take anything you put in /templates/units/myCiv (provided of course some building can train it)?

That's all for the time being. Thanks for your help guys.  :thumbup:

 

Link to comment
Share on other sites

10 minutes ago, krt0143 said:

:laugh: Yes, I see what you think, but no...

Huh? If I just want to check out something in p3 I use gift from the gods and just go about it; you wrote you didn't want to play 15 minutes before you can check something...

Just so you know: I'm reporting you to the moderation team.

Spoiler

To see if they can eliminate your posting limit. ;)

 

Link to comment
Share on other sites

5 hours ago, krt0143 said:

Sorry for having suddenly disappeared yesterday, but newcomers are definitely unwelcome here: Being a nasty noob I am apparently only allowed 3 posts in 24h. That sure helps having a meaningful discussion. :shocking:

(Yes, yes, I know, it's in case I suddenly reveal myself being an eeevil spammer (who spent many hours trying to understand the game and post relevant stuff, just for a chance to shortly advertise his fake meds); I sure question the point, since my first posts needed moderation anyway, moderators know I'm not a spammer.)

It happened to me earlier. It seems like a reasonable rule. I asked for help and they cleared the ban on my account.

Link to comment
Share on other sites

17 hours ago, Gurken Khan said:

Huh? If I just want to check out something in p3 I use gift from the gods and just go about it

Not used to this yet. But still, doing it that way allowed me to check the "how-to-build" part of units.

 

17 hours ago, Gurken Khan said:

Just so you know: I'm reporting you to the moderation team.

  Reveal hidden contents

To see if they can eliminate your posting limit. ;)

Thanks!...

 

10 hours ago, hyperion said:

1&2 Default is replace, then there are ways to do something different.

3. xmb files in the mod are pre cached files as to speed up initial loading, if you delete them they are generated on the fly.

4. RAM, the Windows build is 32-bit, so either use Linux or Mac or keep things small...

Thanks!

About #4 - Do you mean to say that the Windows version can't handle maps bigger than "tiny"? :blink:

Please confirm/infirm, because that would be a problem...

(Well, my primary OS is Linux, but I play it under Windows because the official repository version is outdated (v.25) and won't probably ever be updated. And no, I don't feel like compiling it myself...)

Link to comment
Share on other sites

11 hours ago, krt0143 said:

About #4 - Do you mean to say that the Windows version can't handle maps bigger than "tiny"? :blink:

Don't know where the cut off is, little bigger than tiny should still be fine tho. Giant certainly will crash.

There are also snap, flatpack and appimages for linux, see https://github.com/0ad-matters/0ad-appimage/releases/tag/v0.0.26-alpha

And building from source is rather easy for linux unlike for windows and if you are modding it's probably the best to do so in the long run anyway.

Link to comment
Share on other sites

13 hours ago, hyperion said:

Don't know where the cut off is, little bigger than tiny should still be fine tho. Giant certainly will crash.

OMG! That's really, really bad! Almost a deal breaker, I like big spaces. In AoE I only played on "huge" maps...

Why don't they (also) compile it in 64-bit?
I mean, Linux and Windows are both 64-bit nowadays, and even the few people still on older computers are bound to upgrade eventually (I know, I'm one of those hold-outs; Since I only use Windows for games I kept to my old-but-beefy Win7 box until after 15 years the magic smoke left it... :laugh:).

Crap, I'm afraid I'll have to put 0 A.D. on wait till they start allowing full sized maps. :down:

 

13 hours ago, hyperion said:

There are also snap, flatpack and appimages for linux.

I know, but I don't know how much those self-contained formats affect modding. I'd rather stick with vanilla, old-school installations, to keep things simple and problems easier to spot.

Anyway, unless Linux allows big maps the point is moot: I tried creating aforementioned "Caledonian meadows" random map in "giant" (not even "huge") and the Linux map editor crashed just the same. :(

Link to comment
Share on other sites

14 hours ago, hyperion said:

Giant certainly will crash.

It's not entirely correct. OOM crashes highly depend on a map. I don't remember any local crash because of OOM during first few minutes on a random map.

1 hour ago, krt0143 said:

Why don't they (also) compile it in 64-bit?

It's a complicated process and we're working on that: #2611

1 hour ago, krt0143 said:

Anyway, unless Linux allows big maps the point is moot: I tried creating aforementioned "Caledonian meadows" random map in "giant" (not even "huge") and the Linux map editor crashed just the same. :(

I successfully generated that map in a "Giant" size and it consumes 1.6 GB (there is a room before 3GB/4GB depending on a Windows version) on Windows when revealed and the whole map is visible. So a reason of your crash doesn't seem in a regular out of memory. Could you share you system info, crash files and run the game with GDB to retrieve a stack?

Link to comment
Share on other sites

14 minutes ago, vladislavbelov said:

It's a complicated process and we're working on that: #2611

Great! :yahoo:
That been said, according to the linked thread, progress is glacial at best. I'm of the older persuasion, I wonder if I'll live long enough...

 

16 minutes ago, vladislavbelov said:

I successfully generated that map in a "Giant" size and it consumes 1.6 GB (there is a room before 3GB/4GB depending on a Windows version) on Windows when revealed and the whole map is visible. So a reason of your crash doesn't seem in a regular out of memory. Could you share you system info, crash files and run the game with GDB to retrieve a stack?

You did? As I said I tried on both Windows (0 A.D. 0.0.26 on Win11 64-bit, 32GB of RAM, Intel Core i7-12700H, NVIDIA GeForce RTX 3070 Ti 8Go, everything up to date), and Linux (0 A.D. 0.0.25 on Mint 21.2 64-bit, same specs, everything up to date).

Windows (0.0.26) crash sometimes briefly displays a map and only says "error formatting error message" :rolleyes:
The Linux (0.0.25) crash was more articulate, it showed me a persistent error panel stating:

Assertion failed: "!EntityExists(ent)"
Location: ComponentManager.cpp:770 (AllocateEntityHandle)
(lots of stack info I didn't memorize)

What do you need? What is "GBD"?
I'm not a developer, just a savvy user having started tinkering with games on a 2-floppy IBM PC running DOS 2...

Link to comment
Share on other sites

1 hour ago, krt0143 said:

That been said, according to the linked thread, progress is glacial at best.

Yes, it's not a fast process. We're pretty limited in available developers but we're still moving forward.

1 hour ago, krt0143 said:
Assertion failed: "!EntityExists(ent)"
Location: ComponentManager.cpp:770 (AllocateEntityHandle)
(lots of stack info I didn't memorize)

It looks similar to #6658, so it might be a template problem rather an out of memory.

1 hour ago, krt0143 said:

What do you need? What is "GBD"?

GDB is a debugger, it also allows to retrieve a stack information.

Link to comment
Share on other sites

On 06/09/2023 at 3:28 PM, krt0143 said:

Sorry for having suddenly disappeared yesterday, but newcomers are definitely unwelcome here: Being a nasty noob I am apparently only allowed 3 posts in 24h. That sure helps having a meaningful discussion. :shocking:

(Yes, yes, I know, it's in case I suddenly reveal myself being an eeevil spammer (who spent many hours trying to understand the game and post relevant stuff, just for a chance to shortly advertise his fake meds); I sure question the point, since my first posts needed moderation anyway, moderators know I'm not a spammer.)

Anyway, until I eventually get to be a full person one day, I'll need to cram everything in 3 posts/day.

Sadly, we get at least one triplet of spam posts per day, usually the mods delete them pretty quickly, but imagine there was no post limit,,,

On 06/09/2023 at 3:28 PM, krt0143 said:

(Besides if I really needed an overpowered unit to make the game easy, I'd make the arsenal a first age building: Nothing can resist a couple rams...)

Done: https://code.wildfiregames.com/rP27828. ;P

On 07/09/2023 at 9:06 AM, krt0143 said:

(Well, my primary OS is Linux, but I play it under Windows because the official repository version is outdated (v.25) and won't probably ever be updated. And no, I don't feel like compiling it myself...)

Compiling by yourself does have the benefit of rolling updates. :)But more seriously, what distro do you use? If it doesn't have A26 yet, you should probably move on. Source: https://repology.org/project/0ad/versions.

On 08/09/2023 at 10:18 AM, krt0143 said:

Anyway, unless Linux allows big maps the point is moot: I tried creating aforementioned "Caledonian meadows" random map in "giant" (not even "huge") and the Linux map editor crashed just the same. :(

Does it crash always when loading that map? And only with "giant" and above? Is this with your mod enabled? If so, do you have some public place we can view the mod? (e.g. GitLab or something.)

Link to comment
Share on other sites

2 hours ago, vladislavbelov said:

It looks similar to #6658, so it might be a template problem rather an out of memory.

GDB is a debugger, it also allows to retrieve a stack information.

I'll take your word for it...
Whatever it is, it appears in both Windows and Linux versions of the map maker, so it's a common function.
Also, the Windows error handler can't handle it!... :laugh: It just says so for a second or two, and then the program closes. Linux at least gives the full error handler window with options.

As for GDB, I neither have it, nor would I know how to use it. Sorry...

 

 

1 hour ago, Freagarach said:

Sadly, we get at least one triplet of spam posts per day, usually the mods delete them pretty quickly, but image there was no post limit,,,

Yeah, I've been admin for over 10 years on a hobbyist forum, so I know the problem all too well. That been said, my first post isn't what a spammer would usually post (some generic comment, or a out-of-topic cut/paste from elsewhere on the forum)...
Oh well.

 

1 hour ago, Freagarach said:

"Differentiate Macedonia"? :huh:
Care to elaborate?

 

1 hour ago, Freagarach said:

Compiling by yourself does have the benefit of rolling updates. :)But more seriously, what distro do you use? If it doesn't have A26 yet, you should probably move on. Source: https://repology.org/project/0ad/versions.

I don't want rolling updates, I just want to play (and mod)!... :P

As I said further up, I'm on Mint 21.2 (= Ubuntu 22.04 "Jammy Jellyfish" - an LTS). As your website states, the official repo has .25, but also a flatpack which might/should be .26 (I don't know, since they are named "version 4" and "version 5". Go figure.).

The "old versions in repo" issue is as old as LTS versions are, but normally I don't mind, I don't need the latest and fastest except for games, and usually I play those on Windows where I do have the latest and fastest.

 

2 hours ago, Freagarach said:

Does it crash always when loading that map? And only with "giant" and above? Is this with your mod enabled? If so, do you have some public place we can view the mod? (e.g. GitLab or something.)

Loading? It's the map editor which crashes. I only managed once to save a map and try to load it in the game.

How do I do it? I select a map template in the dropdown menu, and click "generate map". Usually it manages to create the map, and I try to change/add some stuff to it, just to make sure it's my own map. At this point, sooner or later the map editor complains about something and leaves. If I manage to save (only managed once in 4-5 attempts!), the resulting map can be loaded in game, but is missing the 2-3 buildings, trees and stuff I added, and the game spams a dozen chat lines complaining about stuff I don't have the time to read, much less understand.

My mod right now is just a 1:1 copy of a Briton hero unit, using the existing game files. I just copied and renamed the templates changing the name. I can't imagine how this could possibly make the map editor crash (the game doesn't complain), but I'll try unloading it. :shrug:

But yes, all the maps I've tried to make were big.
I don't like tiny maps, I need space... Besides the game already provides a slew of tiny, claustrophobic, but otherwise excellent maps to play in, there is no need to make more of those. What I'm missing, and thus try to make, is big 2 player (or more) maps, maps where the opponent isn't right behind the edge of the fog of war...

 

Link to comment
Share on other sites

Okay, having badmouthed the editor, I feel I needed to do it some justice... 

The random map generation feature is buggy and often crashes for giant maps, that's for sure, but beyond that the editor works quite well, even if it isn't very intuitive (at all). For instance, one would expect it to work like the game, but no, it has its very own (and undocumented...) way of working. Took me a couple days just to find how to simply scroll around, rotate items, and other basic things like that...  :search:

 

Link to comment
Share on other sites

14 minutes ago, seeh said:

may take a deeper look at
https://trac.wildfiregames.com
https://trac.wildfiregames.com/wiki
you know that links?

Thanks.

I think I solved the initial problem (although I'll never know what it was): I've been trying lots of things lately (creating new units and such), it all works and doesn't throw any errors anymore, so I guess I'm doing it right. :shrug:

 

18 minutes ago, seeh said:

do you use linux OS?

Yes, and no: I normally use Linux, but for 0 A.D. I use Windows I've kept just for games. As I explained further up this thread the Linux repo version is outdated (0.0.25), and I'm too lazy to check how to get the newest one, since I can have it on Windows... :rolleyes:

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