![]() |
City Generator 1.0.1
Procedural city generation for C++23
|
Requires C++23 (e.g.,
-std=c++23for GCC/Clang,/std:c++latestfor MSVC).
API Reference · Usage Guide · Releases
get_city("BR").get_city(seed) for reproducible results, generator-level seed() / unseed() for deterministic sequences, and city::seed() for replaying a previous generation.weighted(false) — every city has the same chance regardless of population.cg instances with their own data and random engine — ideal for embedding inside other generators.citygen.hpp is the single required file released here. You need to add
to the files you want to generate cities and set the necessary switches to enable C++23 (e.g., -std=c++23 for GCC and Clang).
Additionally you must supply the city generator with the resources folder containing full/cities.tsv and/or lite/cities.tsv, also available in the release.
For the complete feature guide — fields, filtering, weighting, and more — see the Usage Guide.
The city data is sourced from the GeoNames geographical database. Two tiers are provided:
| Tier | Source | Cities |
|---|---|---|
| full | cities500.zip | ~200k (pop ≥ 500) |
| lite | cities15000.zip | ~25k (pop ≥ 15,000) |
The data is licensed under CC BY 4.0. See LICENSE_DATA.txt for details.
To regenerate datasets:
| Library | Description |
|---|---|
| name-generator | Culturally appropriate full names |
| nickname-generator | Gamer-style nicknames |
| birth-generator | Demographically plausible birthdays |
| biodata-generator | Procedural human physical characteristics |
| country-generator | Weighted country selection by population |
| entity-generator | ECS-based entity generation |