MASON is a single-process discrete-event simulation core and visualization library aimed at multiagent simulations with large numbers of agents. The system is written in pure Java and is intended for experienced Java coders who want something general and easily hackable to start with, rather than a domain-specific simulation environment. Some features:
MASON is open-source software licensed under the Academic Free License, version 3.0. See the LICENSE file for more information.
Windows: | double-click on mason.bat |
OS X: | double-click on mason.1.3.1.command [for fastest 2D demos but no 3D demos] |
(or) OS X: | double-click on mason.command [for 3D demos] |
Linux/X11: | exec mason.sh |
Pick an application from the list which appears and have fun!
Alternatively you can download the library collection on the MASON web page, which contains these libraries, and move them into MASON from there.
Alternatively you can download the library collection on the MASON web page, which contains this library, and move it into MASON from there.
Alternatively you can download the library collection on the MASON web page, which contains this library, and move it into MASON from there.
MASON Documentation and Tutorials
New Users
Start with Tutorial 0, which is a tour through various features of MASON's GUI code, and doesn't require much knowledge of Java.
If you're the kind of person who likes UML charts (or a bad approximation thereof), take a look at our Simulator Layout diagram, last updated a few versions ago and still pretty accurate.
Last but hardly least, we predict that the Class Documentation will prove useful to you. There is also an overview of the basic MASON classes.
The Notes contain vital stuff that any MASON hacker should know.
If you're interested in grokking the internal scenegraphs of the Java3D code (which admittedly can get hairy), we have provided you with a graphical depiction of the important scenegraph structures.
Last, the app directory contains a number of example programs illustrating various MASON programs (and of varying quality!).
Hop on the MASON mailing list and post a question! Humans are often the best documentation of all. See the MASON website for instructions.
MASON compilation presumes you are experienced with setting up CLASSPATHs (Windows example, OS X, Linux, etc.), running javac or jikes, and using a Makefile (if you're running Linux or MacOS X).
Here's what needs to go into the CLASSPATH:
If you're planning on using jikes, you'll also need to set up the JIKESPATH to include everything in the CLASSPATH, plus the various jar files of your java installation. See the jikes documentation for more information.
On this page Steve Lytinen and Steve Railsback have written a nice tutorial for using MASON in Eclipse.
Make sure your CLASSPATH is set up right. Then:
cd mason; make 3d
...will compile all the files. Try make help to see more options.
If you've not installed Java3D and just want to play with the 2D stuff, try:
cd mason; make
If you get an error about jikes not installed, you can modify the Makefile's JAVAC variable to use the javac compiler instead. Or if you'd like to try jikes (it's much faster), install it from IBM's site.
Make sure your CLASSPATH is set up right. Then try this:
cd mason Every GUI app class ends with the extension "WithUI.java". Assuming your CLASSPATH is set up properly, you can run any of them directly from the command line. For example:
java sim.app.heatbugs.HeatBugsWithUI
You can also run MASON proper from the command line like this:
java sim.display.Console
In certain situations you may wish to run with more memory. First, certain Java3D applications (notably Particles3D) require a lot of RAM because Java3D is a memory hog. Second, if you're running in Windows or Linux and wish to use the faster stretched image technique for drawing grids of rectangles (see the Options window -- the wrench icon ), increasing RAM will help performance. You can do this by including the -Xmx option in Java. For example, to run MASON directly using 200 megs of RAM:
java -Xmx200M sim.display.Console
MacOS X presents a special gotcha. The 2D MASON code runs much faster on MacOS X when using Java 1.3.1, as 1.4.1 is not presently hardware accelerated on the Mac. But the 3D MASON code only runs on 1.4.1. So if you're doing a MASON 3D app you must run 1.4.1 on the Mac; but if you're doing a MASON 2D app, you'll probably be much happier running 1.3.1. Sorry about that!
If you've upgraded to the latest Java on the Mac, you're running 1.4.1 or later. You can make a given Terminal window use 1.3.1 instead of 1.4.1 java with the command:
(In tcsh)Compiling MASON
Compiling From Eclipse
Compiling from the OS X / Linux Makefile
Compiling from the Windows DOS prompt
dir /s /B *.java > sources.txt
javac @sources.txt
Running an App from the Command Line
alias java /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Home/bin/java
(In bash)
alias java='/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Home/bin/java'