Dev.to AI 🤖 Ai 👁 0 📖 12 min read

Building a Live Observatory for an AI Civilization Simulator Was Harder Than I Expected — TPECKA180

I'm TPECKA180, an independent developer working on Living Planet, an experimental civilization simulator powered by local language models. In my previous articles, I discussed autonomous AI civilizations and my plans to

I'm TPECKA180, an independent developer working on Living Planet, an experimental civilization simulator powered by local language models.

In my previous articles, I discussed autonomous AI civilizations and my plans to eventually let them learn from their own decisions.

This time, I want to talk about a completely different engineering challenge: building a public website that receives and displays data from a simulation running on my personal computer.

The idea sounded relatively simple.

The implementation turned out to be considerably more complicated.

The original idea

Living Planet is a simulation built with Python and Pygame in which independent countries are controlled by local language models.

Countries make decisions about economic development, diplomacy, research, territorial expansion and military conflicts. The game engine validates their proposed actions and determines the consequences.

While developing the simulation, I started thinking about how interesting it would be to let other people observe these artificial civilizations without requiring them to download the game or run a language model themselves.

Imagine opening a website and watching an artificial civilization develop over several days or weeks.

You could observe economic growth, military conflicts, diplomatic changes, technological discoveries and unexpected strategic decisions.

That idea became Living Planet Global Observatory.

The important distinction is that I don't want the website to display prerecorded scenarios or randomly generated statistics.

I want it to receive information from an actual simulation running on my computer.

Why not simply stream the game?

The obvious solution would be to stream the game as video.

However, video has several limitations.

Viewers cannot easily explore historical economic data, compare countries, examine individual events or interact with charts.

A video stream shows what is currently visible on the screen, but it doesn't provide structured access to the simulation's underlying state.

Instead, I wanted to transmit structured telemetry.

The website should eventually receive information such as:

  • Current simulation day.
  • Country statistics.
  • Population changes.
  • Economic indicators.
  • Resource production and consumption.
  • Territorial changes.
  • Military activity.
  • Diplomatic events.
  • AI performance metrics.
  • Accepted and rejected actions.

This transforms the website from a simple viewing platform into something closer to an experimental research dashboard.

Unfortunately, it also introduces an entirely new set of problems.

Keeping the simulation independent

One of my most important requirements is that the game must remain fully functional without the website.

Living Planet was designed to run locally. I don't want its core simulation to depend on an internet connection or a remote service.

If the website becomes unavailable, the game should continue.

If a telemetry request fails, the simulation should continue.

If my internet connection disappears halfway through a simulation day, that should not prevent countries from making their decisions.

This requirement led to the decision to create a separate Broadcast Edition rather than immediately modifying the stable public release.

The experimental edition can be developed and tested independently while preserving the existing game.

Conceptually, the architecture looks like this:

LOCAL COMPUTER
    |
    |-- Living Planet simulation
    |-- Local language model
    |-- Local database
    |-- Telemetry module
    |
    v
Broadcast protocol
    |
    v
Remote telemetry receiver
    |
    v
Global Observatory
    |
    |-- Live world
    |-- Historical data
    |-- Economic charts
    |-- AI performance analytics

The simulation remains the authority over the world.

The website is an observer, not a participant.

The difference between game data and telemetry

One of the first architectural questions was determining what information should actually leave the computer.

The game contains much more information than a public dashboard needs.

There are internal simulation structures, model contexts, private country information, hidden prompts, intermediate outputs and implementation-specific details.

Sending everything would be a poor design decision.

It would increase network traffic, expose unnecessary information and make the website heavily dependent on the internal architecture of the game.

Instead, the telemetry system needs a clearly defined public representation of the simulation.

The website should receive only the information explicitly intended for publication.

For the experimental Broadcast Edition, hidden prompts, internal reasoning and raw model outputs are excluded from public telemetry.

The objective is to observe the consequences of AI decisions, not expose every internal component involved in producing them.

Snapshots and incremental updates

Another challenge is determining how often the game should transmit information.

Sending the entire world state after every minor change would be inefficient.

On the other hand, sending only individual changes introduces synchronization problems.

Imagine a website receives information about a country's economy, but misses the previous update that changed its territorial ownership.

It may then display a combination of data that never actually existed in the simulation.

To address this problem, the experimental telemetry architecture uses snapshots and incremental updates, also known as deltas.

A snapshot represents a defined state of the simulation.

A delta describes changes relative to a previous state.

The advantage of this approach is that the system can potentially avoid repeatedly transmitting unchanged information.

The disadvantage is that incremental updates require careful handling of ordering, missing messages and recovery.

A receiver needs to know whether an incoming update belongs to its current state.

If something is missing, applying subsequent updates blindly could produce incorrect results.

One possible recovery strategy is to request or wait for a new complete snapshot rather than attempting to reconstruct an unknown state.

This is one of the reasons why designing a telemetry system is substantially more difficult than simply exporting a JSON file.

Developing a dedicated telemetry protocol

The experimental Broadcast Edition introduced a protocol called LPTP v1, or Living Planet Telemetry Protocol.

The purpose of defining a protocol is to establish a predictable contract between the game and the observation system.

The website should not need to understand every internal Python object used by the game.

Instead, it should understand a documented telemetry representation.

The protocol needs to address several important questions:

  • Which simulation session does a message belong to?
  • Which state or update does it represent?
  • What version of the protocol is being used?
  • Is the message compatible with the receiver?
  • Is an earlier update missing?
  • Has this information already been processed?
  • Can the receiver detect inconsistent or corrupted data?

Without such a contract, every significant game update could potentially break the website.

The initial development work included protocol documentation, schemas and local telemetry generation.

However, generating protocol messages locally is not equivalent to proving that the complete remote broadcasting system works.

That distinction matters.

Hash chains and data consistency

Another mechanism introduced during development was a hash chain.

The general idea is that consecutive telemetry records can be cryptographically linked, making it possible to detect certain inconsistencies in the recorded sequence.

For example, if a record depends on the hash of its predecessor, modifying or removing an earlier record may cause subsequent verification to fail.

This is useful when dealing with a simulation that produces historical records over time.

However, a hash chain does not solve everything.

It does not automatically prevent an unauthorized sender from submitting an entirely new sequence of fabricated records. It also does not guarantee that the underlying simulation data is correct.

Authentication, access control, message validation and trustworthy state generation are separate problems.

The objective is to use integrity verification as one layer of the overall architecture, rather than treating it as a complete security solution.

An actual problem: SQLite resource management

During development, a resource-management issue involving SQLite descriptors was identified and corrected.

This was a useful reminder that adding telemetry to an existing application can expose problems that may not be obvious during normal gameplay.

A short simulation session might never reveal a resource leak.

A simulation running continuously for days or weeks is a different situation.

Database connections, file handles and background operations need predictable lifetimes.

A small leak can become a major stability problem when an operation is repeated thousands of times.

This becomes particularly important when telemetry generation, database access and simulation execution coexist within the same application.

The intermediate development report recorded the correction of the SQLite descriptor leak.

I consider this type of issue just as important as the visible features of the website.

A beautiful dashboard is useless if the application supplying its data gradually becomes unstable.

The home computer problem

Unlike a conventional cloud-hosted application, the actual simulation is intended to run on my personal computer.

That introduces several constraints.

My computer may be turned off.

My internet connection may become unavailable.

The simulation may be stopped for maintenance.

The computer may be busy running a local language model or other development tools.

The website must be designed around these possibilities.

It should distinguish between several conditions:

  • A simulation is actively broadcasting.
  • The last known state is available, but no recent data has arrived.
  • A simulation has ended.
  • A new simulation session has started.
  • No real data has been received yet.

Displaying stale information as if it were currently live would be misleading.

I would rather show an explicit offline or waiting-for-data state than invent activity to make the website look more impressive.

Why I don't want to expose the entire computer

Another architectural concern is network exposure.

A public observation website should not require unrestricted access to my computer, local database or AI inference service.

The intended architecture is based on a narrowly defined telemetry channel.

Ideally, the local application initiates an authenticated outbound connection and transmits only approved public data.

The public website should not be able to execute commands inside the game or modify the world state.

The observer must remain an observer.

This also means that the remote receiver needs to validate incoming messages and impose reasonable limits on data sizes, update frequency and resource consumption.

These are engineering requirements for the remote integration, not claims that every security mechanism has already been deployed.

Building historical analytics

A live map is interesting, but historical data is what could eventually make the observatory genuinely useful.

I want visitors to be able to examine how artificial civilizations change over time.

The initial design focuses on retaining and displaying the most recent ten simulation days on the website.

Potential future analytics include:

  • Population growth and decline.
  • Resource shortages.
  • Changes in economic productivity.
  • Military expansion and territorial losses.
  • Differences in national strategies.
  • AI-generated action categories.
  • Rejected actions.
  • Model generation speed measured in tokens per second.

These metrics could reveal patterns that are difficult to notice while manually watching the simulation.

For example, a country may appear successful because it expands rapidly, while historical economic data reveals that its development is becoming increasingly unsustainable.

The observatory could eventually make such relationships much easier to examine.

However, historical analytics introduce additional requirements involving storage, aggregation, session identification and missing data.

If only one snapshot exists, it is impossible to establish a meaningful historical trend.

The dashboard needs to communicate that limitation rather than generate artificial graphs.

The challenge of measuring AI performance

Living Planet runs language models locally.

I am particularly interested in observing the relationship between model performance and the behavior of artificial civilizations.

A model producing more tokens per second is not necessarily making better strategic decisions.

Likewise, a country generating longer responses is not necessarily developing a more effective economy.

I want to eventually compare several different metrics:

  • Generation speed.
  • Processing time.
  • Number of proposed actions.
  • Number of accepted actions.
  • Number of rejected actions.
  • Distribution of action categories.
  • Long-term simulation outcomes.

These measurements could help distinguish raw inference performance from actual usefulness inside the simulation.

The observatory should eventually make that comparison visible.

For now, deeper AI analytics remain a development goal rather than a completed public feature.

Testing the system

According to an intermediate development report, the isolated experimental Broadcast Edition successfully completed 533 tests.

The local telemetry module, protocol-related work and portable Windows build reached an initial development checkpoint.

This was encouraging, but it did not mean that the entire observatory was finished.

There is a major difference between:

  • Testing individual software components.
  • Testing local telemetry generation.
  • Testing a protocol implementation.
  • Building a working executable.
  • Successfully transmitting real data over the internet.
  • Running a complete broadcasting system continuously for several days.

Each represents a different level of confidence.

Passing hundreds of automated tests does not prove that a remote deployment will behave reliably under real-world network conditions.

That still requires end-to-end integration and operational testing.

Even packaging introduced another obstacle

The intermediate development work also encountered a packaging limitation.

A portable Windows build was produced, but creating a conventional installer was blocked by the absence of Inno Setup in the available development environment.

This is not a fundamental architectural problem, but it illustrates how many unrelated components become involved in a project like this.

The simulation itself may work.

The telemetry module may work.

The website may exist.

Yet the complete distribution and deployment workflow may still be unfinished.

Software development rarely progresses as a single uninterrupted sequence of successful implementations.

The current state of Global Observatory

The public website already exists and introduces the simulation, its mechanics, screenshots, development roadmap and release information.

It also contains dedicated Live World and Analytics sections.

The public page I am discussing currently presents an explicit waiting-for-broadcast state rather than simulated live statistics.

The local telemetry foundation has been developed separately, but I am not claiming that the full remote broadcasting pipeline has been successfully validated.

There is still a difference between a website designed to receive live data and a fully operational live observation service.

I want to preserve that distinction throughout development.

What still needs to be tested

The next major engineering milestone is establishing reliable end-to-end communication between the simulation and the website.

I want to investigate how the system behaves when:

  • The internet connection disappears during a broadcast.
  • The receiver restarts.
  • An update arrives twice.
  • A telemetry message is incomplete.
  • The application restarts during a simulation.
  • A new world replaces the previous world.
  • The website has outdated information.
  • The simulation runs continuously for an extended period.

The system should handle these conditions without damaging the local game or displaying misleading information.

I also want to measure the actual overhead introduced by telemetry collection.

Living Planet already performs computationally expensive local inference. The observation system should not consume unnecessary resources or significantly interfere with the simulation.

What I learned from this development stage

The website initially looked like the relatively easy part of the project.

I expected the difficult work to be related primarily to artificial intelligence and simulation mechanics.

Instead, building the observatory introduced questions about distributed systems, database resource management, synchronization, protocol compatibility, security, data consistency and historical storage.

The most valuable lesson so far is that building a dashboard is not the same as building a reliable observation system.

A dashboard displays information.

An observation system must also establish where that information came from, whether it is complete, whether it is current and whether it can be trusted.

Those are substantially different engineering problems.

The long-term vision

Eventually, I want Global Observatory to become a public window into an autonomous artificial world.

Visitors should be able to return after several days and discover that civilizations have developed technologies, formed alliances, experienced economic crises or changed their strategic priorities.

In the future, if the planned self-learning architecture becomes operational, the observatory could also help investigate how individual civilizations adapt through experience.

That is still a distant research direction.

For now, the more immediate challenge is considerably simpler to describe, but difficult to implement correctly:

Reliably transmitting the state of a locally running simulation to a public website without compromising the independence, stability or integrity of the original application.

I'm interested in hearing from developers who have built similar telemetry systems.

How would you approach reliable state synchronization between a continuously running local simulation and a remote public dashboard?

Would you prioritize complete snapshots, incremental updates, event sourcing, or some combination of these approaches?

Project links:

Developer: TPECKA180

Disclosure: This article was drafted with AI assistance based on project documentation, an intermediate development report and the publicly available project website.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.