I am composing a library for Discrete-Event Simulation of vehicle traffic. Vehicles are modelled as agents, while the network is modelled as a set of interconnected edges and nodes (a bidirectional graph of locations). At some point, vehicles will have to queue up on some nodes/edges, such as, for example, traffic lights. In an event-driven scenario, I would go about modelling the traffic lights as a queue.
- Vehicles calculate their distance from the traffic lights based on their position and some path (to the traffic lights).
- An event is created at the time calculated by estimating how long it takes to cross that distance at a constant speed. Upon this event, a check occurs, regarding whether the traffic lights correspond to a "halt" (relevant), or a "pass" (irrelevant).
- If the vehicle must halt, the event simply increases the Queue associated with the traffic lights by 1.
- In time, the traffic lights become "green" (pass) and the queue is "unloaded" during a corresponding event.
The actual scenario is more complicated, of course, but even from those few steps, I could foresee a very specific problem. My intention is to have the possibility of "replaying" the results of the simulation in the form of a "playback". The output of the steps described above can be "faithfully" visualised in a replay as an animation of a bucket placed right where the traffic lights are located, with a size that increases as vehicles queue up and decreases as they "unload" (resume motion).
This is, obviously, not very realistic. What I want to end up with is a "faithful" replay of actual traffic moving about. So my question is, how do I "transition" from a Discrete-Event Simulation result to a realistic replay? Is there some standardised manner to actually transition from, for example, a FIFO-bucket-based queue to actual vehicle sprites queuing up one behind the other in a relatively precise (spatially) manner? Or must I "set up" my model in a manner that is different to the steps outlined above, to actually "catch" that behavior right upon its manifestation? Or am I just hitting a dead end with this and I should just switch it all to a time-based simulation modality (instead of discrete-event), so that I can evaluate full-blown motion dynamics in discrete time steps?
Bear in mind that I don't want to just get a "representational" visualisation. What I am looking for is to end up with the actual positions of the vehicles in-between the events.