Page 2 of 2

Re: SDL What is that all about

PostPosted: Thu Jun 14, 2018 11:46 pm
by J'Kla
Ehren wrote:
J'Kla wrote:I was really pleased when I saw that someone had posted a response.

Imagine my disapointment.

I'm not going to lie, that stings a little...

In my defense, the point I was trying to make was that you actually weren't THAT far off, I was just trying to "cite a source", so to speak, rather than just assert its meaning. I was not implying that it was terrible that you missed it or anything.

I was kind of disappointed in myself, how little I understood what your post was saying at all for the most part. But then the comment about being prepared to be wrong about what SDL stood for just seemed odd to me, so, yeah...

Cautious response optimism, I guess.

Sorry. I totally accept your defense. The intention was not to sting and I apologize for the imposition of that barb.

I am afraid I can sometimes be a little to focused on the issue at hand.

I have been immersed in a progression that started when we were still using Until Uru.

Problems I have been looking at for years. I do understand that your citation was well meaning, and I was a bit "Lemon and Corkscrew" bitter and twisted.

I hope you accept the apology.

It does look like the exchange has brought other answers out of our virtual woodwork so we can see some good has come of it.

Re: SDL What is that all about

PostPosted: Sat Jun 16, 2018 4:58 am
by Sirius
Yeah, J'Kla's reply was a bit stingy, but I'm sure that was just poor wording and he didn't mean it. Let's just let it slide ;)

Anyway, as promised, here is a complete, unabridged version of what SDLs can do for you.

SDL stands for State Description Language. In other words, it's a language that describes the state of an Age (as in, "in what state did you leave this Age"). That information is stored in an encrypted text file, with the appropriate extension ".sdl". PlasmaShop can open those.
When you explore an Age, information about each interactable object is stored in a variable. For instance, whether a door to a house is opened is stored in a variable "houseDoorIsOpen" which can be either true or false. I'll reuse that door example a lot, but this includes a lot of other mechanisms - think the pillars in Kadish Tolesa, or the elevator level in Teledahn.
Without these variables, the engine wouldn't even know that this door can be opened, or it would forget as soon as you link out.
It's worth noting that when people talk about SDL, they are referring to ONE of those two things:
- the variable that stores the object's state (as in "SDL variable")
- the file that lists all these variables (as in "SDL file")
Note that the SDL file only describes what objects can be stored; it doesn't store whether that house door is opened or closed. Storing those variables is done in the "Vault", which is a particular region of the avatar's save (or a special save on the server for public Ages).

SDL variables are useful for the following:
- persistence ("saving") of puzzles - if you didn't have it your puzzles would reset when you re-link to the Age.
- still on the topic of persistence: sharing this "save" of the Age with others - if a door is open you can be sure it's open for people who will link after you (otherwise you'd see an open door when he sees a closed one, because he himself hasn't opened it yet).
- real-time synchronization. If you were to open the door, your game would tell the server to "flip" the associated variable (toggle it on or off). The server stores that value, then tells all players in the Age "hey, that variable has changed, folks". Then each game on each PC will react by thinking "that variable has changed, so someone must have opened the door. I'll now display the door opening".

SDL files are useful for the following:
- listing which SDL variables exist (obviously) - you can't use a variable if it hasn't been declared in the SDL
- what is stored in these SDL variables. A simple "on/off" state ? A number ? A name ? etc
- the default value of those variables. When you link to the Age for the first time, this will tell the game what doors to open or close. This is only used once, as once you have messed up with those doors we want them to stay as-is.

So, the obvious question is, how to use SDLs in my Age ?
Well, one thing you should know, is that SDL variables are ONLY accessible to Python scripts, not PRPs.
However the good news is that Cyan already wrote simple Python scripts to handle common interactions - which means you don't have to ! Those scripts are also optimized to ensure you don't spam the server with synchronization messages, which is a Good Thing. You just have to call those Python scripts from within a Korman NodeTree... But we'll get to this topic later ! hehehe...

Yeah, correctly setting up SDLs and binding those NodeTrees to Python scripts can be a bit long to explain, and I haven't tried it yet anyway. So I'll get to it some other time...

It's worth noting that persistent animations (animations that don't reset when you re-link to the Age, and that are synchronized between players) are also stored as SDL variables. However, those SDLs are automatic and you don't need to worry about it.
By default animations aren't synchronized because synchronized anims can COMPLETELY detroy server performance if used wrong. Usually you DON'T need synchronized animations, because Cyan's scripts do a much better job of "locally" triggering the animation using their own synchronization system, without the overhead that true synchronized animations have.

Re: SDL What is that all about

PostPosted: Sat Jun 16, 2018 11:13 pm
by Deledrius
Heh, I wrote up a similar summary a couple of weeks ago to answer a question Tweek asked in IRC, and you hit most of the same points I did in much the same way. :) I intend to add some of this information to the wiki's page for SDL, as it's an important concept and not enough has been written about it.

Sirius wrote:Note that the SDL file only describes what objects can be stored; it doesn't store whether that house door is opened or closed. Storing those variables is done in the "Vault", which is a particular region of the avatar's save (or a special save on the server for public Ages).

It might be useful to note that the SDL file's purpose is largely to help the game create the internal database (stored in a few different ways, but that's not important) and maintain it as the game evolves. This is why the server needs the file, and why you absolutely must create new entries when you edit values or when you add/remove SDL variables. As a very quick overview, the server (and the offline game) stores an Age's SDL variables along with the version number of the SDL description they were saved under (always the newest available). If you add a new variable because you've added some new feature to your age (let's say a dummy door you left as a placeholder can now be opened and a new area explored), when a player who has been to your Age before the update visits your Age again after the update, their saved states won't have the same variables stored, but since the SDL file contains the older version the game/server can still know how to load that information and merge it with the new description. The same is true if you remove a feature, or change how some aspect of your Age is implemented. It's also why changing the default values in the SDL file won't affect the Ages a player has already visited; that information is only used when creating a new entry.

It's all a bit weird and twitchy for our purposes and especially for Fan Ages, but under a single central game controlled by a single entity (as the game was originally designed to be run) it's not that unreasonable.

Re: SDL What is that all about

PostPosted: Sun Jun 17, 2018 4:19 am
by J'Kla
SDL files are beginning to make sense at least I now know why there are so many versions in any given SDL.

I have also discovered the reason for one of my original issues where my Relto door did a double take on opening and why the door in the hood (the one that leads to where you access Gareseen that first time to get your KI) had no clickable to open the door.

That was all because I started the game without my LAN dirtsand shard having any SDL files at all and if I then realized an added them it did not fix anything.

Fortunately rebuilding my LAN dirtsand has become no big deal and OK it is a formatted drive job but at least I know what it is. I am going to add a BIG warning in the listing because this is a major point of failure.

I have tried making an SDL for my Abmortoxas age in experimenting I have discovered you get one cut at making this the first time any errors / experiments you just do not get away with deleting the SDL and making a new one it would be realy useful to have a tool where you could go to the dirtsand console and just make the vault forget about anything to do with any given age.

Consider the Vault Wipe command select clear_vault();

Maybe something like select purge_age(Abmortoxas); where what you wanted cleaned out was the age inside the brackets.

I don't know if this is possible feasible or even anywhere in the realms of possibility I just know if I don't propose it I am not going to get an answer. ;)

The Vault Wipe or even the drastic option of a shard rebuild has to be a massive sledgehammer to crack the nut of SDL experimentation with the SDL file for just one age.

Once I figure out how to construct an SDL I will be writing something concise aimed at us Noob's I suppose until that time I will just continue to beat my head against this wall.

Re: SDL What is that all about

PostPosted: Mon Jun 18, 2018 3:05 am
by J'Kla
Looking at the Wiki entry for SDL there are 15 types of SDL data types available (Listed bellow) and I have to consider some of these are are no real use in Fan age building it would be useful to know what these are and what is the range of data these SDL variables can hold.

Some I can make an educated guess at for example

BOOL I have to presume is Boolean and can be 0 or 1?

INT I presume is Integer but what is the range of values this can hold?


Rather than just add it here could we get the Wiki entry expanded?

Re: SDL What is that all about

PostPosted: Mon Jun 18, 2018 9:03 am
by Deledrius
J'Kla wrote:Rather than just add it here could we get the Wiki entry expanded?

Sure. :)

Re: SDL What is that all about

PostPosted: Tue Jun 19, 2018 10:39 am
by Chacal
Very few of these data types are actually used.
I suggest you open a few SDLs for Cyan Ages and mimic what Cyan did.

Re: SDL What is that all about

PostPosted: Tue Jun 19, 2018 12:54 pm
by J'Kla
Why should we limit ourselves?

If we know all of the options and ranges we can move beyond the limits that Cyan used.