Quarter-Tile Autotiling

Since Oskar posted about it, I see an increasing amount of praise for his Dual Grid proposal for autotiling terrains. It works by drawing tiles at a half-cell offset to the base grid, creating a dual grid, and using marching squares autotiling to select which tile to draw based on the terrains the corners of the dual grid, which is the centers of base grid.

This is a great scheme. It’s simple, only needs a few tiles and can be extended quite easily. It’s used in many games.

But, it does have some drawbacks. The dual grid is difficult to get your head around. You have to worry about ambiguous tiles. And despite being a substantial improvement over the blob pattern, it still requires drawing quite a number of different tiles.

I’m here to explain an alternative, quarter-tile autotiling. Quarter-tiling has also been called sub-tiles, meta-tiles (when doubling instead of halving). I’ve previous described as micro blob, which is the same thing with precomposition. It’s best known for being the tiling built into the RPG Maker engine.

Quarter-tiling is pretty easy to implement, and requires substantially less effort to create tiles for, as it uses fewer, smaller tiles. That does mean it’s not possible to produce as much tile variation as marching squares. But there’s plenty of techniques for adding that back.

Later, we’ll look at ortho-tiles – an extension of quarter-tiles to irregular, non-square, grids.

Continue reading

nice-hooks

I’ve created a new open source library.

I’ve been learning quite a bit about AI and AI Alignment recently. A few weeks ago I joined the Interpretability Hackathon. Sadly my contributions were minimal as I had to leave halfway through, but doing it made me appreciate how bad the tooling is in this area.

So I’ve created nice-hooks, a library for working with pytorch hooks and activations more effectively.

GitHub

Docs

Announcing Sylves

I’ve released a new library, Sylves that handles the geometry of grids for C# or Unity. I’ve basically distilled all my knowledge from several different grid projects, and made a solid base for anything you might want.

Constrained Text Generation with AI

I was discussing how AI text generation, such as ChatGPT, might end up getting used in computer games. So far, designers are fairly reluctant to adopt the technology. One of the key problems is that you just can’t control the output enough. Language models will break character or respond in inappropriate and toxic ways. Finding a good solution to this is a huge research field, and not likely to get cracked soon.

For the foreseeable future, AI in games is much more likely to be used offline – assets and dialog generation generated up front, so it can be vetted before being integrated into the game.

But it got me thinking, can we vet the AI’s output in advance, but still get the benefits of intelligent decision making at runtime? It turns out, we can! I doubt it’ll be useful in every circumstance, but I can certainly see uses for it, like chatbots, games.

The code and demonstration for this article is available here.

Continue reading