Any Good Sites That Teach XML?

Started by TheManWithoutAPlan, September 19, 2017, 12:49:01 AM

Previous topic - Next topic

TheManWithoutAPlan

I'd like to mod Rim world but I lack coding knowledge.
From what I know this piece of art uses XML so are there any free recommendable XML-teaching sites?

Jibbles

#1
There are tutorials in the mod help section and on wiki.  Here's one for weapons.
http://rimworldwiki.com/wiki/Modding_Tutorials/Weapons

This list is old I think. Not sure if it gets updated or not, but I don't think I've seen it on these forums and sometimes hard to find in a search. Just gives you an idea on what some of these things do. I would not copy tags from here since some of them might not work, but simply use it as a guide.
http://rimworldwiki.com/wiki/ThingDef

Look through some of rimworlds xml files, and look at other mods.  You'll see it's a pretty easy thing to grasp when it comes to xml. Just be aware that it has its limitations.  Some ideas that you have for modding may require C#. There are tutorials for that too.

b0rsuk

Good sites don't teach XML. Good sites teach YAML, or even its subset .json. XML is like violence - if it doesn't work, you need more and more of it.

hoffmale

First off, XML (= eXtensible Markup Language) is a data description language. It is (usually) only used to represent data (e.g. save files or config files). If you just want to add or modify data of existing things (e.g. add colonist textures or speed up plant growth), that should be mostly enough. However, if you want to add new things or change the behavior of existing things (e.g. change the UI or add a mechanoid production facility), you will need to write the logic for that in a real programming language (in case of RimWorld, this is usually C#).

TL;DR: RimWorld uses XML for data and C# for logic.

But in any case, just learning the language is not enough. The basic structure of XML is so simple one can describe it in 2 paragraphs. Instead, one has to learn/decipher which format is expected for the data you want to represent.

<?xml version="1.0"?>
<rootTag>
  <tag attribute="value">This tag has an attribute</tag>
  <emptyTag/>
  <tag>
    <nestedTag>You can nest tags as deep as you want</nestedTag>
  </tag>
</rootTag>


This is by any means valid XML. But will RimWorld (or any other program using XML config/save files) accept it? Highly unlikely. They expect a certain structure of specific tag names and attributes that they know and this sample is unlikely to have any of them. Those programs will either ignore anything they can't understand or somehow inform you that the file didn't match their expectation.

If you want to write or modify data that RimWorld understands, you need to learn the format RimWorld expects its data.
Along the same lines, if you want to program new ingame entities for RimWorld, you will need to understand how they will be saved and loaded, so you will need to understand the save file format, too.