0 Favourites

S Plugin...Reliable???

This forum is currently in read-only mode.
  • Having almost finalised the level format for my side-project, I'm going to be looking to save the level data in a binary format, either encrypted or normal, and I think I remember someone mentioning that the S Plugin is useful in this regard.

    I don't have the S Plugin, as I haven't needed it up to now, so I was surprised to see that it wasn't in the list of completed addons.

    Which begs the questions;

    a) Will the S Plugin do what I need, saving a mixture of numerical and text data to a binary file, and allow me to load it back?

    b) Is the S Plugin finished and stable, and can it be relied on in a game?

    Krush.

  • a) Will the S Plugin do what I need, saving a mixture of numerical and text data to a binary file, and allow me to load it back?

    Yes, the S plugin is the single best choice for the job. I'm mostly using it for the purpose of saving/loading and generally for level editors, which it can simplify enormously. Also it can actually save objects, not only values and strings.

    b) Is the S Plugin finished and stable, and can it be relied on in a game?

    It's not finished, but in an absolutely useable state, basically like C0.x itself.

    You may experience many crashes while trying to get the hang of S. Simply because in case you're trying to manipulate an array that isn't created yet, or misspell the array address, S will simply crash the runtime in most cases.

    But in fact I do rely on it in different projects and it works like a charm.

    If you carefully look through all the examples and explanations lucid gives in the plugin thread, you should be able to use S in no time. This is a particularly useful post for example:

    http://www.scirra.com/forum/viewtopic.php?f=2&t=4791&start=40#p38861

  • Once again, I owe you Pixel.

    Thanks.

    It's good to know that I should persevere if I get crashes with it, as it could be errors in my code.

    Without that knowledge, I would probably blame the plugin, and stop using it.

    My level editor has 5 layers, different sprite sheets of 128 sprites for each layer, as well as level name, author name, and other special instructions specific to the level, so cramming all that into one object/file per level sounds just what I'm looking for.

    I owe you another pint.

    Krush.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • thanks for the endorsement pixel. for a while there, no one was using 's' at all, and I thought it was just too weird to be learnable, and I just knew how to do it, because I had made it.

    krush, I have almost no plugins I can confidently claim this for, except 's'. it is very stable, I use it in almost every project I make for the the advanced picking features.

    It is easy to make it crash, but it's almost always an error like pixel said, where you misspell the name of one of your arrays, or otherwise mess up an 's' command. I warn you though, it's got a learning curve. It changes what's possible to do in construct, the same abilities you have with the c++ sdk as far as object manipulation, so in order to make that work within the confines of a program that wasn't made to work that way, it has to be a little weird. But I've used it in large caps where it used 's' stuff 1000's of times per tick, with zero stability issues.

    one of the few things I still have the source code to, also.

    one last thing, there is a little known feature that can help you along your way is the debugging features. in start of layout set the debugging output file, and for many crashes it will popup a text file telling you what you did wrong.

  • lucid, I was always taken by 's', using it in a very complex way (and never had issues other than my own mistakes) and encouraged people to at least try to use it. And I always say: "If it crashes it is your own fault." I never experienced any crash that I couldn't solve by carefully looking at what I've done and correct it. 's' is reliable.

    It is just a matter of personal preferences, if you use 's' or python. The latter being a lot more beginner friendly, while 's' doesn't force you to embed and ship python with your game.

    Just to let you and anybody else know that it is one of the most helpful plugins out there (yes, I think it is even more helpful than the already fantastic MagiCam)

  • Yeah, its reliable, and a ton of useful stuff.

    ...Actually too much in my opinion. Hell you could have made five or six plugs out of it.

    Hope you keep that in mind if you decide to start selling plugs Lucid. :p

  • Thanks Lucid.

    I've just had a quick look at the tute, and I can see that it's going to be perfect for what I want, and shouldn't be too difficult to use (although I will be making regular saves and backups until I get it working 100% )

    I wouldn't mind a link to the very latest version though.

    I'd hate to download an outdated version that gives me problems.

    Krush.

  • Well, I've had a play around with various tests of saving data, both unencrypted and encrypted, and it looks like it will fit the bill nicely.

    I'm now looking at your example of a level editor, before I start adapting my current editor for use with S, but I'm wondering if I am indeed using an older version of S, as I feared in the above post, or whether I'm missing something.

    <img src="http://dl.getdropbox.com/u/1013446/s/ondrag2.png">

    It's the .tt("blue") part of the create object that I can't fathom.

    I've tried writing it as an expression, but it won't accept it.

    If I have a criticism of S, it's that the description in the editor doesn't match the output text, so when trying to follow a guide like your level editor, it's hard to see which command you're supposed to use.

    Anyway, am I using an old version of S, or is there a simple answer to my problem?

    Cheers for any help.

    Krush.

    Edit: Ok, looking at your example cap, I can see that it's S.tt("blue"), which of course makes sense, but it wasn't that clear in the editor with the S icon in-between the S and the .tt.

    Kudos on the plugin though.

    The deeper I dig, the more uses I can see for this.

    Why didn't I look at this ages ago? lol

  • here's the latest version:

    http://dl.dropbox.com/u/1013446/Plugins.rar

    I know it's annoying but I think some of the older tutorial cap files don't work with the latest version, that's why the old link is still on page one. so you kinda upgrade as you progress through tuts... I had planned to redo them to work with the latest version, but my fulltime job is a hellish oppressive negative force in my life that functions as a sort of time vortex, funneling away all my time, along with most of my freedom, and parts of my soul.

    not sure if you were asking what it mean as well, but here goes

    tt stands for true type

    meaning you have a family called "blue"

    that has several objecttypes as members of the family

    you can do stuff like add objecttype to objecttype array s.tt("blue")

    and instead of adding the type "blue" to the array, it will add the actual type of the object currently selected as blue

    it can come in handy in other situations as well. like

    on collision with "blue"

    ---------------do this

    ---------------do that

    ---------------system compare s.tt("blue") equals "deathsprite"

    ------------------------------------------begin fadeout

    .....or whatever

    oh yeah, you can also use it in non 's' stuff where you can normally pick an object type

    like say, you want anything that's a member of "blue" to clone itself when clicked

    on click on object "blue"

    ---system - create object

    and instead of using the dropdown list, you right click on the list to choose an object, right click and click 'use expression'

    then there you can type s.tt("blue"), and now that object type will be what's created

    pretty much anytime you'd want to know the real type of a picked family, you can use it

  • Well, I'm still enjoying playing with this, and have managed to get a decent test level editor working, but that was just a way of getting to know the S plugin.

    Now I'm ready to start on the level editor for the actual game, I want to approach it a different way.

    What I want to do is have Super called "LevelPack" (for instance), and in that Super have many "levels", each of which will comprise of:

    2D array1 (32x20) - numerical array

    2D array2 (32x20) - numerical array

    2D array3 (32x20) - numerical array

    2D array4 (32x20) - numerical array

    2D array5 (32x20) - numerical array

    Level Name - String

    etc

    In other words, I want to use S like a standard 2d array for the level data, on several layers, along with things like Strings for the title of that level, etc, and have each set of this data in it's own "level" Super, and all the "levels" contained in one "LevelPack" Super, so it can be packed up and encrypted, and when loaded into the game, I can access each set of level data, and read it in a way to build each level when needed.

    I can't see any simple way to use S for 2D arrays, or any tutorials on this.

    Maybe I'm over-thinking it, and it's right in front of me.

    Any help appreciated.

    Cheers,

    Krush.

  • Everything in 's' is an array per definition. So there are two ways:

    1) Just use a 1-dimensional number array and access it with math.

      's' is 0-based. If your map is 1-based, then you get the right field of the array by calculating: (mapY - 1) * mapWidth + (mapX - 1) map size: 32x20 map position: 5, 4 resulting position: (4-1)*32 + (5-1) = 100

    2) Make a super which holds a number array (create it using template)

      The super is an array and the number array also. Let's say the super is called 'X' and the number array 'Y'. Then you could (0-based) access it as if it were a 2d array: {"X", 4, "Y", 3}
  • 2) Make a super which holds a number array (create it using template)

    The super is an array and the number array also. Let's say the super is called 'X' and the number array 'Y'. Then you could (0-based) access it as if it were a 2d array:

    {"X", 4, "Y", 3}

    This seems like a rather odd way to use S, to me at least. I'd propose a level hierarchy similar to the following:

    Levelpack (Super)
    |
    Level (Super)
    |	     |                    |                |
    |       Title (String)       Xsize (Number)   Ysize (Number)
    |
    Tiles (Super)
    |		         |		        |
    Xpos (Number)	Ypos (Number)	Frame (Number)[/code:1acwz8dw]
    
    Setting up templates for your supers. So you can just add a Super for each Tile/Enemy/whatever and it has all the subarrays needed. And yeah, this uses many arrays with only one value actually stored, so it's more like a single variable.
    
    {"Levelpack","Level",2,"Tiles",14,"Frame"} would be the frame of the 14th tile stored in level 2 for example, just to show a bit with an actual S address. To create your level you would of course use the loop conditions of S and spawn objects accordingly.
    
    I do know that S can save objects directly with a spatial info array, but I do prefer to do it with templates holding all the necessary info in any case.
    
    Seems to be like experiences and methods using S can end up being quite different, consider this only my 2 cents.
  • This seems like a rather odd way to use S, to me at least.

    It is not the way I use 's'. Just have a look at the music tool I started some time ago.

    It was just a practical approach of recreating a non-object-oriented 2D array with the object oriented 's' plugin.

  • In other words, I want to use S like a standard 2d array for the level data,

    edit: just realized tulamide's #2 method was what I was going to say was the closest thing to a 2d array, but

    There's probably an easier way to do what you're thinking, what're you going to use the 2d array for?

  • Sorry for the late response, but I've been stupidly busy.

    Thanks for the input guys.

    Helpful as ever.

    I've made 2 versions of the editor, one using the spatial info, and another using an array to keep all the level info I need, and I'm writing the level loading routines to use either, so I can decide which I'm happier with.

    I just need some spare time at the moment to get back into it.

    Krush.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)