Creating a world with geometric primitives
We will learn how to create our own simulation filled with different colored bodies with simple geometric shapes. In this process, we will become familiar with a multiplication function that allows us to duplicate arbitrary collections with certain random parameters and that is also suitable for scaling up simulations.
What you will see
1. Creating a new simulation with appropriate parameters
First, we create a new simulation by clicking on the New menu item in Simulation. A dialog opens where we can set all the necessary parameters:
- world size and CUDA parameters: We have already learned about these settings in the previous tutorial. In this example we will choose a world size of 2,000 x 1,000 and the CUDA parameters from the screenshot below.
- simulation parameters: These contain all important settings for physical behavior and cell functions. We will deal with this in more detail at a later stage. For this tutorial, it is sufficient to use the default settings.
- symbol map: Symbols and their meanings can be defined here, which can then be used in a specific programming language for computing cell functions. But these do not play any role in this tutorial.
- initial energy: It is possible to initially specify a certain amount of energy in the form of particles. We will not use this possibility here and leave the value at 0.
We confirm with OK and let our new world be generated. In the log at the bottom right we see that new GPU memory is reserved.
2. Adding a rectangular cell cluster
We now add a rectangle consisting of cells. For this we click on Add rectangle under Collection and the following dialog should appear:
Here one can specify the width and height in number of cells, as well as the distance between connected cells. In this example let us choose a size of 10 x 40 cells. In addition, each cell has an internal energy value. By emitting radiation through energy particles, a cell loses energy over time and decays as soon as it falls below a critical value (can be configured). We leave the default value for the internal energy at 100. The color code is a value in the range 0 to 6 and indicates the visible color. We choose the value 1 (=red). Having confirming with OK, we see our rectangular cell cluster in red in the center of the view:
3. Generating random copies
Every created or loaded cell cluster (or in general a collection) is automatically selected and can thus be used for duplication. This is exactly what we will now try out by opening the Random multiplier under Collection. It allows you to duplicate any collection as many times as you like at random locations, randomly changing other properties as well.
In this case, we choose 50 copies at random angles (0 to 360 degrees), with horizontal and vertical random velocities ranging from -0.1 to 0.1 (space units per time step) and random angular velocities from -3 to 3 (degrees per time step). We then confirm with OK. Since our world is relatively large, we need to zoom out to see the result.
4. Adding hexagonal and circular cell clusters
Next, we add hexagons. We can scroll to a desired position and click Add Hexagon under Collection.
The number of cell layers as seen from the center can be specified in the dialog. Also, as before, we can specify the distances, internal energy and color code. We select the values as shown in the screenshot and confirm with OK. Now the newly created hexagon in the center is selected and can be copied with the random multiplier. In this dialog we do not have to change any values (the dialog remembers the last values) and can confirm directly with OK.
We repeat the same procedure for the disc structures via clicking on Add disc and set the values in the dialog as follows:
After multiplying again and zooming out to 1x, we should see the result:
As always, it is recommended to create a snapshot and only then start the simulation. In the running simulation, you can observe that some structures stick together, break in rare cases, and emit radiation. All these properties can be configured in the simulation parameters.
Created with the Personal Edition of HelpNDoc: Free Kindle producer