User Tools

Site Tools


Nanoverse overview

Nanoverse is a platform for spatially explicit, multiparadigm platform for simulations and games. Nanoverse is largely based around the concept of agent-based modeling, and utilizes declarative and functional paradigms for the specification of those models.

Nanoverse is a compiled platform: rather than reading a project specification line-by-line, Nanoverse reads the entire specification and defines a program flow automatically, after which the code is forgotten. This is accomplished through the use of a context-free grammar with arbitrary lookahead and a hierarchy of defaults.

As a result of these features, Nanoverse projects can be defined at a much higher level than preceding platforms such as NetLogo. As with all high-level languages, these advantages come at the cost of flexibility: there are some things that can be expressed in NetLogo, but which will not be expressable in Nanoverse until someone creates the back-end logic to do so.

Happily, growing the language is easy by design. Nanoverse is implemented in Java, and its back end is decomposed into modules. These modules have a well-defined API to the other modules, so that each piece of the system can be completely agnostic to other details. For example, code that defines how to move up a gradient on a 2-D square lattice is equally effective at performing it on a small-world graph.

Declarative Paradigm

So what does one mean by the declarative paradigm or declarative “programming”? The definition is broad, so we will focus on what this means for nanoverse. To start with, when writing the .nano file, one must not think of it as programming. There isn't much logical flow. You are not trying to define a process in terms of basic functions (in other words, you are not trying to implement an algorithm). A .nano file is basically like a settings file.

To start with writing a .nano file, it may help to think of the .nano file as a set of drop-down menus. There are a list of “things to be specified”, and you select one of many “defined options” for it (for a list, visit If you are working with nanoverse, this will be your main resource). Let's look at this with the help of a self-explanatory example.

geometry:  Geometry{
	shape: Rectangle{   
                width: 64;
		height: 64;
	lattice: Rectangular;

One of the things you need to specify for nanoverse is the geometry in which the code will run. To do this, we will use the GeometryDescriptor (specified by the keyword Geometry). This leads to the first line, geometry: Geometry (where geometry is the property and Geometry is the value).

Now, the value Geometry further has some properties associated with it, the shape and the lattice of the geometry (by lattice in this case we mean spatial arrangement of the discrete spatial units). For example, the shape could be a Rectangle (or a Cuboid or a Hexagon or a Line, but only one of a finite set of values. You must just select one of them). Thus, the second line, shape: Rectangle. And now the Rectangle further has the properties width and height, whose values must be primitive integer data types.

The other property of Geometry is the lattice. This is a bit simpler and it only accepts a value which does not have further properties associated with it. This leads to the last line, and the end of the specification of the geometry property.

Thus, each value in nanoverse is specified in terms of primitive data types, or instances/objects of a particular data type. You don't define an instance, or create a custom instance with the help of existing instances (well, kind of. Lists of different kinds are a good workaround when they are valid values).

Thus, in nanoverse, you describe what you want, rather than how you're going to do it, meaning that the grammar is going to be much more sensitive to what is being described. As with any other settings file, you should not look for overarching principles of what you should always be able to say about every setting. What's allowed depends on what part of the system you're configuring. Just find out what setting you're trying to change, and then change it.

Best of luck!

PS To see how the code snippet above would look as a sequence of drop-down boxes, see

nanoverse_overview.txt · Last modified: 2016/02/08 09:14 by avaneesh