Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [MODDING] 50.x UI, World Map, Map Tile Resource  (Read 1617 times)

Altem

  • Escaped Lunatic
    • View Profile
[MODDING] 50.x UI, World Map, Map Tile Resource
« on: January 20, 2023, 06:48:13 pm »

A short while ago I discovered I could switch to graphics mode within the 50.x Classic version.  Since then I've been trying to determine what it would take to make the graphics enabled Classic version playable.  What I've discovered is that the work it'll take exceeds the capacity of my artistic ability and available free time.

This post contains all the information I've been able to gather for those interested in modding the UI, World Map, and Map Tiles who need a place to start.

I'm assuming you're at least familiar with the basic Modding instructions:
    https://bay12games.com/dwarves/modding_guide.html
    http://dwarffortresswiki.org/index.php/Modding#Basics_of_DF_modding
    http://dwarffortresswiki.org/index.php/Graphics

I've uploaded the Mod files I've been working on to DFFD: https://dffd.bay12games.com/file.php?id=16370

I should note that this is not complete, nor will it likely ever be.  Its purpose is to be used as an example, or starting point.

This Mod breaks the graphics down into three sections: interface, worldmap, and maptile.

The interface [graphics_interface.txt] deals mostly with buttons, designations, and the designation cursor display.
The worldmap [graphics_worldmap.txt] (displayed at worldgen and in-game with SHIFT+Y) has some site graphics defined, but is very limited. and contains a complete list of available TOKENs.
The maptile [graphics_maptile.txt] deals with map objects; stone, dirt, and a surface feature [boulder].

The tile tokens and associated definitions were found via various sources, including the DFHack repository, various forum postings, and trying permutations of the ASCII_GRAPHICS tags in \data\vanilla\vanilla_interface\graphics\graphics_classic.txt.
Just prior to this posting I discovered an upload from jecowa which contain the .txt files that describe all the graphics with associated tile tokens and definitions.  It can be found here: https://dffd.bay12games.com/file.php?id=16276

---
--

UI Graphics (interface)

These appear to be a mix of 32x32 (buttons, designation cursor), 16x32 (play/pause/help button), and perhaps a few other sizes (dialog borders).
It's a little more complicated than this.  See fifth post.

In the uploaded Mod there's a graphic located at 0, 4 on the sample_interface.png that I've used as a measure of sorts.

The UI Graphics definition follows the form:

Code: [Select]
[TILE_GRAPHICS:INTERFACE_BITS:8:37:BUTTON_PRIORITY_2_INACTIVE:0:0]
Broken into parts:

TILE_GRAPHICS- defines this as a graphic
INTERFACE_BITS- defines the TILE_PAGE
8- column offset of TILE_PAGE
37- row offset of TILE_PAGE
BUTTON_PRIORITY_2_INACTIVE- TILE TOKEN that accepts this graphic
0- column offset on UI
0- row offset on UI

Based on experimentation the last "0:0]" represent offsets on the UI, but I'm not sure of this.

--

Designation Cursor

The designation cursor is interesting in that it behaves differently based on whether you're designating a single point, a line, or a rectangle.

In the sample images the brown portion represents the background and is not a part of the cursor.

For a single point the definition is:

Code: [Select]
[TILE_GRAPHICS:5004_INTERFACE:5:4:RECTANGLE_CURSOR_N_S_W_E:0:0]
Sample:



For a line going East or West:

Code: [Select]
[TILE_GRAPHICS:5004_INTERFACE:0:4:RECTANGLE_CURSOR_N_S_W:0:0]
[TILE_GRAPHICS:5004_INTERFACE:1:4:RECTANGLE_CURSOR_N_S_E:0:0]
[TILE_GRAPHICS:5004_INTERFACE:4:4:RECTANGLE_CURSOR_N_S:0:0]

Sample:



For a line going North or South:

Code: [Select]
[TILE_GRAPHICS:5004_INTERFACE:2:4:RECTANGLE_CURSOR_N_W_E:0:0]
[TILE_GRAPHICS:5004_INTERFACE:3:4:RECTANGLE_CURSOR_S_W_E:0:0]
[TILE_GRAPHICS:5004_INTERFACE:6:4:RECTANGLE_CURSOR_W_E:0:0]

Sample:



For a rectangle:

Code: [Select]
[TILE_GRAPHICS:5004_INTERFACE:0:0:RECTANGLE_CURSOR_N_W:0:0]
[TILE_GRAPHICS:5004_INTERFACE:1:1:RECTANGLE_CURSOR_N:0:0]
[TILE_GRAPHICS:5004_INTERFACE:1:0:RECTANGLE_CURSOR_N_E:0:0]
[TILE_GRAPHICS:5004_INTERFACE:0:1:RECTANGLE_CURSOR_W:0:0]
[TILE_GRAPHICS:5004_INTERFACE:4:0:RECTANGLE_CURSOR_INTERIOR:0:0]
[TILE_GRAPHICS:5004_INTERFACE:5:1:RECTANGLE_CURSOR_E:0:0]
[TILE_GRAPHICS:5004_INTERFACE:2:0:RECTANGLE_CURSOR_S_W:0:0]
[TILE_GRAPHICS:5004_INTERFACE:4:1:RECTANGLE_CURSOR_S]
[TILE_GRAPHICS:5004_INTERFACE:3:0:RECTANGLE_CURSOR_S_E:0:0]

Sample:



I'm not sure why there's a distinction, but it's there.

--

This post is getting long and I'm starting to become unsure of its usefulness.  Let me know if you'd like me to expand on the worldmap and maptile pieces.
« Last Edit: January 23, 2023, 11:48:55 pm by Altem »
Logged

Altem

  • Escaped Lunatic
    • View Profile
Re: [MODDING] 50.x UI, World Map, Map Tile Resource
« Reply #1 on: January 22, 2023, 11:32:37 pm »

I've upgraded to GIMP 2.2 from MS Paint.  Transparency and opacity are now properly being accounted for where applicable.

The World Map file in the Mod (graphics_worldmap.txt) has been updated with the complete list of TOKENs for World Map tiles.
This list was, again, taken from the RAWs provided by jecowa (https://dffd.bay12games.com/file.php?id=16276).

In order to make the TOKEN listing more accessible I'll see if I can't add it to the wiki.

I've updated the sample with all the permutations of the HILLS graphic along with the EMBARK overlays.

The Mod can be found here for those who don't want to scroll up: https://dffd.bay12games.com/file.php?id=16370

Sample images:

World MapWorld Map - Embark Finder

World Map - Embark (Zoom)

I was going to experiment with palettes, but the palette files (definition of, or the actual palette itself) weren't provided in jecowa's file set and are not present in the Classic download.

In "vanilla_descriptors_graphics", graphics\palette_default.txt defines all the palettes associated with colors in-game. This includes the "grayscale" palette that gets recolored based on material color token.

vanilla_descriptors_graphics\graphics\images\palettes.png contains all the palettes associated with colors. In both the .txt file and the .png the topmost palette is the "grayscale" one. Note that there are two halfs to each palette row. The left half is associated with wood items, and the right half is associated with metals, stone, just about everything else.

Without some hints as to how the palette is defined and whether or not it can be modded makes experimentation with them somewhat impossible.

I'll likely be experimenting with the dialog graphics next.
« Last Edit: January 23, 2023, 12:15:01 am by Altem »
Logged

Tylerm

  • Escaped Lunatic
    • View Profile
Re: [MODDING] 50.x UI, World Map, Map Tile Resource
« Reply #2 on: January 23, 2023, 11:19:24 pm »

Have you figured out the music yet? swapping files around i've made the game work with graphics but I cannot get the sounds to work whatsoever on the classic version.
Logged

Altem

  • Escaped Lunatic
    • View Profile
Re: [MODDING] 50.x UI, World Map, Map Tile Resource
« Reply #3 on: January 23, 2023, 11:27:02 pm »

I'm mostly interested in graphics for the moment.

I'd at least like to lay the groundwork for future modders who want to take on the UI.

swapping files around i've made the game work with graphics

I assume you own the Premuim version?  I'm not missing something obvious by doing what I've been doing here.
« Last Edit: January 23, 2023, 11:29:18 pm by Altem »
Logged

Altem

  • Escaped Lunatic
    • View Profile
Re: [MODDING] 50.x UI, World Map, Map Tile Resource
« Reply #4 on: January 23, 2023, 11:45:33 pm »

I've been reviewing the RAW vanilla files for the interface.  I was going to start tackling the dialog boxes when something stood out.

There are more definitions for certain graphics than I had anticipated.

e.g.

Code: [Select]
[TILE_GRAPHICS:INTERFACE_BITS:0:52:BUTTON_DES_CHOP_INACTIVE:0:0]
[TILE_GRAPHICS:INTERFACE_BITS:1:52:BUTTON_DES_CHOP_INACTIVE:1:0]
[TILE_GRAPHICS:INTERFACE_BITS:2:52:BUTTON_DES_CHOP_INACTIVE:2:0]
[TILE_GRAPHICS:INTERFACE_BITS:3:52:BUTTON_DES_CHOP_INACTIVE:3:0]

[TILE_GRAPHICS:INTERFACE_BITS:0:53:BUTTON_DES_CHOP_INACTIVE:0:1]
[TILE_GRAPHICS:INTERFACE_BITS:1:53:BUTTON_DES_CHOP_INACTIVE:1:1]
[TILE_GRAPHICS:INTERFACE_BITS:2:53:BUTTON_DES_CHOP_INACTIVE:2:1]
[TILE_GRAPHICS:INTERFACE_BITS:3:53:BUTTON_DES_CHOP_INACTIVE:3:1]

[TILE_GRAPHICS:INTERFACE_BITS:0:54:BUTTON_DES_CHOP_INACTIVE:0:2]
[TILE_GRAPHICS:INTERFACE_BITS:1:54:BUTTON_DES_CHOP_INACTIVE:1:2]
[TILE_GRAPHICS:INTERFACE_BITS:2:54:BUTTON_DES_CHOP_INACTIVE:2:2]
[TILE_GRAPHICS:INTERFACE_BITS:3:54:BUTTON_DES_CHOP_INACTIVE:3:2]

This got me thinking, why would multiple definitions be required if the graphics page was 32x32.

As far as I can tell the graphics page, at least INTERFACE_BITS, isn't 32x32.  Based on some testing it appears that it's 8x12.  The additional definitions include offsets at the end which tie the graphics together and make them look like they're one image.

The added definitions describe a 4x3 block of 8x12 images, which puts this particular graphic at a final size of 32x36.

I'll be performing additional testing on this.  Once I get to a graphic that overlays another I should have a better picture of things.
Until I have additional information I'll be leaving the existing Mod un-updated with this finding as additional alterations may be necessary.

This is mostly a note for myself, but others may find it helpful.
Logged

Altem

  • Escaped Lunatic
    • View Profile
Re: [MODDING] 50.x UI, World Map, Map Tile Resource
« Reply #5 on: January 27, 2023, 06:19:13 pm »

Lots of updates.  The Mod (https://dffd.bay12games.com/file.php?id=16370) has been updated to reflect them.

Building on the last post:

TILE_GRAPHICS_RECTANGLE defintion:

Code: [Select]
[TILE_GRAPHICS_RECTANGLE:INTERFACE_BITS_SHARED:0:6:4:3:UNIT_SELECTOR_ASSIGNED]
Broken into parts:

TILE_GRAPHICS_RECTANGLE- descriptor
INTERFACE_BITS_SHARED- defines the TILE_PAGE
0- column offset of TILE_PAGE
6- row offset of TILE_PAGE
4- get # chunks starting at column offset
3- get # chunks starting at row offset
UNIT_SELECTOR_ASSIGNED- TILE TOKEN that accepts this graphic

This reduces the amount of input required to define multi-tile graphic images.

Essentially this:

Code: [Select]
[TILE_GRAPHICS:INTERFACE_BITS:0:52:BUTTON_DES_CHOP_INACTIVE:0:0]
[TILE_GRAPHICS:INTERFACE_BITS:1:52:BUTTON_DES_CHOP_INACTIVE:1:0]
[TILE_GRAPHICS:INTERFACE_BITS:2:52:BUTTON_DES_CHOP_INACTIVE:2:0]
[TILE_GRAPHICS:INTERFACE_BITS:3:52:BUTTON_DES_CHOP_INACTIVE:3:0]

[TILE_GRAPHICS:INTERFACE_BITS:0:53:BUTTON_DES_CHOP_INACTIVE:0:1]
[TILE_GRAPHICS:INTERFACE_BITS:1:53:BUTTON_DES_CHOP_INACTIVE:1:1]
[TILE_GRAPHICS:INTERFACE_BITS:2:53:BUTTON_DES_CHOP_INACTIVE:2:1]
[TILE_GRAPHICS:INTERFACE_BITS:3:53:BUTTON_DES_CHOP_INACTIVE:3:1]

[TILE_GRAPHICS:INTERFACE_BITS:0:54:BUTTON_DES_CHOP_INACTIVE:0:2]
[TILE_GRAPHICS:INTERFACE_BITS:1:54:BUTTON_DES_CHOP_INACTIVE:1:2]
[TILE_GRAPHICS:INTERFACE_BITS:2:54:BUTTON_DES_CHOP_INACTIVE:2:2]
[TILE_GRAPHICS:INTERFACE_BITS:3:54:BUTTON_DES_CHOP_INACTIVE:3:2]

Can be reduced to this:

Code: [Select]
[TILE_GRAPHICS_RECTANGLE:INTERFACE_BITS:0:52:4:3:BUTTON_DES_CHOP_INACTIVE]
IMPORTANT: These descriptors (TILE_GRAPHICS and TILE_GRAPHICS_RECTANGLE) are, sadly, not interchangable.  If the RAW defines a graphic as TILE_GRAPHIC then TILE_GRAPHIC must be used.

This may change in the future, but since it isn't broken it's not likely a high priority.

Provided the forum doesn't prohibit mutliple posting in a short-ish amount of time I think I'm going to break this up a bit for ease of locating inforamtion.  I may adjust the OP as well to make things easier to locate.
« Last Edit: January 27, 2023, 06:56:23 pm by Altem »
Logged

Altem

  • Escaped Lunatic
    • View Profile
Re: [MODDING] 50.x UI, World Map, Map Tile Resource
« Reply #6 on: January 27, 2023, 06:55:47 pm »

Interface related items; Tab and Dialog Box.

Tabs are defined as a 5x2 (or 3) set of graphics.

5x2 for example:

Code: [Select]
[TILE_GRAPHICS:5004_INTERFACE:0:3:SHORT_TAB:0:0] Left side
[TILE_GRAPHICS:5004_INTERFACE:1:3:SHORT_TAB:1:0] Left side (interior)
[TILE_GRAPHICS:5004_INTERFACE:2:3:SHORT_TAB:2:0] Middle
[TILE_GRAPHICS:5004_INTERFACE:3:3:SHORT_TAB:3:0] Right side (interior)
[TILE_GRAPHICS:5004_INTERFACE:4:3:SHORT_TAB:4:0] Right side

[TILE_GRAPHICS:5004_INTERFACE:0:4:SHORT_TAB:0:1] Left side
[TILE_GRAPHICS:5004_INTERFACE:1:4:SHORT_TAB:1:1] Left side (interior)
[TILE_GRAPHICS:5004_INTERFACE:2:4:SHORT_TAB:2:1] Middle
[TILE_GRAPHICS:5004_INTERFACE:3:4:SHORT_TAB:3:1] Right side (interior)
[TILE_GRAPHICS:5004_INTERFACE:4:4:SHORT_TAB:4:1] Right side

The 'Middle' sections of this graphic (and they are defined as a single graphic) are filled [repeated], not stretched, to meet the required size the game needs.  Left and right sides of the graphic are not changed.

Dialog Boxes (exterior borders and background fill) are defined as a 3x3 set of graphics:

Code: [Select]
[TILE_GRAPHICS:5004_INTERFACE:13:1:HOVER_RECTANGLE:0:0] Upper left corner
[TILE_GRAPHICS:5004_INTERFACE:14:1:HOVER_RECTANGLE:1:0] Top (FILL)
[TILE_GRAPHICS:5004_INTERFACE:15:1:HOVER_RECTANGLE:2:0] Upper right corner

[TILE_GRAPHICS:5004_INTERFACE:13:2:HOVER_RECTANGLE:0:1] Left side (FILL)
[TILE_GRAPHICS:5004_INTERFACE:14:2:HOVER_RECTANGLE:1:1] Background (FILL)
[TILE_GRAPHICS:5004_INTERFACE:15:2:HOVER_RECTANGLE:2:1] Right side (FILL)

[TILE_GRAPHICS:5004_INTERFACE:13:3:HOVER_RECTANGLE:0:2] Bottom left corner
[TILE_GRAPHICS:5004_INTERFACE:14:3:HOVER_RECTANGLE:1:2] Bottom (FILL)
[TILE_GRAPHICS:5004_INTERFACE:15:3:HOVER_RECTANGLE:2:2] Bottom right corner

As with Tabs, the items marked with 'FILL' are repeated as many times as required to meet the size the game needs.  Corners are not changed.
Logged

Altem

  • Escaped Lunatic
    • View Profile
Re: [MODDING] 50.x UI, World Map, Map Tile Resource
« Reply #7 on: January 27, 2023, 07:04:22 pm »

Right, sorry... pictures tell a thousand words.

Some samples:

Interface 1Interface 2Interface 3



Logged