SSR: Level specification

General comments
Supported file formats
Scene description
Ini description
Scripts description

General comments

All levels must be located inside of the data directory within individual directory. Directory name does not matter as long as it is not starting with "." (dot symbol) Each level should have one ini file (name does not matter, but there should be only one ini file) with description of the level. Level has three parts to it: ships, level objects and path.
Path is used to guide ships and their ammo through the level, while level objects are a mere decoration. Path consists of points (intersections) and edges connecting points. Each point have at least 1 and at most four 4 neighbors. Neighbors are referred as Up, Down, Left and Right neighbors. I think (though I am already not sure :) ) I put a limitation that all neighbor must be in 90 degrees angles (it was faster to make it work, but code itself is designed to be independent of this fact, so if you want to have arbitrary angles it is not hard to fix, I just need to remember where) Also points could be at different heights, but I did not test it.
Each Ship has a body and a bullet (yes only one bullet). Negative Y is considered to be the axis of forward movement and positive Z is the upper side of the ship. The same rules apply for a bullet.
Level objects can be whatever you want them to be and it is up to you to make sure that they do not interfere with the logical movements of the ships on the path.

Supported file formats

3D models:
  • COB or SCN binary files created by trueSpace6.0 by Caligari.
  • ms3d files created by MilkShape 3D by Chumbalum soft. (tested textured models only)

2D images: Only 8 bit BMP files are supported.

Sound files:
Only WAV files are played from a 3D position.
Ogg Vorbis,MP3,FLAC,MOD, S3M, XM, IT can be used for background music or sound effects, which does not require positioning.

Scene description

One may choose between implementing level completely within trueSpace scene or using ini description.
Only POLYHEDRONS are loaded. Grouping is not supported, so if you have complex object you should boolean union it first. Objects must be triangulated. All level objects must be grouped and name of the group should start with "Level" prefix. If there is no such group in the scene, then all polyhedrons with the names started with "Level" are loaded. Ships are grouped with their bullet and group should have name starting with "LoadedShip". Ship object must have name starting with "Ship", while bullet should have name starting with "Bullet". Location of the bullet in relation to the ship will be considered as in loaded state, when fired bullet will not keep its Z offset. Center of the ship (defined by location of the axis) will be placed on the path. The initial position of the ship (ship polyhedron, not ship group) must have the same coordinates as on of the points on the path, otherwise ship will not be positioned.

Note: I did not have enough time to understand how properly determine location and parameters of the objects, so when you model your object, chances are that you do not see it in the game, the reason is that SSR does not load object positions correctly. You should save object as binary 3DS (do not forget to triangulate it first) and then load it in the scene. This would erase transformations made by ts to the object and its location could be properly determined by SSR.

Cameras are ts objects. The view you see within tS and within program are a little bit different. Test it :) You can have as many cameras as you like.
Lights are usual tS objects. Only spot, infinite and local lights are supported. Exponent value for spot lights is not applied correctly.
Shaders are limited to phong and texture shaders and only color component is used.
Path is created by a single closed NURBS curve (only one can be in the scene). I suggest you to switch snapping to the grid and put its resolution to 1 meter, then use Add Polyline to draw your path. Very important thing is to mark each point you come through, even if it is already there. It means that you click at each intersection, even if path is already there. I know it is pain, hope to correct it soon. Also you should finish at the same point, where you started and close the curve.

When creating your level you may look at "ssr.ini" and switch on reporting from all managers (under log section) or just look at "ssr.log", it should give you some information about what when wrong and so on.

Limitations and things that does not work as they should are because of  "not enough time", so feel free to offer your help and fix the thing :)

Ini description

Ini file contains sections (enclosed by []). Each section has key-value pairs separated by sign "=" (equal). Comments must have ";" as the first symbol in the line. There should be single ini file in the level directory with the following sections and keys:
Section
Description
[general] Contains information about level name and number of players allowed in the game.
Note: that this section should be within first 10 lines of the ini file
Key
Type
Description
level_name string
Level name as it will appear for the user
max_players integer
Maximum number of players for this level
crc integer
Not currently used, but must be set to some value
Example:
[general]
level_name=level1
max_players=3
crc=1
[level] Path information and common level settings
Key
Type
Description
texture_path string
Path to the directory under the level directory with textures.
script string Script file for the for the level
level_scene string
If this key is defined level will be loaded from scn file, otherwise the following sections will be used to load level information
bg_color
three floats
Color of the background for the level (default is black): R,G,B
Example:
[level]
texture_path=textures
script=scripts/level.scr
level_scene=level1.scn
bg_color=0.0,0.0,0.0

Following sections are used only if  "level_scene" key is not set for section [level] in ini file:
Section
Description
[path] This section contains description of the path, which all ships will follow, it should contain points location and their neighbor description. All point should be numbered sequentially starting from 0. Values should be separated by comas
Key
Type
Description
pointXXX three floats
Location of the point: x,y,z
pointXXX_nb four integers Indecies of the neighbor points: Up, Right,Down,Left. If point does not have a neighbor value should be set to "-1"
Example:
[path]
point0= 1, 1,0
point1=-1, 1,0
point2=-1,-1,0
point3= 1,-1,0
point0_nb=-1,-1, 3, 1
point1_nb=-1, 0, 2,-1
point2_nb= 1, 3,-1,-1
point3_nb= 0,-1,-1,2
[cameraXXX] Camera description. Ini file must have at least one camera, upper limit is unbound. Cameras must be nubered sequentially starting from 0
Key
Type
Description
name string
Name of the camera (not used by user, yet)
loc three floats Location of the camera: x,y,z
look_at three floats
Location of the point, where camera is directed: x,y,z
up_dir three floats
Direction considered upper side of the view: x,y,z
Example:
[camera0]
name=Camera0
loc=0.237596,10.2729,20.728
look_at=0.237596,9.85025,19.8216
up_dir=-7.43949e-042,-0.906308,0.422618
[lightXXX] Light description. Must be numbered sequentially starting from 0
Key
Type
Description
type integer
Type of the light:
  • 1 - infinite light
  • 2 - local light
  • 4 - spot light
loc three floats Location of the light:x,y,z
exponent float
Value of the exponent  (used by  spot light only)
ambient three floats
ambient component of the light (in range [0,1]): R,G,B
diffuse three floats diffuse component of the light (in range [0,1]): R,G,B
specular three floats specular component of the light (in range [0,1]): R,G,B
Example:
[light0]
type=2
loc=7,0,5
exponent=0
ambient=0.13,0.13,0.13
diffuse=0.13,0.13,0.13
specular=0.13,0.13,0.13
[objXXX] Objects of the level. Must be numbered sequentially starting from 0
Key
Type
Description
file string
Name of the file with 3D data of the object
loc three floats Location of the object: x,y,z
rot three floats
Rotation of the object in degrees: x,y,z
Example:
[obj0]
file=objs/level.cob
loc=0,0,0
rot=0,0,0
[shipXXX] Ship description. Level should have at least two ships (or how are you going to play?). Must be numbered sequentially starting from 0
Key
Type
Description
ship_file string
Name of the file with 3D data of  the ship in supported format
bullet_file string Name of the file with 3D data of  the bullet in supported format
ship_loc three floats
Starting location of  the ship: x,y,z
This value will be added to the location of the object loaded from the file
bullet_offset three floats
Bullet offset from the center of the ship: x,y,z
This value will be added to the location of the object loaded from the file
ship_rot three floats
Starting rotation of the ship: x,y,z
When ship is loaded its rotation around Z determines the starting direction of the ship, after that, initial rotation on all axes is ignored
bullet_rot three floats Starting rotation of the bullet: x,y,z
script string
Name of the script file for the ship
Example:
[ship0]
ship_file=objs/ship1.cob
bullet_file=objs/bul1.cob
ship_loc=9,5,0
bullet_offset=0,-0.4,0
bullet_rot=0,0,0
ship_rot=0,0,0
script=scripts/ship1.scr

Script description

Scripts are text files, containing blocks. Block has type and name separated by "=" sign (equal sign). Block should have
0 or more statements. Statement has name and the value separated by "=" sign (equal sign) and ended by the ";" (semicolon). Names could contain only alpha-numeric characters and underscore sign.
Example:
type_of_the_block=name_of_the_block
{
    statement_name_one=value_of_statement_one;
    statement_name_two=value_of_statement_two;
}

There are three types of blocks: action,sound and pts.
  • action blocks have predefined names, which are used by the program
  • sound blocks have user defined names and are used within action blocks to play or stop sounds. They have only one statement: file=file_path, where file_path is a relative path to the level directory.
  • pts blocks have user defined names and are used withing action blocks to start or stop particle systems
There are two kind of scripts: Level script and Ship script.
Level script supports actions:  start and finished. Statements from start are executed when level is loaded (could be welcome greeting or background music). Statements from finished are executed when game is finished (someone won the game)

Names of actions and sounds for ship scripts are local to the script, which means that two ships could have the same names (and actually it could be the same sound file, which does not matter anyway). But names of level script are global and have preference over local scripts (do not ask why). This gives you an ability to affect level objects from the ship scripts. Sounds and particle systems from the ship script are attached to the ship object or bullet object.

Ship script supports actions:
  • fire - bullet is fired
  • loaded - bullet is returned
  • moving - ship is moving
  • hit - ship is hit
  • accelerate - ship is accelerating
  • slowdown - ship is slowing down
  • collision - ship collided with another ship
  • bul_moving - bullet is moving
action blocks support following statement names:
  • PlaySound - plays sound
  • StopSound - stops sound
  • LoopSound - players sound in a loop
  • StartPts - start particle system
  • StopPts - stop particle system
sound blocks support following statement names:
  • file - filename of the sound
pts blocks support following statement names:
  • surf_loc_rot - location and rotation of the surface (6 floats)
  • type - type of the particle system (moving, marking, follower or circular)
  • surf_type - type of the emitting surface (0 - volumetric, 1 - circular)
  • regenerate - 0 if particles should not be regenerated as they dye off
  • particles - number of particles
  • volume_surf - volume of the surface (for volumetric type of the surface)
  • circ_rad_incs - radius of the circle and numbers of angles in the cirlce (for circular type of the surface)
  • texture - texture file name used by the particle system
Following statements have format : A,B,C, where a and b are the range within which parameter
is changed and C is true or false flag. If C is true (1) then this value is randomly chosen from the range [A,B) for a new born particle. If C is false (0) then a new born particle has value A and it is gradually changing to value B during the time denoted by live parameter.
  • size - size of the particle
  • gen_rate - generation rate
  • red - red component
  • green - green component
  • blue - blue component
  • alpha - alpha component
  • x_vel - velocity in X direction
  • y_vel - velocity in Y direction
  • z_vel - velocity in Z direction
  • x_grv - gravitation in X direction
  • y_grv - gravitation in X direction
  • z_grv - gravitation in X direction
  • live - live of the particle
Examples of scripts could be found in level1 directory. I created an utility program ptstuner.exe to simplify finding correct setting for your particle system.This program is not completely finished and is not documented, that is why it is not being included, but e-mail me, if you want give it a try.

Types of pts:
  • moving - generation surface is attached to the object, new particle will have velocity modyfied by the rotation and velocity of the parent object
  • marking - velocity of the object will not effect velocity of the particles
  • follower - particle position always will be generated by the surface and added to the current location, which basicly stics particles to the parent object
  • circular - new particles has velocities directed out of the center of the generation
Quick Links:

 News
 Description
 Screen Shots
 Downloads
 Custom Levels
 Source Code
 Help/FAQ
 Want to help?
 Credits
 Disclaimer


Tech docs:

 Documentation


Team:

sjcomp logo
sjcomp

Future
Developments


Useful links:

sjgui logo

opengl logo

openal logo

Audiere

boost logo

nehe logo

Caligari

Last modified:


rax.ru:shown(hits in 24h,visitors in 24h and today)