Modding:Tiles: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
m (add cleanup note)
Line 3: Line 3:
This file contains the raw tiles imported into the game, which will help you figure out the right name and folder for each tile you would like to replace. You may only use these files to create modifications for Caves of Qud.
This file contains the raw tiles imported into the game, which will help you figure out the right name and folder for each tile you would like to replace. You may only use these files to create modifications for Caves of Qud.


https://www.dropbox.com/s/g8coebnzoqfema9/CavesofQudTileModdingToolkit.zip?dl=0
https://www.dropbox.com/s/3hub59uoiamz0vq/caves-of-qud-tiles-200.71.zip?dl=1


== Modifying Existing Tiles ==
== Modifying Existing Tiles ==

Revision as of 01:23, 19 July 2020

This page is about modding. See the modding overview for an abstract on modding.
This page is about modding. See the modding overview for an abstract on modding.

"Caves of Qud" Texture Files Download for Tile-set Modifications.

This file contains the raw tiles imported into the game, which will help you figure out the right name and folder for each tile you would like to replace. You may only use these files to create modifications for Caves of Qud.

https://www.dropbox.com/s/3hub59uoiamz0vq/caves-of-qud-tiles-200.71.zip?dl=1

Modifying Existing Tiles

In order to modify an existing tile, move the .png file in a Textures subdirectory of your mod. Additional subdirectories can be included.

Example:

%appdata%\Caves of Qud\Mods\[your mod name]\Textures\creatures\new_tile.png

Sample ObjectBlueprints.xml updating Mehmet's tile to creatures/new_mehmet.png

<?xml version="1.0" encoding="utf-8"?>
<objects>
    <object Name="Mehmet" Load="Merge">
        <part Name="Render" Tile="creatures/new_mehmet.png"></part>
    </object>
</objects>


Creating a Player-Tile

This article may need cleanup to meet quality standards.
Please help improve this page by editing it.

Reason: " This guide is incomplete and may also be best as its own article."

This article may need cleanup to meet quality standards.
Please help improve this page by editing it.

Reason: " This guide is incomplete and may also be best as its own article."

At the moment, the player's sprite does not have a direct/in-game method of changing the tile, but there is a method that will allow you to make custom sprites and assign them to the player.

  1. Firstly, create the item you wish to use as a player tile, the name can have any format, but the image must be saved as PNG format, most sprites work between 16px x 24px.
  2. Navigate to : %appdata%\Caves of Qud\Mods
  3. Create a new folder named "PC Sprite," then create another folder inside PC Sprite named "Texture" you may also add sub-directories based on the items I.E creatures, buildings, etc.
  4. Your file Path Should look like : %appdata%\Caves of Qud\Mods\PC Sprite\Textures
  5. Place your custom sprite into the Textures folder.
  6. Got to: %appdata%\Caves of Qud\Mods\PC Sprite
  7. Right-Click, and create a new text-document, rename the text document, "MyPlayerTileWish.cs."
  8. Open the document.
  9. Paste the Following:
    using XRL.World;
    using XRL.Wish;
    using XRL.Messages;
    
    public class MyPlayerTileWish
    {
        [WishCommand(Command = "usemytile")]
        static public bool UseMyTile()
        {
            IPart.ThePlayer.pRender.Tile = "yourtilesname.png";
            return true;
        }
    
    }
    
  10. Where it says "yourtilesname.png" paste the name of the tile in your textures that you wish to use for your player tile, if it is in a sub-directory write it as so: "subfolder/yourtilesname.png."
  11. Close and Save.
  12. Launch Caves of Qud.
  13. Activate and Approve the mod in the script.
  14. After creating your character, use the wish command, "usemytile" and you should be assigned the tile you customized.


Supported File Types

Only .png files are supported.

Tile Format

The default tiles and shaders used in Caves of Qud use 3-color tiles. Black, non-transparent pixels are painted with the foreground color, white non-transparent pixels are painted with the detail color and transparent pixels are painted with the background color.

Example "3 color" Gunslinger Tile Example Gunslinger Dynamically Colored In-Game
Gunslinger-3Color.png
Gunslinger-InGame.png

These dynamic colors are dependent on the Render part in their ObjectBlueprints.xml:

<part Name="Render" Tile="items/sw_spray.bmp" DisplayName="&amp;ySpray&amp;r-&amp;ya&amp;r-&amp;yBrain" ColorString="&amp;G" TileColor="&amp;G" DetailColor="r" RenderString="012" RenderLayer="5"></part>

Where TileColor represents the the white part of the unfiltered image, and DetailColor will recolor the black part. Transparent pixels will change to the background color of the game, known as viridian.

See Modding: Text Color Codes & Object Rendering for more details on the exact colors and how they are specified.

4th Color

Despite there being only three main colors for the tiles, there are a handful of tiles that use a 4th color, usually RGBA(124, 101, 44, 255). When rendered inside the game, a special formula is performed to create an weighted mix of the tile and detail color, with weight based on the 4th color's R channel (the first number). a 4th color that has 255 red would show up the same as the detail color.

True Color tiles

If you'd like your mod to supply true color tiles instead of the default 3-color tiles (white, black, transparent), then include a modconfig.json in your mod's root with the Following contents.

Truecolor tiles will be shaded as their natural color, with the background color blended in at 1-alpha.

Sample %appdata%\Caves of Qud\Mods[your mod name]\modconfig.json enabling truecolor shader mode

{
  "shadermode":"1"
}

Tile Size

Include a display.txt in your mod's base directory with the following entries to override the game tile height and width

sample display.txt

{
    "tiles":{
        "width":"24",
        "height":"24"
    }
}

See Also