I am trying to reproduce animation for a discrete event simulation (DES) model, so I am exploring libraries like Babylon.js to do so. Thus, I am new in Babylon.js, thus I am not fully aware of the capabilities and constrains of this library. So, I would love any ideas in how I can achieve an animation for a DES model in Babylon.js.
To give a little bit of context what DES is capable here is a common use of DES models: Discrete event simulation can be used to model a system where customers arrive and a server serves them, e.g and ice cream cart(server) and customer for those ice creams(customer). The simulation would involve creating virtual “customers” and a virtual “server” and then modelling the events that occur when a customer arrives, is served, and leaves. By saying this, the most common scenario of DES models is when customers arrive to request a server randomly, meaning that animation cannot be looping a customer arriving at the same time to the server every time, and the server takes a random time to serve a customer, that means that an animation of a server servicing customers cannot be by looping the same service time for all the customers since every service is very likely to be different one to another. So, it’s very likely as well that customers must wait sometimes for being served by the server or likewise the server might be idling during the animation-simulation, thus looping for a standard behaviour would not be helpful to this kind of animation-simulation.
Here is an example of a DES animation made with Simpy and Maya in Python, where a fleet of trucks uses a couple of servers and follows some paths, but sometimes the trucks wait to be loaded and sometimes they are loaded immediately after arriving to the serve. This is more or less what I want to achieve with Babylon.js
(2) Discrete Event Simulation with SimPy and Maya - YouTube
What I have tried:
I have tried some animations applied to a black box but everything with keyframes, that once I try to with a couple of element gets very clunky to make an automation of a sequence of the same kind objects, modifying the keyframes every time I wanted a different behaviour in the object animated.
I have try as well with group animation, but when I stop, pause, play, and reset a group of animations they stop, play…etc, all at the same time so it does not work in my purpose. Here is the playground that I tried to modify to stop only one object but not possible.
I have tried as well with some methods like scene.registerBeforeRender() and scene.registerAfterRender() but with the type of input that I will receive from the DES model that is like a trace file with commands to do with a timestamp, to be honest I cannot imagine how to tackle this.
Here there is another playground that show a sample of the input file produced by the DES model, it is represented by lines of strings in text file, and for simplicity is given in this playground in the array called “trace” and every push line means a command from the DES model.
try_1 | Babylon.js Playground (babylonjs.com)
What I am looking for is for a bit of inspiration in how to tackle this, I recall that what I wish to achieve is something very similar to the youtube video of maya and simpy beforementioned.
Thanks a lot for any help. God bless you all.
Best,
Andres