Milenia Gound Egnine
The World's Simplest Dynamics Engine
Copyright 2007 by Milan Toth

Milenia Ground Engine is probably the world's simplest dynamics engine available in JAVA/AS3. It doesn't use geometrical primitives for collosion checking, only vectors. It only consists of five classes. Check out the flash demo:

Download:

Features:

System Requirements:

Documentation

1. About the engine

1.1 The engine
1.2 The license

2. Using the engine

2.1 Classes
2.2 Creating a custom world

1. About the engine

1.1 The engine

Milenia Ground Engine is an open source dynamics engine created for my upcoming game. Simplicity was the only keyword during its creation, so i have not implemented any feature which i found confusing or unnecessary. There are only base vectors, movement vectors and spacers.

1.2 The license

Milenia Ground Engine
Copyright (c) 2007 by Milan Toth. All rights reserved.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

2. Using the engine

2.1 Classes

Vector class : represents a base vector in the 2-dimensional coordinate space. Has two properties, x and y, which are the endpoints of the vector.

Point class : represents a mass point in the simulation. Has three properties, its position ( as a base vector ), its movement vector and its rigidity. You can manipulate its movement vector to add interactiviy.

Line class : represents a line in the 2-dimensional coordinate space in slope-intercept form. Has two properties, m ( slope ) and b ( intercept ).

Spacer class : represents a space keeper between two points.

Universe class : represents the simulation space for points and spacers.

2.2 Creating a custom world

Create a custom universe first.

var universe : Universe = new Universe( );

Add gravity as default force:

universe.force.y = 1;

Create surface endpoints:

var rampA : Vector = new Vector( 0 , 100 );
var rampB : Vector = new Vector( 200 , 100 );

Create masspoints:

var pointA : Point = new Point( new Vector( 10 , 20 , .8 );
var pointB : Point = new Point( new Vector( 50 , 20 , .8 );
var pointC : Point = new Point( new Vector( 30 , 40 , .8 );

Create spacers between these points :

var spacerA : Spacer = new Spacer( pointA , pointB );
var spacerB : Spacer = new Spacer( pointB , pointC );
var spacerC : Spacer = new Spacer( pointC , pointA );

Add all these to your universe :

universe.addSurfaces( rampA , rampB );

universe.addPoint( pointA );
universe.addPoint( pointB );
universe.addPoint( pointC );
           
universe.addSpacer( spacerA );
universe.addSpacer( spacerB );
universe.addSpacer( spacerC );

And your universe with one surface vector and a triangle is ready, you only have to call universe.step( ) periodically to step in the simulation.