Cross-platform GUI demo

Lately I've been building my 2D tile rendering engine. The current plan is for square tiles and each tile can be composed of 8 or more layers. Also, I'll do something similar to how the current Dwarf Fortress does it: I'll render a few Z levels below with increasing opacity. I'll add animation too, but overall it's going to be as simple and straightforward as possible so that I can jump into the actual game logic ASAP.

My plan was to use array textures, but since I'm targeting OpenGL 3.3, I'm only guaranteed GL_MAX_ARRAY_TEXTURE_LAYERS of 256 or more, so I guess I'll stick to using a good old texture atlas.

This is the first time I've done any graphics programming, so it's a bit of a learning curve for me. In the meantime I've made a little recording of my title screen mock-up.

YouTube video is located here.

That's just a simple little proof of concept that uses egui, glow, and winit for cross-platform compatibility.

The background fragment shader is ported from this ShaderToy submission to GLSL.

Background vertex shader:

const VERTEX_SHADER_SOURCE: &str = r#"#version 130
const vec2 coords[] = vec2[3] (
    vec2(-1., -1.),
    vec2(3., -1.),
    vec2(-1., 3.)
void main()
    gl_Position = vec4(coords[gl_VertexID], 0., 1.);

The vertex shader source code is from this page about full screen triangle optimization, ported to GLSL.

Terrain erosion part III

Last part of my terrain erosion series. Here are some example images showing a couple before and afters of my hydraulic erosion simulation. Tested on a 8192x8192 game map, one pixel represents one tile. These images show a small fraction of the smallest possible game map.




eroded_terrain (light blue to black colors represent water, grey to white represent mountains and snow)

Here are some more, but zoomed in further:





On my 8-core dev machine the erosion sim carved over 16,000 separate paths through the terrain in about 30 seconds. There are already quite a few variables in place to allow tuning the process. The image above roughly equates to medium density, medium intensity, and with maximum coverage (no map sections left out). I can currently limit areas based on average elevation, and further along my worldgen process I'll take into account precipitation levels for particular biomes.

Next up I'm going to start on OpenGL graphics and UI code so that I can plug in the beginnings of my worldgen code.