Abstract simulation object
Sim3 provides a C++ object called AbstractSimulation,
which contains the common functionality of simulations.
When you write a simulation, it should be an object
descending from AbstractSimulation.
This base object includes:
- simulation control:
abstract methods for starting, stepping the simulation,
and a counter of elapsed simulation ticks;
- an abstract method to draw the current state;
- a private seed and a shorthand method to
generate a random number with it;
- an abstract method to get the name of the simulation.
You should overwrite the required methods (otherwise it will not
compile). In particular, the step() method should contain
the code to execute on simulation step -- the heart of the simulation.
See the User Guide for details.
Random number and seed management
Random number genearation is often needed in simulations.
The C standard library implementation is widely available,
however, it has some deficiencies.
In particular, sometimes one would like to
generate the same, high quality random sequence,
regardless of the platform.
To achieve these requirements, sim3 includes a random number
generator that is open and portable.
The abstract simulation maintains its
own private seed which can be used by the simulation, and is
not affected by other parts (like drawing). There is also
a global seed, which can be used in non-simulation parts,
(like drawing).
Ways of running the simulation
Simulation+display in one process
It is possible to run the simulation and the display/UI part as one
application. You write the main program in your simulation, and
issue a sim3_run_UI() call to start up the desired user interface (UI).
The follwing user interfaces can be used:
-
text-mode console, no graphical display;
display in an X window;
display using OpenGL under X or Win (uses GLUT to manage the window);
display using OpenGL, and GLUI user interface under X or Windows;
display using a Java application (any platform?) (planned);
display using SVGAlib (planned);
display using fbconsole? (planned);
Client-server setup
Under this setup, the simulation and displaying parts are separated into
two processes (applications), which can run on the same or different
networked hosts. The display application is standard, and can
connect to any running simulations, through a TCP/IP protocol.
The following applications can be used to connect to a running simulation:
-
view status of simulation in any web browser;
-
display the simulation using OpenGL under X or Windows;
-
display the simulation in a graphical web browser (planned);
Sim3 was conceived by Adam Rotaru-Varga in early 2000,
based on previous works (AGAWoB, HunBug, CoolSchool, Celle, XRefLint).
^top