Okay... Once you get the hang of it, it's not so bad, but my explanation is going to be a bit long.
ametist wrote:I assume I have to start with the.sdl file, setting all states there. But I dont even know where I write that file, or how?
That's almost correct. There is just one small step before this, which is going into your world settings in Blender, and tick the "Age Global SDL" checkbox (this is required to tell the game to load the SDL file for your Age).
As you probably guessed, the SDL file describes the variables used throughout your Age, along with their default value. This is similar to declaring class members in C#. The thing to remember, is that this is the ONLY way to synchronize information between two different clients, and the ONLY thing that will save progress in the Age. (Well, to be honest there are of course other mechanisms, but it's best to stick to SDL.)
Right now Korman doesn't have an SDL editor, so you will have to write it by hand. Since you're familiar with programming languages this shouldn't be too hard.
Creating the SDL file is fairly simple - you can do it in PlasmaShop, and you just save it in Uru's "SDL" folder, with the same file name as your Age.
As for the content, here is an example which you can copy and paste.
- Code: Select all
#==============================================================
# READ: When modifying an SDL record, do *not* modify the
# existing record. You must copy and paste a new version
# below the current one and make your changes there.
#==============================================================
STATEDESC YourAgeFileNameHere # obviously replace with your Age's filename !
{
VERSION 1
VAR BOOL myBooleanVariable[1] DEFAULT=0
VAR BOOL anotherBooleanVariable[1] DEFAULT=1
VAR BYTE aSmallNumber[1] DEFAULT=3
VAR SHORT aBiggerNumber[1] DEFAULT=12000
VAR INT aVeryBigNumber[1] DEFAULT=432489
VAR STRING32 someText[1] DEFAULT="Hello, world !"
}
Now let's recap what each thing does...
- You probably guessed it, the # character marks a comment, like the C# "//" equivalent.
- "STATEDESC YourAgeFileNameHere {}" is similar to "class MyClass {}" in C#.
- The VERSION number indicates the revision number of the "STATEDESC" you just declared. For now, set it to 1, we'll come back to it later.
- "VAR BOOL..." etc is your variable - this should feel familiar. The number in brackets [1] indicates the number of values held by this variable - that's right, every SDL variable is actually an array. Usually you just leave it as 1 for normal variables, arrays are rarely useful (and they can't be resized anyway). DEFAULT is the default value it has when you first link there. If you study Cyan's SDL files, you will notice some extra options like DEFAULTOPTION or DISPLAYOPTION - don't bother with those.
Now, a word of warning, which you may already have heard of previously. SDL descriptions (everything between the curly braces) should NEVER be modified once the file is saved and you linked to your Age. This usually confuses Uru, and may result in corrupting your save of the Age.
So, how do you add variables once you've linked once to your Age ? Simple. Copy and paste the whole "STATEDESC YourAgeFileNameHere {...}" block under the existing one, and increase its version number. Uru will notice the new version number, and will do the appropriate to avoid issues. This is why usually people leave the disclaimer at the top of the file.
(I'm not sure how Uru reacts to altering a variable's description. Might be better to avoid it altogether, and only add new variables...)
If you ever suspect SDLs to be corrupted in your Age, you can simply delete the corresponding ".sav" file somewhere in your "SAV" folder in Uru. This will reset the Age to zero. This can theoretically be done if you don't want to create a new version of the statedesc, but it's not considered best practice.
Now that your SDL is written, you can link to your Age, and use the Offline-KI's /listsdl, /getsdl and /setsdl commands. This won't have any effect for now, but you will be able to observe how any modification to SDLs are stored for later...
[I'll continue this in another post soon]