SDL

Revision as of 07:10, 8 July 2015 by Diafero (Talk | contribs) (Add some docs on SDL)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

SDL ("State Description Language") is the system that Uru uses to store data about an age in a persistent state. If you leave a door open, the door will still be open when you come back to the age later, because this is stored using SDL. The same happens if you have a kickable object in an age, and the game will remember where you left the object. When you play online, on a Shard, SDL is used to synchronize the state of the age between everybody who's there.

Roughly speaking, an SDL file looks as follows:

STATEDESC Ahnonay
{
	VERSION 1
	VAR BYTE    ahnyCurrentSphere[1]   DEFAULT=1 
}

STATEDESC Ahnonay
{
	VERSION 2
	VAR BYTE	ahnyCurrentSphere[1]   DEFAULT=0 
	VAR BYTE	ahnyCurrentSaveCloth[2] DEFAULT=0 
}

This is one ore more STATEDESC blocks, each containing of a version number and a bunch of variables.

Variables in STATEDESC blocks

Every variable has a type. Possible types are: INT, FLOAT, BOOL, STRING32, PLKEY, CREATABLE, TIME, BYTE, SDL STRUCT, SHORT, AGETIMEOFDAY, VECTOR3, POINT3, QUATERNION, RGB8. Typically, when you use a Python script in your age that needs an SDL variable, the documentation will tell you what the type should be.

Variables also have a default value, which is the value the variable is set to initially.

Multiple STATEDESC blocks, and versions

The SDL STATEDESC blocks tell Uru how to store and load the state of an age. If you now send your age to someone for testing, or you release your age, then those people will have the age's state stored according to the SDL file. If you later change the SDL file, there is a big problem: The old state stored on other computers is still using the old SDL! But once you replace the SDL, Uru does not know anymore how to read the old state. It will thus either read total garbage, or notice that something is wrong and be mad at you. (For example, Alcugs Shards will shut down the age immediately.)

It is this important that you never change anything in a STATEDESC block that you released!

Instead, if you need to make a change, you copy the latest block, then you increase the version number. Now you can make all the changes you want, and Uru will still know how to deal with the old state that's out there. Even better, once you ship an updated version of the age, Uru will automatically upgrade the old state to the new one, since it now knows both of their structure.