'S' update as of 4/12/11

This forum is currently in read-only mode.
From the Asset Store
Pack of illustrator graphic styles. Make your own logos, game titles, or anything you want.
  • Keep up this pace, lucid, fucking awesome!

  • coming soon:

    the next tutorial will explain how to make a drag and drop level editor, that saves and loads encrypted level files, in just 4 events:

    <img src="http://dl.getdropbox.com/u/1013446/s/objectarray3cap/leveleditor2.PNG">

    I was think of a way to using you plugin for that purpose.

    I guess you beat me to the punch.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ok, here it is folks.

    the long awaited SUPER tutorial

    but first, let's go over some of the changes that have been implemented since our last visit.

    first of all, the arrangement of the actions in the table has been changed. This is to consolidate it, hopefully place more important items closer to the top, but more importantly to keep you from having to scroll down as much. The side effect of this is that caps made with old versions of the plugin no longer work. Until I have time to remake the other tutorials I will have the new version as a separate download, so people can still do those tutorials. Also I've tried to hunt down all the "" instead of {""} default values in the fields that ask for an array. please let me know if you find any I missed.

    Next is with object deletion. Now when you delete an object from an array, it will automatically delete all other instances of that object in the same array, and you have the option of replacing those elements with references to the default (with "as type" options), or deleting those elements from the array. this is the fix to the crashable problems before related to destroying an object and still having other copies of that object in the array.

    Also, you can now delete an array. The action was there before, but didn't do anything, as it had not been implemented yet.

    I don't have time to dig through all the old tutorials right now, so I want to briefly go over a few things I may have missed, mostly with object and objecttype arrays.

    first, with s you can create or destroy objects by name(remember o.({"address"}) for objects, and ot.({"address"} for objecttype expressions return the name of the type). These are similar to the regular Create and Destroy functions, except now you can destroy by name, and when you create, you have full control over whether the object is picked and how it is picked.

    There is a Pick Object condition, and action. Choose whichever works in the situation. All it does is pick whichever object you choose, and gives you options for how it is picked.

    There is a "pick all of objecttype" action. Which I hope to add to later. For now, it picks everything of that type, which is basically like resetting the picking for that object.

    there is a Set Position/Dimension/Angle action that let's you change the x,y,z,width,height,and angle of an object with a single action. you can choose to keep anything the same by simply leaving the default "same" string there instead of giving a numerical value.

    This action serves several purposes:

    first, the object doesn't have to be selected at all. This works with the array location of the object. You can move around many objects in complex ways without regard to picking. Having this all in one action reduces clutter on your event sheet, and it is also much faster in large doses, since the event system only has one call's worth of overhead. This can be especially useful in arrays of objects, and loops.

    There is an action to convert an objecttype array to an objectarray, by making a new instance of every objecttype in the array, and putting it into an object array, and there is an opposite command, which takes an object array's types and puts them into an objecttype array.

    and lastly, there is a "break loop" action which allows you to break out of a loop. after calling the action the remainder of the actions will still be called, but the loop will exit after the current iteration.

    We are at the point in the tutorials that if you find any actions, conditions, or expressions, I haven't explained after this tutorial, please ask..

    now, on to the SUPER TUT!!!!(pronounced toot, not tutt)

    ok, first here's the download of the new version:

    click here to download new version

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

    First we will go over the basic stuff you need to know about supers.

    Once again, this tutorial assumes you have read and understand the previous tutorials.

    First off, let's remember what a super is.

    a string is a container to hold text, a number is a container to hold a numerical float value, an object is a container to hold a reference to an object, and an object type holds a reference to an object type. Supers are containers that can hold any amount of arrays of any of those, and any amount of arrays of other supers.

    As an example, there is one master super. And everything we've created in any of these tutorials has been created in that master super ( {""} ). you could have created a superarray with one super in it called "mysuper". And everytime you placed a new array instead of saying to place it in {""}, you could have placed it in {"mysuper"} ( or {"mysuper,0"} ), and the tutorials would have run the same. The purpose of the super, however, is to serve as customizable containers (like c++ structs), so you can organize your data in meaningful ways.

    So let's get started with some real stuff.

    first off, we need to look at how we add superarrays:

    <img src="http://dl.getdropbox.com/u/1013446/s/objectarray3cap/addsuper.PNG">

    everything the same as before, use the same action. ignore the object related options. But two parts are significant in the super. First one is Default. I have "mytemplate" entered here. you can also leave it as the default 0, which makes an empty super. We'll come back to how the defaults work for supers. but for now, let's move on to the option that is unique to supers.

    Add one default super

    This does exactly what it says. After creating the super array, it adds one super. The reason this option is there, is because as you are creating your entire data structure. There's a good chance you'll want to create a single named super, and go right into adding items to it. Often times you will just use the super on it's own, and not use the array as an array at all. Since you need to have a super there to add things into it. it's convenient not to have to add an element to the array as a separate step before you do this.

    and that's pretty much all you need to know for the basics. After you create a super, when you want to make a new object array in it, instead of putting {""} for where to put it, you put in the name of your super array.

    so you create a superarray "mysuper"

    you want to add a number array "nums"

    after creating the superarray "mysuper", and adding one default

    <img src="http://dl.getdropbox.com/u/1013446/s/objectarray3cap/addingtosuper.PNG">

    very simple.

    if you want to retrieve the value at index 2, of this number array you would do:

    s.n({"mysuper","nums",2}

    if you added another super to the same super array, and you added a "nums" in it, and you wanted the value at index 2, you would do:

    s.n({"mysuper",1,"nums",2})

    if you added another super to "mysuper", and called it "wow", you could then add to that super with the address

    {"mysuper","wow"}

    and you could access a "nums" array in that as well

    s.n({"mysuper","wow","nums"})

    you can embed as many supers within super as you want. This can be used to create characters that have names, and a sprite, and an array of objecttypes in their inventory, and hitpoints, a list of friends, etc. The possibilities are endless. Any type of logical structure that works in your head, you can now arrange your data in construct that way. That's the purpose of the super.

    let's have a quick reminder about pointers now

    there is an action "set pointer"

    <img src="http://dl.getdropbox.com/u/1013446/s/objectarray3cap/addpointer.PNG">

    this would create a pointer to that address (for anyone curious, no, it's not an actual c++ pointer underneath)

    the pointer is just a shortcut.

    after doing that, when you wanted to access that pointed location:

    {"mysuper","wow",2,"this could get complicated","are you serious?",2,"oh man, this is crazy"}

    you could just type

    {"p","pointy"}

    "p" is a special character used for accessing pointers.

    pointers are not aware of their type, you can point to a certain object:

    {"mysuper",1,"nums",3}

    and that would point to the 4th number

    and use this anywhere you'd use a number address

    or you can point to an array:

    {"mysuper",1,"nums"}

    where the pointer could point to either the first number in nums, or the array itself

    and if you point to a super

    you can continue off of a pointer address, for instance...back to this:

    <img src="http://dl.getdropbox.com/u/1013446/s/objectarray3cap/addpointer.PNG">

    let's say "oh man, this is crazy" is a super

    and inside "oh man, this is crazy", there is a number array called "nums"

    it would be valid to say Add a Number to

    {"p","pointy","nums"}

    you can make pointers to pointers

    so this is valid:

    <img src="http://dl.getdropbox.com/u/1013446/s/objectarray3cap/pointertopointer.PNG">

    they are infinitely recursive, so you can have pointers to pointers to pointers, ad infinitum

    back to basic looping one more time here

    remember that to refer to the array that is being looped

    you can use {"l","loopname"}

    with supers, if you are looping through {"mysuper","wow",2,"this could get complicated","are you serious?",2,"oh man, this is crazy"}, and "oh man, this is crazy" contains a number array called "nums"

    you can refer to nums similar to the pointers {"l","loopname","nums"}

    in this way you can do a loop on a superarray, and then within each super, loop through it's arrays

    also you can use a pointer as your looping address, and have a pointer point to loop {"l","loopname"} address, and a loop address be a pointer, once again these can be used within oneanother infininitely.

    a few other quick notes before we move on to the real meat of the tutorial,

    when you "set pointer", if there is no pointer with that name, it is created, if there is, it is overwritten. you can reassign pointers as you see fit, and use them as variables that can point to any type of data. I will give some advanced examples, but they can safely be used as simple shortcuts, when you don't want to type the same long name out over and over.

    for example, you could make a pointer "temp", that you use any time you want to use a shortcut, and just reassign and reuse it to point to arrays, or numbers, or other pointers, whenever you need a new shortcut. or you could do something more complex, and have the pointer actually change to different supers you want to remember for different purposes. Also, keep in mind that this array notation {"this","that",0,"and the other"}

    is just strings and numbers, just as you can use an expression for the numbers

    you can use an expression for the strings

    you could have an array of strings called "mypointers"

    and then do this:

    {"p",s.s({"mypointers",3})}

    another advanced concept for those brave souls, is to keep in mind, if needed you could name arrays using string expressions. These are not private variables, you are free to use any tricks you want with strings to manipulate them.

    OK, now for the realness. After this tutorial, it should become obvious that 's' completely redefines the boundaries of what is possible with construct. And all future tutorials will either be to introduce new functions, or to give other ideas of applications. Please feel free to request "could you make a such and such editor" or a "such and such system", and it may possibly be a future tutorial.

    first here is the cap:

    http://dl.getdropbox.com/u/1013446/s/lvleditortut.cap

    try the exe of the cap, drag some stuff onto the board, choose the character start location, and save it. it will automatically launch the saved filed so you can look at it. then either restart the exe, or move stuff around, and add stuff, and then hit load, and everything is set back to your save.

    now,

    let's look at the layout editor:

    <img src="http://dl.getdropbox.com/u/1013446/s/objectarray3cap/Capture2.gif">

    the items at the upperleft are all of family blue.

    the load, and save buttons, the guy, and the line are not

    neither is the dummy sprite that is off screen.

    in start of layout:

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

    we make an object array called "menu"

    then we make a super called "level"

    then we add an object array called "objs" inside "level"

    first we add the player sprite to {"level","objs"} (which will store our level)

    after that we loop through all the blue objects, and add each one to "menu" (which will store the objects you can add to your level)

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

    On drag start - blue (the one's on the top left of the menu)

    for each object in "menu", and we names this "menudrag", and do not alter picking

    if {"menu",.li("menudrag")} (the current object in the "menudrag" loop)

    remember, we just added each object at the beginning to "menu"

    if {"menu",.li("menudrag")} is picked as "blue"

    (basically, if anything in "menu" is the one being dragged)

    if you remember the exe, each time you drag an item from the menu,

    it seems like you're getting a new copy fullsize, and the original is staying there.

    here's how this part works, I'll paste it again, for easy reading:

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

    we create a new object of type .tt("blue") that is the true type of the picked "blue", and we create this new object at the same location as the picked "blue"

    now, we don't want all type of extra steps to make dragging take over a new object

    so we put the new object which is now picked as whatever the true type of "blue" is (.tt("blue"))in "menu" at .li("menudrag"), so were replacing the "menu" item we are dragging with the new one we just created. Now the new one replaces the one in the array of the one we just started dragging.

    and the one we just started dragging is "blue", so we add that to {"level","objs"}

    and make it the original large size.

    ok, our level editor is complete except for saving and loading:

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/save.PNG">

    when you click on the save sprite:

    the first action is:

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/createnewobjectpossuper.PNG">

    this is a shortcut to save you time for a common task

    it creates a super for you that contains whatever object spacial info you choose, for an entire array of objects

    first you choose an object array, in this case {"level","objs"}, where we've been saving the objects we've added to the level.

    then you choose where to create the new super, you can choose an actual super address, or "same"

    so it creates the super in the same place as the object array you chose, in this case {"level"}

    so in this example we choose x,y, length and height

    you choose a name for the new super, in this case it's "pos"

    and you choose a default value for the super, in case you were planning to use it for other things

    you don't need to know this to complete the tutorial, but it may be useful later:

    the contents of the super are number arrays with the same number of elements as the object array you choose

    the names are "x","y","z","w"(for width),"h",(for height)", and "a"(for angle)

    it only creates the arrays for the values you chose to include

    when you choose the object array, before you type anything in, the default is "leave empty", this will create the super, and the number arrays, but not input any of the values into the array

    since we chose an object array, "x" will be filled with the x values of the objects at the same position in the array, "y" with the y values, etc.

    here it is again:

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/save.PNG">

    the next action is Save Super:

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/savesuper.PNG">

    you choose a filename (doesn't have to be txt, should be something else actually)

    the address of the super you wish to save

    the type you would like to save MUST BE superarray. I will either add the other options, or remove the option. And furthermore, it is only saving one super...not superarray...for now, just think of this action as Save Super

    This isn't limiting though, since you can add any array to a super, and if you choose {""} it will save everything.

    The last option is Encrypted

    the encryption is secure enough to trust your game info with. Someone who can get around the copy protection of a game could figure it out. But not your average joe. You can safely save scoretables, character info, dialogue, levels...anything. We choose unencrypted in this case, just for the hell of it.

    Before we move on. please understand. This allows you total power to save any type of data. If we wanted to add dialogue strings, or numbers for the starting force of physics objects, or object path info, basically you can make any type of gamesave data, or any type of editor, and not worry about the saving part. you could make a 3d mesh editor, an ai logic editor, an in-game movie editor. Creating editors, which was previously a very involved, technical, and tedious task is now as simple as using the save action, once you put things in your super.

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/fileandelete.PNG">

    I only included the file object for this purpose, to load the file we just saved, so you can look at it. You do not need the file object to load and save. If you are curious, change the save to encrypted so you can see what the encrypted file looks like.

    after this we delete the "pos" superarray, since we don't need it. On a side note, there is an action to Add/Overwrite the these object positions/dimension.orientation supers, so you can store this information and use it for other purposes other than saving it.

    finally:

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/loadsuper.PNG">

    first we clear the object array. there is an option to "destroy all objects"

    so this functions as a simple way to get rid of all the objects on the current level

    next is load super "levelsave.txt"

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/load.PNG">

    filename, we know

    encrypted must be the same as the file was saved or it will not work, and will most likely crash

    Load objects as types

    the options are No, load as new instances, or if it is useful for whatever reason, you can load them as their types in an object type array. when you save an objectarray, you are only saving what objects they are. Information like location, and plugin info is not saved. just what type of object it was. this is why we put the location information in the super to be saved as well.

    choose a super to load it to. ALL INFORMATION IN THIS SUPER WILL BE OVERWRITTEN by the loading action.

    and layer to spawn objects, so if you don't load them as types, what layer are we going going to put them on?

    finally we have the apply spacial info action:

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/apply.PNG">

    choose an object array, choose an array made with one of the Object Position, Dimensions, Angle actions, and viola! All the spacial info is applied to the object array. It is important to store and apply the same exact info, you cant store y, and angle, and then apply only angle. for now, it ignores the names of the arrays, which is slightly faster. if there is a huge need to be able to apply partial info, just save the info to separate supers. At the end you have the option to Delete the Spacial info super after applying. you can delete just the single super, or the entire array. This is just a matter of convenience for just this type of situation, where you just want to use the info once, so you don't need a separate action.

    just for fun, and practicality, here's a level loader:

    <img src="http://dl.getdropbox.com/u/1013446/s/lvltut/loader.PNG">

    http://dl.getdropbox.com/u/1013446/s/lvleditorloadtut.cap

    single event. the objects have their in-game behaviors on.

    take a look, for it to run, you'll have to have already saved a level

    well, enjoy your newfound power

    feel free to ask questions, especially of the "would it be possible to..." variety

    things I forgot earlier:

    Templates, the default values of supers->

    there is a Create New Template action. You name the template in the action and that is it.

    the template is simply a super.

    to get to this super, you use the notation {"t","templatename"}

    you can use any normal action on a template.

    you add all the arrays, you need, it can be as complex as you wish.

    when you create a super, you can use a template as the default.

    it is not advisable to add objects to this array, because they can be destroyed from somewhere else, but remember you have the action to convert an objtype array to an objectarray.

    you can fill your template with empty arrays, or they can have values in them. Whatever is most appropriate, you may have a "character" template that starts with certain items in their inventory, but no entry in the name string array for instance.

    when used as default for superarrays, they are created as copies of the templates in the normal way and under the normal circumstances defaults would be created and used, except when attempting to access outside the range of the superarray, which is simply not supported or accounted for.

    This will be expanded later to give you more options, but as of now when saving, all template are automatically saved. When loading, all current templates are automatically deleted, and replaced with the contents of the save file.

    and lastly, there are new s.ipx({"objectaddress"}), and s.ipy({"objectaddress"}) functions like the s.x({"objectaddress"}) and s.y({"objectaddress"}), except these return the imagepoint x and y values of the object.

    have fun

  • wow, looks really good but sadly it does not work for me.. downloaded the new version of plugin and then i download that and run it. Crashes.. the past tutorials work really good. Just this one crashes and when i look at event sheet Construct crashes?

  • the new version is only downloadable in this last tutorial post for now. the other links in this thread are still to the previous version.

    if thats download s2.rar doesnt work with this latest tutorial, or if it works with the others, somehow, i messed up the upload, and ill fix it when i get home in a few hours.

    but yeah, if you downloaded it anywhere but at the top of this latest tutorial, its a different version.im keeping the old version for now, until i remake the caps to work with the new version

  • ok, I got home

    it definitely works with the new version, I'll update the links

    http://dl.getdropbox.com/u/1013446/s/s2.rar

    (for anyone just getting here, the new tutorial is on the previous page)

    UPDATE:: if you downloaded this earlier than 8:45 pm est, then it's not up to date. I uploaded the wrong version. please redownload

  • .... Now when I have almost finished my level editor / loader which is very complex and so you DO SOMETHING LIKE THIS!?!??!?! Not fun really-.- this is so much simpler and just more cool....

    Oh well I think I have to start again

  • Lol, my first serious cap was map-generator I'm still working on it it and guess that I'm in the dead end (too complex code, too many small bugs). Thanks to you, now I know how to make it better. Right now I don't want to copy your tutorial, but it helped me very much! To understand.

  • Hey again everyone. Thank you everyone who's been testing and giving feedback.

    I have to wake up in 3 hours, so I'll keep this brief.

    The main reason (from what I can gather) that python is "broken" is because it doesn't work with the picking system. Anything you do to an object is done to the first instance of that object type, regardless of what object or objects are picked. So, basically, picking doesn't work. And picking is central to what makes construct awesome.

    I'll go into greater detail tomorrow. But for now, yes, there are new functions in 's' that "fix" python. And it will now be usable with the SOL picking system.

    Stay tuned!

  • Really? I thought David was working on/had completed something to do with picking integration in Python. He's Mr. Python though, so would have to comment himself.

  • Really? I thought David was working on/had completed something to do with picking integration in Python. He's Mr. Python though, so would have to comment himself.

    yup. exciting times.

    i guess if davids done it, there'll be something to hold over until then. there isnt much extra you have to do to the python with s. so it wont be any trouble to start some scripts the 's' way, and then continue the project with the integrated python.

    also, for anyone whos wondering. you dont need to learn 's, to use the python. the python stuff does not depend on any of the other functions

  • Great stuff Lucid! I want to use S to make a simple inventory system for the adventure tutorial and the other game I'm working on. The latest version breaks the older tutorials.

    I don't want you to have to redo everything, but can you give me a quick idea on what syntax is updated or no longer valid in the old tuts? I want to somehow combine the drag n drop feature with S to have an inventory system where you have collected items and then equipped items. I figure S is the perfect thing for this.

  • sci

    basically, you still do everything the same way

    it's just that the Actions Conditions and Expressions are in a different order

    so when you load caps made with the older version they load the wrong actions and conditions

    or it just crashes

    I definitely need to go back and remake those caps

    but all the syntax is still valid

    if you're interested in trying the caps in the meantime

    the original post has the older version of s that still works with the caps for download

    then when you get to the level editor tut, or start working on your own you can download the new version again

    also, feel free to ask specifics on your inventory thing if you run into trouble, and I'll be glad to help

    it'll also help me figure out which things are most confusing and rework or tutorialize those features.

  • It has been nearly twenty days since the last post. What is the status of S plugin? Is it considered finished? Can it be used for some serious stuff now?

  • sorry for the delayed response

    it can be used for serious stuff, if you don't mind it's current feature set

    I realized recently, I will never finish my game if I don't start on it, so sorry if I've left anyone hanging, but as the game develops I will continue to add features to 's'

    and so the timeline is indefinite for now

    I will try to get teh python stuff out in a reasonable amount of time

    along with a tutorial, but I really need to focus on my game before my job alters my position or hours and I have no more time to develop it

    on a happier not,

    here's another future feature of 's':

    fluid dynamics!:

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