Ok, there is a lot to read so sorry if i got dizzy and forgot one of your points. I will answer each thing you ask since the starting post.
-I’m considering trying to make my own character sprites for a tileset. However I have little modding and coding experience, and I’m unsure of where to start.
Well, you have come to the right place! I’ll try to help.
-My current plan is to edit an existing tileset and I have already changed the appearance of some of the wearable sprites more to my taste in the ChestHole tileset. But I’m unsure of how to code the orientation of equipment so that, for example, wearing pants causes the pants sprite to appear over the legs area of the player sprite.
This will be a rather easy explanation if you know hoe the code works. In any case, i will answer like if you didn’t know.
This is what you will see when you open the Chesthole Tileset folder.
It’s really clean, and we only see the Tiles image, the Fallback image, the Tileset.txt and the Tile_config. I’ll explain each one.
The Tiles image contains all the sprites/tiles you’ll use in your tileset. It does not have an especific size, and it can be as large as you want.
The Fallback image contains all the sprites the game will use if it finds an object that has not been assigned a tile for. It’s pretty cool.
The Tileset.txt contains something like this:
#Generated from project in Cataclysm DDA Tileset Studio
#Name of the tileset
NAME: ChestHole
#Viewing (Option) name of the tileset
VIEW: ChestHole
#JSON Path - Default of gfx/tile_config.json
JSON: ChestHoleTileset/tile_config.json
#Tileset Path - Default of gfx/tinytile.png
TILESET: ChestHoleTileset/tiles.png
Now i will explain each thing.
#Generated from project in Cataclysm DDA Tileset Studio //This was automatically added by the tileset studio. If you use it, you will get that. Don’t erase it, not because it would cause problems, but because it’s nice to credit.
#Name of the tileset //Also, each line starting with a # is not read by the game, IIRC. Only the lines without it.
NAME: ChestHole //This is the ingame name of your tileset. I think it should not have spaces, but i don’t know.
#Viewing (Option) name of the tileset
VIEW: ChestHole //This is the name displayed by the game when you select a tileset.
#JSON Path - Default of gfx/tile_config.json
JSON: ChestHoleTileset/tile_config.json //Here you put the name of the tileset folder, in this case ChestHoleTileset, and its JSON text, the config one. Change it accordingly.
#Tileset Path - Default of gfx/tinytile.png
TILESET: ChestHoleTileset/tiles.png //This line is the one that refers to the Tiles.png. Again, change the folder accordingly.
Note that the fallback is not commented. It’s automatically read by the code, because the tile_config refers to it.
Then there is tiles_config.
Tiles_Config is the heart of your tileset. Is the code that tells which square refers to each object ingame. It also has a bit of data. Let’s break it down.
FIRST: I recommend downloading Notepad++ for this. It’s just a must for any kind of coding, and it will fix your life.
https://notepad-plus-plus.org/download/v6.7.9.2.html
I will be using this program. With that out out the way, we continue.
This is what you will see.
{
“tile_info”: [
{
“height”: 24,
“width”: 24
}
],
If you are familiar with coding, this will be pretty easy. In any case…
{ //This is a bracket. Brackets are like separators, one opens and the other one closes, and they are made for organizing. If you put any bracket wrong, it won’t be read and the game will crash or the tileset will have serious bugs. Don’t worry though, it’s not at all hard to do this good. Still, try to always use the templates that are already written in the code to not screw up. Because it’s hard to fing THAT ONE BRACKET that makes everything go wrong. ALSO, this is the WAY FIRST bracket, and if you check the WAY LAST bracket, you will see that they are both related.
“tile_info”: [ //do not change this
{ //neither this
“height”: 24, //this is the height of EACH tile. So, if you input “20” here, and have an image wich its height is, let’s say, 200, then the code will believe that every 20 pixels down, there is a tile, and so you will be able to take 10 tiles of 20 pixels from that image. ALSO, DO NOT ERASE THAT COMMA. Or the spaces. Just change the number, nothing else. The code is delicate!
“width”: 24 //the same applies here! Like, of the other text. The one of height.
} //not this!
], //nope
Then we go to the next text. Haha, next text. That sounds funny.
…
“tiles-new”: [
{
“file”: “gfx/RetroDaysTileset20/retrodaystiles20.png”,
“transparency”: { “R”: 0, “G”: 0, “B”: 0 },
“tiles”:
[
{
“id”:“highlight_item”,
“fg”:368,
“rotates”:false
},
{
“id”:“footstep”,
“fg”:316,
“rotates”:false
},
{
“id”:“corpse”,
“fg”:274,
“rotates”:false
},
{
“id”:“unknown”,
“fg”:54,
“rotates”:false
},
{
“id”:“weather_acid_drop”,
“bg”:14
},
{
“id”:“weather_rain_drop”,
“bg”:13
},
…
You don’t have to be pretty awesome to realize that they repeat, in sequence. Each one starting and ending with bracket and divided by commas.
We will dissect one of them.
{
"id":"t_dirt",
"bg":1,
"rotates":false
},
If you see, it is not on the other list, but it’s just for familiarity.
Now, even more dissection.
{ //start
"id":"t_dirt", //this is the ID. Whenever you want to add a tile, you have to tell the game which object/tile you are trying to represent. The list of codes can be given if you go to the debug menu of the game and wish for the item or search for it in the terraineditor. Even in the monster spawner. EVERYTHING has an ID you got to use. Which overlays the case is a bit different.
"bg":1, //This is IMPORTANT. This is the "number" of the tile. If you divide, like cutting a cake, the tile image with the numbers you applied to the height and width, (which would make it look like if it had some kind of coordinates over it, i'm bad for explaining) and then start counting from the upper left corner to the right, the number you get when you get to the tile you want to use)
"rotates":false //Pretty straightforward, if it rotates or not.
}, //close
That’s it! However, there are different kinds of “sections”. So, let’s see the variants.
{
"id":"t_wall",
"fg":88,
"bg":2,
"multitile":true,
"additional_tiles":
[
{
"id": "center",
"fg": 88
},
{
"id": "corner",
"fg": 384
},
{
"id": "edge",
"fg": 88
},
{
"id": "t_connection",
"fg": 385
},
{
"id": "end_piece",
"fg": 88
},
{
"id": "unconnected",
"fg": 88
}
],
"rotates":false
},
Hah! But it’s really easy:
{
"id":"t_wall",
"fg":88,
"bg":2,
"multitile":true, //THIS is what makes certain tiles, like walls, have all those nice corners and connections. It's beautiful. If you don't write it, it defaults to false, so you got to write it to make it true.
"additional_tiles": //to write the tiles
[ //So, this bracket is not outside of the main section, it's actually inside. So the ID is not lost.
{
"id": "center", //This tile should go in the center if its surrounded by four tiles.
"fg": 88//the Center tile. The other ones are for corner, edge, t, end piece, and unconnected respectively.
},
{
"id": "corner", //this would be a corner.
"fg": 384
},
{
"id": "edge", //i think this one is if it just has two connections, and they don't bend.
"fg": 88
},
{
"id": "t_connection", //a T connection.
"fg": 385
},
{
"id": "end_piece", //Like, the head of a snake, it's where a line ends.
"fg": 88
},
{
"id": "unconnected", //unconnected
"fg": 88
}
],
"rotates":false
},
SO WE FINALLY GOT TO THE OVERLAYS. Woah, i got carried away. I guess that could help other people, though.
{
"id": "overlay_worn_helmet_xlsurvivor",
"fg": 372,
"rotates": false
},
As you see, it’s the same. Just that in the ID it has //overlay_worn_// and that the tile must have the clothes exactly in the place they /would/ go if the other tile was under it. If not, it will look bad. Use the player tile for reference.
This finished! ALSO! Remember to save. Notepad++ won’t save unless you tell it to. Not even when closing. If you close, the changes will stay saved, however.
-Beyond that I was also wondering if it is possible to implement new sprites. By that I mean making player or npc sprites that are different (skin color, hair, eyes, etc.) perhaps randomly, by choice, or due to the professions chosen during character creation, or maybe different sprites of the same item for different characters, such as a female vs male character, or a heavily mutated character.
I’m sorry, i don’t think that is possible as of now.
-I also noted that in the Chesthole tileset the sprite for the football helmet and the heavy survivor helmet are the same, so I would want to create a unique sprite for each if possible.
Then just find the football/survivor helmet ID and put it into this template down here, and also it’s FG number.
{
"id": "xxx",
"fg": xxx,
"rotates": false
},
HOWEVER you may not know where to find this ID. I got this one way.
So if you haven’t added a key for the DEBUG menu, add it like this. Go to the game, and put “?”. Then choose the option to change keys. Then go to the last part, you will find it all the way down. Like this.
Now go to the debug menu. If you need an item, go to Wish for an item. For a terrain go to the map editor, if you want a monster put spawn monster, etc…
We won’t SPAWN them, we will just look at their code.
for example, we need the football helmet. So we will go to Wish For An Item, and then we will use “/” to search for the item. Put its name, and when you find it, look for this.
THAT is the ID. So you just got to add “overlay_worn_” before it, in the ID! And paste it in the code, RESPECT THE COMMAS. And save.
-I apologize if there are any guides for this kind of thing that I have missed on the forums. If there are any guides for this type of coding on the internet in general, I would appreciate it if someone were to suggest some.
This is the first one i think!
-Thank you for any of your help or suggestions.