One lot, one URL, one price: how a plot in a browser city is modelled
We make Logopolis, a 3D city that runs in the browser. It has 320 lots. This post follows one of them, number 300, through the code: the address that points at it, the page that describes it and the number that prices it. It is a note on data modelling.
The lot is a number
Lots are generated once, in a fixed order, from a seeded layout, so lot 300 is the same place for every visitor. People count from 1 and arrays count from 0. The address uses the human number, and the scene subtracts one when it reads the lot parameter. Get that wrong and "lot 300" in a label and lots[300] in an array point at different buildings: the wrong one gets highlighted.
When the parameter is there, the scene skips the opening camera move and outlines the lot in gold. A shared address lands on the lot, not on the skyline.
The lot has a page
Every lot also has a plain page, /b/300, that does not load the 3D scene. While the lot is free its title is "Lot 300 is available", and its description says which of the three districts it is in and the entry price. It is there for anyone who wants the facts without loading a city.
The price is a formula
Each district has a base price: 49 for Downtown, 19 for Midtown, 5 for the Outskirts. The price a lot shows is the base price multiplied by one plus the share of lots already taken, rounded to a whole dollar. With a share of zero it is the base price; at full occupancy it is double. Lot 300 is in the Outskirts, so its price depends only on how many of the 320 lots are taken:
| Share of lots taken | Outskirts | Midtown | Downtown |
|---|---|---|---|
| 0% | 5 | 19 | 49 |
| 50% | 8 | 29 | 74 |
| 100% | 10 | 38 | 98 |
These are the formula applied to example shares, not a forecast. Today one lot of the 320 is taken, so the Outskirts price still rounds to 5.
We kept it this simple on purpose. A formula with one parameter fits in a paragraph and a few lines of test. The cost: early lots are cheaper than late ones on the same ground. That is the point. It also means a price can change between a visitor reading it and starting checkout. So when checkout starts, the server works the price out again instead of trusting the page.
What we would add next
- A per-lot history, so a page can say when a price last changed.
- A test that walks every lot number through the address, the scene and the page. It would catch the off-by-one without anyone looking.
Drafted with AI help.