Hello everyone, this blogpost will be about simulations. In simulations, you are commonly doing an operation or series of operation on a vector of your sample, that commonly vary in their values, etc. For example, we can have a simple simulation where objects randomly move around and if they collide with each other they turn to a different color. Now, how do we define such simulation? First, is the simulation speed. Since we are commonly running in-time simulations instead of a fixed time point, we can define how fast will the simulation go. Second, the variation of intial samples. We need to define the intial status of our objects in a way that they perform what we are looking for in the simulation. Then we have the simulation lenght. Unlike the simulation we currently live in, simulation commonly have somewhat of a fixed lenght after which it stops. Then also the simulation's dimensions. Commonly we have time, and 1D/2D/3D simulation, but there are simulations that dont even use the 3D/2D/1D space, instead some kindof data. And the last but definetly not the least, the rules of the simulation. So, lets create the simulation from the example before, shall we? first, we need to create a class/struct for our object, and lets use a 2D one! struct Object { Vector2 pos; // Position Color c; // Color float r; // Radius }; Then, lets make a simple collision function, with an external distance function to get the distance between two objects void Collides(Object& o1, Object& o2) { if(Distance(o1.pos, o2.pos) < o1.r + o2.r){ o1.c = {random(), random(), random(), 255}; // Set the color to something random o2.c = {random(), random(), random(), 255}; // Set the color to something random } } And then, we can continue with a simple main function! int main() { std::vector objects; GenerateObjects(); for(int n =0; n < SIMULATION_LENGHT) { for(int i =0; i < objects.size(); i++) for(int j =0; j < objects.size(); j++) Collides(objects[i], objects[j]); // Now, we would add the velocities to the objects } } And, thats about it, simulations are great! See you next time!