Egregoria (previously Scale) Devblog #2

If you want to know what Egregoria is about, here's the first post.


My last post gathered a bit of attention, and since I like stats, here are some numbers.
In January, Egregoria got:

  • 44 upvotes on the reddit post
  • ~650 visits on the blog
  • 19 new stars
  • 4 new watches
  • 75 new commits
  • 9,771 additions
  • 7,684 deletions
  • 5 new dependencies


After looking at different GUI libaries, I settled on imgui since it is best suited to prototyping and easy development.
I like its API, and combined with the imgui-inspect crate, I got an entity inspector for specs working quite fast. Adding components is also very easy with imgui-inspect-derive and some generics.

However, I needed some way of accessing the world from within the inspector to query some info, so I forked the crate to add it to the render trait, and told the crate owner about it. Open Source !

Here is an example of the inspector on a car entity: Inspector example for Egregoria

Traffic simulation and Road Editor

Most of the time spent on Egregoria this last month was dedicated to the traffic system.
I worked through several designs for the way I handled the road graph, the intersections, the traffic lights, the road builder and the interactions with the ECS.
I also worked a lot on the car physics, iterated on several car models and considered rewriting everything more than once.
In the end, I have something that is not perfect and I am still working on it.

I took a week away from the project to calm down as rewriting the road system endlessly is tough. It lead me to dive deep into Citybound's but mostly Abstreet's road system to understand how other people do it.
Abstreet's model is very clear and intuitive so I am definitely going to steal some ideas.

Here is a video of the road builder and the cars (that aren't very fancy at the moment) in action:

Giving up OSM import

Trying to convert data from OSM maps could be cool but doesn't fit into Egregoria's narrative, as I want to design the world myself.
Having my own world model means more flexibility and avoids subtle map errors. It's also a lot more work in the design of the roads and the city, but with the good tools it should not be a problem.

 About emergence

To me, there is a trade-off when trying to simulate life between emergence and natural behavior.

On one end, there is the Game of Life which is the "emergence from simplicity" champion.
GoL rules fit in a single sentence, yet you can create amazing things with it.

On the other end are animated movies. Every single action is scripted and there is absolutely no decision making or emerging complexity. However characters look very real and the world feels right (granted it isn't too abstract).

Say I want to simulate a car, obviously I'm going to do some research about how cars work, how human drive cars and how people interact.
It'll end up being a bunch of rules and constraints, which are predictable and even if there is no script, there won't be any surprises/ random events.
So I could add some randomness, make the car freer and the drivers imperfect, but then I risk running into deadlocks and the whole road system just not working at all.

There's no solution to this problem, it's just fine tuning and hoping that everything falls into place while staying interesting to watch.

< Back to list