Projects Using My Software

Some of my tools and software have been arond for some time. Plenty of people use them them, judging from queries and stats I see, but few write back to tell me where it’s actually been used. Here I document some of the published projects. I’m always pleased to see more.

Projects Using Sylves

My Projects

Sylves Demos – Some demo code using sylves in a variety of ways.

Mosaic Paint – A paint program for non-square grids

Tessera – WaveFunctionCollapse procedural generation for Unity.

Other Projects

With The Grain – a 10 minute zen puzzler.

Projects using DeBroglie

Wrath & Glory Space Hulk Generator

Projects using Tessera

Project Electric Sheep – A trippy AI powered walking simulator. Tessera is used for buildings.

Escape From Darkerlands – A mobile game with procedurally generated maps.

The Forever Factory

Infinity Islets

Defining Chess Piece Moves using Regular Expressions

Suppose you wanted to code a simple chess game. One key bit of game logic is to describe what are legal moves for each piece. There’s only 6 types of piece (pawn, knight, bishop, rook, queen, king) so this isn’t exactly a hard task. You can write rules such as:

def canRookMove(from, to):
  # Ignores questions about colliding with other pieces
  return (from.x == to.x or from.y == to.y) and from is not to

But these days, I’ve been thinking a lot about grids, and the above approach just doesn’t generalize. What if you wanted to play chess on a stranger grid?

Three player chess (CC BY 2.0, source)

What would it mean to play chess on the grid above, or a hexagonal grid, and so on? You’d have to write a whole new set of rules, and they could get very complicated depending on the grid in question. What I want is a language that describes how pieces move, which generalizes to any board. And I think I’ve found it, using regular expressions.

Continue reading

Using Unity’s TextGenerator.verts

TextGenerator.verts is meant to give the position information of every character in a given string. This is useful in Unity if you need to align something with exactly where some particular text is occuring, if for some reason you are not already using TextMeshPro.

Older Unity versions created 4 verts for every character, which made life easy. But now many non-rendering characters don’t have verts generated for them, and the relationship between verts and characters is undocumented. I’ve reverse engineered it, as best as I can tell:

int? GetVertForPosition(int position, string text, TextGenerator textGenerator)
{
    var c = 0;
    var vert = 0;
    for (var i = 0; i < position; i++)
    {
        if (textGenerator.characters.Count <= c)
            return null;
        if (!char.IsWhiteSpace(text[i]) && textGenerator.characters[c].charWidth > 0)
            vert += 4;
        if (text[i] != '\n')
            c++;
    }
    return vert;
}

New Discord Server

Let’s face it, running your own WordPress blog is a sign you are woefully out of date. I can see plenty of readers, but never hear from them.

So I’ve created a Discord server. Feel free to log on and ask me support questions about my projects, suggest new article ideas, or just to hang out.

Don’t worry, the blog isn’t going anwhere. I think the jump might kill me if I leaped fully into the 21st century.