[go: up one dir, main page]

An actor world

link to gitlab repository

In october 2018 I started attending theatral improvisation classes: my friend inknos (still waiting to see a finished website, bro, you love suspence) had convinced me to start one of the funniest experiences ever (by the way, we developed a conceptual father of this project together). I am not going to talk a lot about the friends of QuintaTinta and Teatribù here, but they are the ones we should thank for this idea. Finally, thanks to Enrico for the helpful feedback.
Long story short, one of the things a good actor should be good at is knowing where he or she is, both in an absolute sense and in relation with others on stage. It turns out that a good exercise for that is "forming triangles": in a group, everyone chooses randomly two people as targets and when the start signal is given must try to form an equilateral-triangular shape with them (each person being a vertex). Click on the green dot to see this in action.

CHAOS! Everybody is running around, bouncing with others, just when you think you are perfect a target runs away and you start running again. Imagine an unaware man entering the room in that moment...
Sometimes you just keep running and running until the teacher says stop and everybody falls exhausted, but... sometimes the magic happens: you find equilibrium. Some other times, you see, it appears you reached equilibrium, the average speed diminishes, but it is an instant and soon everybody is running again like a fool.

The questions

"Equilibrium", "chaos", dynamics of "average speed"... this, sure like a theorem, makes me think about statistical mechanics, complexity, and dynamical systems! I wondered: how much time does a group need to reach an equilibrium, and will it always be reached? Does the answer change if the number of actor varies? Is there a kind of oscillation between high and low kinetic energy?
Anyway, it seems quite a hard mathematical problem. Unless... does not anybody notice the similarity between "actor" and "agent"?

The model

- Let's start: take your favourite programming language.
- C plus plus.
- Are you sure about that?
- Never been sure.

Very easy setup: a bunch of agents called Actors have a position, a maximum speed (since the unit time is 1, it is equivalent to a step length) and know the istantaneous position of their targets (Actors too). Each time step involves the computation of the distance between the two targets and thus the sweet spot which completes an equilateral triangle (see image).

d √2d/3
After all the actors have decided where to go, everyone tries to reach that point, which is achieved if the following two conditions are verified: If the point is too far, the actor travels a distance equal to his/hers speed.
If the point is out of the boundaries, a new point is selected which is the nearest to it lying on the boundart.

Keep an eye on:

Of course, nobody wants to look at the evolution of hundreds of groups to achieve some statistics (although they are so nice). The number I have chosen to monitor the actors are:

Tuning

Here we have it, right? No: because of the fact that everyone is moving, the destination points keep changing and the energy never goes (near) to zero. I sat and thought: is this realistic? Of course not: if you take, say, three people, they will rapidly form an equilateral triangle; that is why they do not just move, but take a moment to consider the others' position. I implemented this sort of think-dissipation as a probability of staying still for a time step. It seems to work: stability is achieved and energy goes to zero.

Does it work?

Well, yes; and no.
I am satisfied of the general result: as can be seen in the plot below, increasing the number of actors also increases the number of steps needed to converge to equilibrium.
It can be noticed that, for the "unlucky" cases, there is a saturation since a limit on the number of steps has been imposed (in order to avoid infinite simulations; I am here supposing that the initial condition is of great importance to achieve stability). To be sure that this effect is not important, I made a comparative plot which represents the percentage of simulations convergent to equilibrium in function of the number of actors, for different maximum numbers of steps.
The results seem to be almost independent on the maximum number of steps, good news!
So what is bad in this model? Well, let's take a look at the evolution in time of the kinetic energy I defined above.
Remember when I said that "just when you think you are perfect a target runs away and you start running again"? This can seem to be the case for the run labeled '2904': the energy drops, then suddenly rises again. I was very happy: that was my final goal for this project! I then inspected the run closely, making a gif out of the position of actors, superimposing the level of kinetic energy:
Ok, it is a bit long, but I think it is a nice way to understand what is happening. And, as you can see, FAIL: the drop in energy corresponds to a drop in distance, which means that the actors are all concentrating in a point. Is that unrealistic? Not quite, since it happens in the real game (very funny moment); but it is not what I was looking for. By the way, this drop can be appreciated also looking at the distance over time.
However, even if this sudden effect if not reproduced, some runs are certainly realistic, for example the run '2931'.
Run 2931

What is missing?

A quick list of things which can be done to improve the program: