Schools-Sim Particle Force Simulator
Schools-Sim
The Schools-Sim application gets its name from my original attempt to simulate the flows of "schools of fish"
(or flocks of birds). This soon grew into a general particle-force simulator, wherein three findamental types of "particles"
(Red, Green and Blue) may be given either symmetric or asymmetric "force" rules, for up to three different fields.
In complete violation of the known laws of physics, you can assign asymmetric force rules between particle types. For instance,
you can have Red attracted to Blue, but have Blue repelled by Red. This would cause a Red-Blue pair to accelerate forever, one
chasing the other, if not for a limiting velocity that is imposed. Additionally there are three "forms" of fields that may be put into effect:
- Seek/Repel (radial force lines): Irrespective of given velocity, particles may experience an attractive or repulsive force in the
presence of other particles (of a specified type), with strength that varies with the familiar inverse-square law. Thus, once can
simulate gravitational attraction, or electrostatic attraction or repulsion.
- Meetv/Antiv (parallel transverse force lines): With respect to a moving particle's vector (speed and direction), nearby particles
may experience a force that drags them along the same vector (Meetv) or opposite that vector (Antiv), with a strength proportional both
to the moving particle's speed, and their distance to that particle (again, by inverse-square law).
- Handl/Handr (orthogonal transverse force lines): With respect to a particle moving "North", nearby particles will feel a force that
drags them West (Handl) or East (Handr), with a strength proportional both to the moving particle's speed, and their distance to that
particle (again, by inverse-square law).
For each of the 9 possible ordered particle-type pairings { (R,R), (G,G), (B,B), (R,G), (G,R), (R,B), (B,R), (G,B,), (B,G) }, (6 if you impose symmetry),
and the (0, 1, 2, or 3) force types that may be assigned to that pairing, there are two "Radii of Influence" ( 0 < NearRadius < FarRadius ) that may
be assigned. For a given particle and force-rule, particles beyond "FarRadius" are ignored (or else simulations would take forever to run), particles
within FarRadius but beyond NearRadius are applied just one collection of rules, and particles within the NearRadius are affected by BOTH the first set
of rules and an additional and independent set of rules.
The three types of particles (R,G,B) may be assigned color-specific masses, and F=ma is properly applied, although I have tended to study only the
cases where all particles have the same (unit) mass. The various force-rules may be given unique strengths, and generally are.
The time-wise "fade" of particle brightness with each cycle can be varied. allowing longer or shorter particle "contrails" to be generated, revealing
the particle's recent path.
Each simulation begins with a "population density" of R, G and B particles scattered randomly across the topologically-toroidal field (so
edges wrap). I have generally specified equal density (population proportions 1/3 each color). Each particle is given an initial random velocity
(direction and speed).
The application allows for a random set of rules to be generated with reasonable limits to values, and the rules-file so generated gets a "name" of
the 8-char hexadecimal form XXXXXXXX, being the current "Unix Seconds" (32-bit int value) measured at the time of rule creation, and employed as the
seed supplied to the random generator. Likewise, the graphic "frames" that are output are labeled with this rule-name (and the number of cycles into
the simulation at which point the image was generated. The application optionally accepts this 8-character timestamp to be input as the randomizing
seed, to allow the same set of rules to be applied, with scale changes (size of bit-field) so that an "interesting" result can
be regenerated at higher resolution or for more cycles, or with frames output at a different rate.
The Schools-Sim software and source code (and dependent libraries and source code) will be available soon.
Some School-Sim Creations below
Note: For sim SR-4C0DF8A2, to see awesome details it is best to download the video (180 MB) and use a dedicated desktop
player like the free "VLC Media Player"[*] or similar local player. The Google Photos "built-in" streaming player produces a fuzzy and halting result.
[*] (Toss them a few bucks! Their player is excellent and you can edit the toolbar with drag-drop to add buttons for snapshot, change playback rate, etc.)
|