TacticalMetaphysics / LiSE

Rules-based engine for life sims, with time travel
GNU Affero General Public License v3.0
116 stars 9 forks source link

Handle deleting entities from the world while they're still referenced in stats #67

Closed clayote closed 3 years ago

clayote commented 4 years ago

It's possible to store one LiSE entity in a stat of another one; the Parable of the Polygons example uses this to keep a list of places that are unoccupied.

What does it mean to do this if the entity stored in a stat no longer exist? For instance, if you run Parable of the Polygons for a few turns, then delete an unoccupied place, and run it some more, it will try to use its stored list of unoccupied places, which still includes the place you deleted.

To some degree this is an unavoidable problem of simulation design, but it also has implications for LiSE when, for instance, you are operating a proxy engine and loading Parable of the Polygons in such an invalid state -- the proxy engine tries to instantiate proxies to the places in the list, but one of them doesn't exist, and it errors.

Possible approaches:

clayote commented 3 years ago

I decided to keep the ability to store entities in stats, and just use the truthiness of each entity to represent the fact that it refers to something that's really in the world model.