Broken Project… again

CivilizationAce

Warlord
Joined
Jan 17, 2017
Messages
240
Has anyone found out ways to break a project?

I ask because I keep managing to do it and I seldom have any idea how. I code for a few hours and when I try to build or run it doesn't work. I can even remove or comment out almost all the functional code and I'll still have something that won't build or won't run. I end up tearing my hair out at having wasted hour and hours of my time on something that's broken for no apparent reason, or worse for a reason that would be obvious to whoever should have written us an official guide by now.

There's so much detail that I don't understand that it seems to be impossible to code for long, regardless of how innocuous the code seems, and end up with something that will work. It's frustrating because I'm a programmer and I'm used the existence of official and comprehensive documentation for any language or API.

The list of stuff I don't understand includes, but is no doubt not limited to:
  • Build actions.
  • The interaction of xlp files and tex files.
  • The purpose of xlp files period.
  • How to differentiate between references to the mod files and references to the base files.
  • Does order matter in any of the xml format files?
  • Does it matter if mod files have the same name as base files?
  • Does the order files are added to the project properties matter?
  • Why some files need to be added to the project properties and others don't and which sections which files need to be in.
  • Which parts of which files are irrelevant and which have to match other sections of the same or other files.
    • I know some of this, but it's a big subject.
  • What the different sections of Mod.Art.xml do.
  • What criteria are and why there's at least one hidden one.
  • What domains are and does it matter if I comment them out.
  • Why some .dds files cause the project to fail to build for no apparent reason.
  • Can non defined text ever be the reason for a crash?
  • Can odd characters in text even cause a crash?
  • How to tell what caused a game to fail to start or the program to fail to load.
As far as I can tell there's no information available on any of the above, but I'm sure someone must have resolved at least one of them, so please help.

Let's get some of this information down in black and white where we can all see it, to at least confirm assumptions people have been making so they can stop worrying that those assumptions could be the cause of their problems.
 
Okay, so I'm definitely not an authority, but here's what I know:
  • Build actions.
I presume you mean stuff like UpdateDatabase actions, etc. There's two categories, Front-End Actions and In-Game Actions. Front-End stuff is used for the Leader Select screen, and top-menu stuff. There is very little in a given mod that is necessary to put in the front-end. In-Game stuff loads in when you start the game, so basically everything else. For both categories, the action types are the same: UpdateText is only for the LocalizedText entries, UpdateIcons is just for the IconTextureAtlases and IconDefinitions, UpdateArt is where your .dep file goes (or, if you're using ModBuddy, you can just use the (Mod Art Dependency File) option), and UpdateDatabase is where literally everything else goes. There might be other stuff that goes in the other actions, but the majority of your stuff will be in the UpdateDatabase action. AddMap and AddWorldBuilderMap seem pretty self-explanatory, but I've no idea what they do specifically, and ImportFiles I'm not using in my mod at all, so I don't know what you'd use it for (for reference, I got leaders and civs in the game with pretty much all images in their proper place without using this action). If you don't put a file in a build action, it will not appear in-game, even if the steam uploader takes it and puts it into your end package, and even if it's in your ModBuddy structure. For example, I'm making a pack of mods with multiple civs and leaders, but I've only set one or two civs/leaders' files in the build actions, so all the other files are ignored.
  • The interaction of xlp files and tex files.
  • The purpose of xlp files period..
I'm still fuzzy on most of this myself, but here goes. tex files tell the game engine about your dds image. Basic stuff, like size and mipmaps. xlps take those tex files, give them context, and make them game objects; the tex file and xlp entry can have different names, but it's the xlp name the game cares about. artdef files use some of those xlp entries to relate your new images to other game objects (what a leader uses for his diplomacy image, for example). That's all I really feel confident saying.
  • How to differentiate between references to the mod files and references to the base files.
Once your variables are defined, there is functionally no difference between mod assets and base-game assets. The base game assets are mostly added in the same way you would add in your custom assets, via xml, asset editor, etc. I'm not sure what you mean by 'references', though.
  • Does order matter in any of the xml format files?
It shouldn't, with one notable exception. For the most part, you can (and have to) add info to one table that relies on another table's info further down, etc. It all seems to load into the database, then build relationships between everything, etc. The exception is when you have an error in an xml (and probably sql) file, like referencing an invalid/nonexistent value; when this occurs, the game's engine stops reading the file, meaning any code below the exact line where your error is won't be loaded into the game. This can cause bugs where your custom district appears, but doesn't have any of its yield modifiers or civ dependencies.
  • Does it matter if mod files have the same name as base files?
Files, probably not. Variables, absolutely. In terms of replacing base-game files, I know in Civ 5 it was somewhat common in more complex stuff, and outright necessary sometimes, to change some of the lua stuff, but I'm not sure how exactly it works for Civ 6, or how necessary it is. For xml/sql, I don't think you need to worry about it, for lua, I'd check with an expert first. And just to be clear, variables, like CIVILIZATION_AZTEC or MODIFIER_ALL_PLAYERS_ATTACH_MODIFIER, if you add an element to the same table with the same name, the game will NOT like it, throw out an error, fail to load the rest of the file, the works. Maybe even crash.
  • Does the order files are added to the project properties matter?
I don't think so, same reason as above, but maybe if you have 2 lua files that hook onto the same function, the order they execute in could probably be determined by the load order.
  • Why some files need to be added to the project properties and others don't and which sections which files need to be in.
Art files don't generally need to be added to the build actions, as pretty much all of it is included in the .dep file that's generated when you build your project (in ModBuddy). Everything else needs the appropriate build action. See above.
  • Which parts of which files are irrelevant and which have to match other sections of the same or other files.
    • I know some of this, but it's a big subject.
For the most part, the game will fill in values in a table entry with the default value, unless specified otherwise. So, for most units, you don't need to provide the Bombard value, because if left blank it will default to 0. So, the short answer is, you only need to fill in exactly what you need. For a dummy building or unit, you might just have 3-4 lines, and don't need to define the cost, for example. As for what exactly you need, it's easy enough to just follow other mods' structure and contents.
  • What the different sections of Mod.Art.xml do.
Not entirely sure, but I know you need to add stuff your xlps define to the relevant sections. The package name of your xlps needs to be added to the relevant library in the mod.art file. For example, my UI/Icons package had to be added to the UITexture library before my icons would show up in-game.
  • What criteria are and why there's at least one hidden one.
Don't know.
  • What domains are and does it matter if I comment them out.
The only things called 'Domains' are the unit domains, ie. DOMAIN_LAND, DOMAIN_SEA, and DOMAIN_AIR. These are very much necessary, it tells the game what kind of unit your unit is, ie if it is an air unit and needs to move from base to base and has an operational range, whether they can move on land, etc. I think those are the only 3 domains, actually; pretty simple. Also, if that's not what you meant with this question, let me know.
  • Why some .dds files cause the project to fail to build for no apparent reason.
Um, don't know what specifically you're talking about here. I've not encountered any issue like that.
  • Can non defined text ever be the reason for a crash?
If you fail to define text in a LocalizedText entry, it shouldn't cause a crash, it would just appear as its variable name instead, ie LOC_CIVILIZATION_AZTEC_NAME or something. If, however, you try to define a text variable that already exists in the database, then it will crash, or at least error.
  • Can odd characters in text even cause a crash?
No idea. Though in my mod, ModBuddy recognized the newline character as 2 empty boxes, so I kind of doubt it would outright crash it, maybe just show weird text symbols.
  • How to tell what caused a game to fail to start or the program to fail to load.
The log files. Documents\My Games\Sid Meier's Civilization VI\Logs. Most often the database log, though occasionally the lua or UserInterface logs, maybe. Most of them stay pretty empty, and most of them can catch different kinds of errors, so it's good to look through many of them, so you can tell when something new appears. I can't remember if there's a setting you need to enable to have the logs populate, but you might look into that if you can't find them.


*DEEP INHALE*
Okay, that was that. Hopefully I helped, hopefully others can shed light on the things I don't know or am straight up wrong about. Also, it's good to get these questions cleared up, but this thread isn't going to become any sort of community resource, especially with a title like that. Hopefully people reply with enough relevant info that someone can take it and make a tutorial thread out of it, though, so ask away.
 
I'm not sure what you mean by 'references'
For instance, if you use ModBuddy to make the example new unit the mod's Units.artdef will have a line in it, "<m_ArtDefPath text="Units.artdef"/>". There's a Units.artdef in the base files. So we have a file name in a document and two possible locations for the one it references. How, in any particular instance are we meant to know whether it refers to the base version or the mod's version? And how do we ensure that it references the version we want it to? How do we ensure that when we add a file name we're not making a broken link because the way we've added it references the base (where we can't, or would rather not, put our file)? How do we take a copy of an element from the base that includes a file name reference (that obviously references the base) and make our copy of it reference a new file we've made in the mod?

Pretty basic stuff, if we had an official guide.
 
Documents\My Games\Sid Meier's Civilization VI\Logs. Most often the database log
Thanks for this. It's already got my latest mod at least able to start a game (and I expect that it'll solve many more problems in the future, particularly as I'd quoted out slews of code looking for the problem).
 
Back
Top Bottom