Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Building a Weighted-Random Birth Simulator on an Open-Source Engine

Описание и применение

Создание браузерной игры, где игрок рождается в стране, выбранной по реальным данным о рождаемости, и проживает жизнь, управляемую статистикой страны, без серверной поддержки.

Задача

Design a browser game that randomly assigns a birth country weighted by real-world birth rates and simulates a life driven by country statistics.

Результат

The game demonstrates how to implement weighted random selection, data‑driven life events, batch simulation, local persistence, i18n, and shareable output in a browser‑only environment.

Рабочий процесс

  • 1. Load country data with birth weights and other indicators.
  • 2. Compute total birth weight and perform cumulative‑weight sampling to pick a country.
  • 3. For each simulated year, calculate death and event probabilities from country indicators and age, then roll for outcomes.
  • 4. Apply player choices or auto mode to adjust stats like health and happiness.
  • 5. Run single or batch simulations; keep simulation logic free of DOM for Web Worker use.
  • 6. Persist lives in localStorage with versioned keys and capped history.
  • 7. Provide i18n support for six locales using keyed templates and Intl APIs.
  • 8. Allow downloading a life card image and family tree via canvas toBlob.

Доказательства

The core mechanic is a draw over 172 countries. A uniform Math.random() pick would be wrong, because Tuvalu shouldn't come up as often as India.

Источник

Each country carries real indicators: life expectancy, infant mortality, under-5 mortality and GDP per capita (PPP).

Источник

There's no signup. Progress and past lives are saved in the browser on the device, and the site tells players plainly that clearing site storage removes them and that there's no cloud sync.

Источник

  • Дата записи: 2026-10-23T20:11:18.049Z