
- #DWARF FORTRESS TILESET 2D HOW TO#
- #DWARF FORTRESS TILESET 2D INSTALL#
- #DWARF FORTRESS TILESET 2D FULL#
#DWARF FORTRESS TILESET 2D FULL#
I’ll link to the repo with the full codebase to help clarify any confusion: In the fragment shader, the correct texture is chosen with another conditional based on the z-value of the tile, because each layer takes from its own unique texture atlas.įragColor = texture(character_tileset, tex_coord) įragColor = texture(object_tileset, tex_coord) įragColor = texture(map_tileset, tex_coord) I’ve looked into the non-branching functional versions of this logic, but I’m not sure if that’s the right approach. But that logic is in the shader, and I’ve read some negative things about branching like this. I only pass in the bottom-left and the top-right coordinates, and then use this to derive all four corners. In the vertex shader, I use the gl_VertexID value to correctly set up the texture coordinates for each vertex. This allows me to get all the per instance data for each tile into the shaders, but I’m a bit concerned because my current approach relies on some conditional logic in the shaders. This is sent to the shaders as vertex attributes like this:ġ, 3, GL_FLOAT, GL_FALSE, 7 * sizeof(GL_FLOAT), 0Ģ, 4, GL_FLOAT, GL_FALSE, 7 * sizeof(GL_FLOAT), (void*)(3 * sizeof(GL_FLOAT)) It has the world position for each tile (three floats) and the texture coordinates for each tile (four floats) interleaved like this:Ġ.0f / TILESET_WIDTH, 13.0f / TILESET_HEIGHT,Ġ.0f / TILESET_WIDTH, 14.0f / TILESET_HEIGHT, Then I have a second VBO that holds the per instance data for each tile. These four vertices are then drawn multiple times using glDrawArraysInstanced to create the skeleton of the tile map.

I have one array buffer object holding four vertices to create a single tile. The only exception to the tile map will be a simple menu system. The primary focus is performance, because I am building fairly complex game logic. The characters are simply tiles of the same size as the map tiles, and they move discretely one tile at a time. There won’t even be a need to animate sprites moving across the tile map. There are going to be 3 or 4 layers of tiles, each layer pulling its tiles from a large texture with an array of tiles. It is a tiled map where all of the tiles have the same size (something similar to Dwarf Fortress). I’m building a simulation game that only requires a fairly minimal graphical interface. Let me know if you need help or clarification, but hopefully this helps.I have the basis of a tiled map with multiple layers implemented, and I’m looking for advice on my approach, given my somewhat unique intended application. In /data/init/init.txt, change the print mode from "2D" to "TWBT"

Move shadows.png, transparent1px.png, and white1px into /data/art Move overrides.txt into the /data/init folder of your df

Get the dll file (inside the folder) and move it into the /hack/plugins folder in your df folder
#DWARF FORTRESS TILESET 2D INSTALL#
Then install the latest build (at the top) for your computer, and you're almost ready to go! Now follow these steps to get it all working with your game. If you're lazy or can't find it, go here. Go to the repo, then go to Code, then go to Releases. If you search for TWBT it'll probably direct you to the git repo, but it's a bit confusing. The most important thing is what to download.

I asked around and two people ( qeveren and Savancik) provided two important pieces of information which were nigh-impossible to find elsewhere (though correct me if I'm wrong!), so here I am to share that information in one place.
#DWARF FORTRESS TILESET 2D HOW TO#
So for the past couple of days I've wanted to use TWBT (Text Will Be Text, for those who don't know, is a plugin for dfhack to enable some nice graphical features such as multilevel rendering, but if you don't know that you're probably using the PeridexisErrant's Starter Pack and so this won't be useful for you!) but I couldn't figure out how to install and enable it.
