Specified · Specification
SubCell Placement
Placing objects between grid cells in a game that only allows whole cells.
DWMM Holdings · Specified · C#, Harmony, Specification
Abstract
RimWorld only lets a thing occupy whole cells. This spec is for a mod that lets a 1×1 item sit centered on the edge between two cells, or where four cells meet. It works through two ways of doing that, one that goes along with the engine and one that fights it, and splits each into small phases you can test. This page sets out the problem, the two approaches and where the spec stands.
1The problem
In RimWorld, a 1×1 item lives in exactly one cell, and the game has no way to place something halfway. Put something on an edge and you have to decide which cell it belongs to, or teach the game that it can belong to more than one.
Drawn on the edge between (1, 1) and (2, 1). As far as the game’s rules go, it’s only in (1, 1), and the other cell doesn’t know it’s there.
- The game thinks it’s here
- Drawn here, but the game doesn’t know
Click the grid, or focus it and use the arrow keys to move half a cell at a time.
2Two approaches
The spec works through both and weighs each against how the engine really works.
Goes along with the engine
Works inside the rule that a 1×1 item lives in one whole cell, and finds a way to make it sit between cells anyway.
Fights the engine
Changes the rule, so the game itself can hold an item between cells. That means patching parts of the engine that expect whole cells.
Each approach is split into small phases, and each phase comes with its own test criteria, so it can be checked before the next one starts.
3Status
Specified. It’s a specification for a C# mod that would use Harmony. There’s no mod to subscribe to yet.
If this is useful to you, or you’d like to see it built, get in touch