

I just want to clarify a few things before I start making significant changes.Īnecdotal evidence is that such small instances aren’t efficient. The usual way to do this with instancing would be to have the base texture coordinates as a per-instance attribute and the offset as a per-vertex attribute, and add the two in the vertex shader. That will be inefficient because gl_VertexID will differ between concurrent invocations of the vertex shader. I want a very a simple windowed menu system. I think this is the one exception I’ll make for aesthetic reasons. I have ruled out the Dwarf Fortress approach of simply building it within the tiled system.
#Dwarf fortress tileset 2018 how to
I haven’t started on the UI system at all yet, and I would also really appreciate any suggestions on how to do this in a simple, efficient way.
#Dwarf fortress tileset 2018 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. Its incredibly entertaining, even though parts of it read like a "what not to do.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. It is what is called a legacy fortress, where a different person played each year. Perhaps the most important article found here is this one: Fun.įinally, there is the story of Boatmurdered. Students have textbooks, Priest's have the bible, you have the Dwarf Fortress Wiki. It took me close to 10 fortresses to get to the end of his first fortress. I literally learned DF by watching these videos and copying them perfectly. Gives you much of the basic controls and layout for your fortress.Ĭpt. I will provide you with some resources an instruction manual, so to speak. Now, as much as I don't think you should change the game to make it easier (and there are sites that will help you hack it). After playing Dwarf Fortress for a year and a half now Hard is a four letter word to me. That's hard with a capital 'H.' Man hard. I know that sounds kind of weird but all of the joy you will every obtain out of that game derives from the fact that its Hard.
