-
Notifications
You must be signed in to change notification settings - Fork 1
Simulation View
The Simulation View, or Sim View, is the last step in the process of Beep Beep. This view is constructed as a Unity3D Scene called SimViewScene. Within the Sim View, Car models will generate on the already defined traffic system (built and compiled by the user in the Build View) and behave according to predefined parameters. This behavior includes reaching a predefined destination, reacting to other cars, reacting to traffic lights and stop signs, acceleration/deceleration, and lane changing.
The sim view is basically where the simulation happens with built roads, intersections and cars moving on the screen for research. At this stage, users will not have the ability to move around the roads anymore.
The roads are built with a designated road controller that takes all the links from the build view and add components of roads to the original links. This task is accomplished by a polymorphism class of road hierarchy with roads of different kinds to avoid redundancy of coding. Roads with different numbers of lanes will have different appearances in the sim view for better illustration purpose. The cars currently run in the pre-defined path of vectors on the screen which are supposed to be assigned by the compiler.
The Sim View must:
- Simulate the traffic in accordance to the previously built traffic system
- Have Cars spawn and de-spawn based on their source and destination
- Have Car react appropriately to the road, other cars, traffic lights, and stop signs
An action point is the Sim View translation for a node which implements the node type of that specific node in Build View (i.e. a traffic light, stop sign, or simply a part on a road). The action point has similar properties as a node.
A road is a unidirectional lane or lanes for a car--this means that a bidirectional one lane link in Build View would translate to two roads. This was done for simpler path navigation and movement for a car (as the path a car should take is defined as a vector of roads). These are objects on which cars can travel and change lanes.
A Road has the following attributes:
- Origin
- Destination
- Line Renderer (to place on screen with correct number of lanes)
- Length
- Number of Lanes
- List of cars currently on the road
Cars obviously represent cars navigating throughout the traffic system.
A singular car has the following attributes:
- Path (a collection of roads)
- Current Road Index for Path
- Maximum Speed
- Current Speed
- Angle (i.e. current direction the car is on the Sim View plane)
- Reaction Time
- Acceleration Rate
- Deceleration Rate
- Origin
- Destination
For the models on how a car should respond to certain elements, such as other cars, see the docs folder of the coding repository.
This file contains all of the behavior for action points in the Sim View and the conversion between the previous node properties to the proper action point (with appropriate behavior in the simulation).
This file contains the conversion behavior from a link into a road.
This file contains all of the behavior of a singular car gameobject in Sim View.
This file contains all of the base behavior of a road gameobject in Sim View.
The following subclasses exist as there can only be a maximum of four lanes in a singular direction.
This file contains all the specific behavior for a one lane road. This class is inherits from the SimViewCar class.
This file contains all the specific behavior for a two lane road. This class is inherits from the SimViewCar class.
This file contains all the specific behavior for a three lane road. This class is inherits from the SimViewCar class.
This file contains all the specific behavior for a four lane road. This class is inherits from the SimViewCar class.
The following are features that Team Beep Beep would like to implement in the future.
We would like to implement car lane changing in the future, as described in the models in our docs file. This would allow cars to make the appropriate decisions as to whether a car should change lanes at any given moment.
We would like to implement a timer in Sim View that would allow the user to see the simulated time span. Along with this, there should also be the ability to pause and replay the simulation, which would also be reflected in the timer and the overall "time" of the simulation.
Adding to the previous task, we would like to have the ability to fast-forward a simulation in the case that a user would mainly like to see the long term effects of a traffic system or to reach a specific part of the simulation.
Adding to the previous task, we would like to have the ability to rewind or replay a simulation in the case that a user wishes to review the simulation or play again in the hopes of a different outcome. In the same vein, there should also be an ability to stop/force stop the current simulation.
In the future, we would like to implement the ability to change certain attributes of an action point or road before or during the simulation. This could allow the user to do some split second changes to have a better (or worse) traffic system. These modifications would not include the ability to move, add, or delete action points or roads.
We would like to have an end screen implemented after a simulation has effectively been completed or the simulation was stopped. This end screen should show statistics about how many cars went through x action point, the total number of cars able to reach their destination, mean car speed, and many other facts. These could be of use to researchers as well as fun/informational to casual users (and could have ties to the future gamification of the software).