S-Script : Presentation


SScript is an object oriented scripting language, with weak typing. it's written in C++ and use bytecode pre-compilation for speeder execution and cheaper memory costs.

Its syntax is somewhat inspired from those found in Java or ADA. It has support for virtual function, polymorphism, interfaces, exceptions...
As Java does, it also provides a garbage collector...

It aims at being easily integrated into other projects : it can access C++ classes as bultin objects, call any C function, ...

SScript also provides a virtual machine, which can be entirely or partially saved and restored from stream. This allow simple suspend and restart for programs. ( like game saving/reloading... )

With SScript, you can create in the same Unix processus a large number of "pseudo-thread", and then control their execution.
Each thread will cost no more than 2Ko of memory.

The main goal of this project is to provide a way for Real Time Strategy games to separate the AI and game logic from the interface. Rather than having to hard-code the bahaviour of all units in the game engine, you can write sscript functions which will describe the logical for each unit.
For example, suppose you want to write a generic attack code :
function attack(){
	var enemy,exception;

	while(1){
		// Find an enemy in sight...
		enemy=findClosestEnemy(myposition,mysight);

		// No enemy in sight...
		if (!enemy) {
			// Wait a little...
			stand(10);
			continue;
		}

		try{
			// move to this enemy...
			moveTo(enemy);
			// fire !
			fireOn(enemy);
		}catch exception// handle some exceptions
		switch {
		exception.isa(UnitDeadException)
			{ 	// Unit died, go on with another unit
				continue;
			}
		else{ 	// Some unexpected exception, reraise...
				raise(exception);
			}
		}
	}
}

Obviously, any feed back or contribution are welcome...