lucid's Recent Forum Activity

  • Hello fellow scirra members.

    I am preparing for the alpha release of the 'S' plugin.

    The purpose of this thread will be to explain what the S plugin actually is, and to serve as an on-going tutorial. The exact order of the tutorials hasn't been decided, so feel free to weigh in on what needs teaching, and I will try to plan out the next tutorial based on demand. This first tutorial will primarily explain the theory and purpose of S, and only briefly introduce some of the syntax. Future tutorials will give more concrete examples, and eventually walk through the creation of more complex projects. The plugin itself will not be released until the 2nd or 3rd tutorial, as it essentially useless without some background information.

    For starters though, we will look into what the S plugin is, and what it can be used for.

    click here to download the previous version of s (until I update the tutorials, use this for the everything before the level editor tutorial)

    click here to get the newest version, use this for the level editor on. I know this is messy. I will update the earlier tutorials when I get a chance

    extract the rar into your construct folder.

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

    This symbol will be at the beginning of each tutorial in this thread so you can easily find them and go back to them.

    S stands for superstructure, or systemplus. it is shortened to 's' to require the minimum amount of typing when invoking expressions. also, s happens to be the first letter in two of it's major functions.

    We will first go over what a superstructure is.

    A superstructure is a named container which can contain named arrays of 5 different types of data. Strings, Numbers, Objects, Object Types, and other superstructures.

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

    in s you can create variables of any of the following types:

    • strings - store text, like names of characters or items, players, or dialogue.
    • numbers - store floating point or integer values, like hitpoints, or x and y positions
    • objects - store references to construct objects. a construct object would be like the player sprite in your game, or a text object on the top of the screen that displays the current score. You can use these references to gather information from objects, and to control objects. For instance, you can find out the x and y coordinate of an object, or pick an object so you can change it's position. This is only a reference, however, not the object itself, so more than one object variable can refer to the same object, and destroying an object variable or reassigning it to another object doesn't affect the object itself.
    • objecttypes - stores a reference to construct object types. while an object variable refers to an actual object, the object type variable refers to the type of an object as distinct from an actual instance of that object. If you destroy a sprite at start of layout, even though there are no sprites you can create an object of type sprite. You can check if there were any collisions with an object of type sprite, even if there on are sprites on your layout. ObjectType variables can be used anyway you'd normally use a dropdown box to select a type in construct, like creating a new object, or checking for collisions.

    with s you can create any number of named variables of any of these types. such as a number called "hitpoints", or a string called "name", an object reference called "currenttarget", or an objecttype reference called "enemyspecies"

    remember that these are all variables, so any value, including the object and objecttype variables can be changed at any time.

    most of us our familiar with the idea of a string or number variable and their various uses. So let's explore the possible uses of objects and objecttypes.

    I will only give one possible scenario for each for now, but their possible uses are as diverse as strings and numbers, if not more so. One could create a "currenttarget" object variable that could be used to store the current target for an ai enemy for instance. the enemy could be made to chase this object, you could pick this particular object and check for collisions, you could change targets arbitrarily, or you could recall this object at any time, even if it is not in any particular pickable situation.

    one example of a usage for an objtype variable is to store the type of a currently equipped throwable weapon.

    one could make an objecttype variable "throwweapon"

    when it was time to throw a grenade, a boomerang, a bomb, or a knife, you could use the same code to Create New Object, and just insert the variable type in place of a particular type. it wouldn't matter if they were all of the same type (like a sprite, or an xaudio2 object, or what behaviors they had applied to them, etc. You could use one single action to spawn whichever type was stored in an objecttype variable

    there are many other scenarios where these new types of variable could be useful, but we'll move on to specific application after we've covered all of the basics.

    next we will explore the concept of arrays:

    in s, when you create a single variable, you are actually creating a container for that variable type.

    The container consists of a name, a default value, the variable itself. for instance:

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

    so here we have a string container called "username" with a default value of "player", and the actual string value stored in the variable. However, each named container in 's' can contain any number of values referenced by numerical index:

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

    they can be accessed and treated as single values. if you specify no index, the first value is accessed. if you try to access an index greater than the size of the array, the default value is returned. Also if try to set the 30th value of your array, without having 1 through 29 added yet, 1 through 29 will be created and set to the default. Remember, it is perfectly acceptable to create a string container to hold a single value. the concept of an array only comes in if you need that container to hold more than one value.

    You can create arrays of strings, numbers, objects, objecttypes, and supers.

    Now to explain the super, or superstructure.

    a superstructure is a data structure that can hold any number of any of these named array containers, including named containers for arrays of supers:

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

    a super is designed to as a completely customizable conceptual object. You can organize data an objects in a meaningful way. The entire collection of containers and data structures you create is actually contained in one 'master' super.

    for example:

    one my conceive of something called a "party"(a super), which has a "name" (string), a "rating" (number), and contains an array of "party members" (array of supers). Each "party member" has "hitpoints"(number), a "name"(string), an "inventory"(array of object types),"armor"(super), and a "weapon"(super). Each "weapon" consists of "strength"(number), "name"(string),and a "sprite"(object).

    S uses a special array notation to navigate and access your structures

    it is necessary to understand this notation before moving on to actions, and expressions

    {""}[/code:17pu5r54]
    this is an empty address
    
    [code:17pu5r54]{"party"}[/code:17pu5r54]
    the address of the "party" super in the above example
    
    [code:17pu5r54]{"party","name"}[/code:17pu5r54]
    the address of the "name" string of the "party"
    
    [code:17pu5r54]{"party","party member"}[/code:17pu5r54]
    the address of the first "party member" in "party"
    
    [code:17pu5r54]{"party","party member",0}[/code:17pu5r54]
    this statement is equivalent to the statement above, any time you include a number in the array it refers to the index of the previous address component.  This is a 0 index, so it begins on 0 instead of 1.  0 is assumed if an index is not provided, in this way, you can address singular variables the same as arrays (remember single variables are just arrays that contain only one member)
    
    [code:17pu5r54]{"party","party member",3,"inventory",5}[/code:17pu5r54]
    would refer to the 5th item in the "inventory" of the 3rd "party member" in "party"
    
    In the next lesson, we will see an simple CAP example of how superstructures, and other arrays can be created and accessed.  I will also release the plugin itself.   Unfortunately I'm out of time for today, but tomorrow I will go over several examples of the applications of the superstructure system.  Once the basic syntax and workflow are understood, it will be possible to easily create projects that would once have been extremely convoluted, and difficult to organize with traditional events and picking.  A few simple examples would be the creation of a 3d object editor, or an AI that can prioritize tasks and targets.
    
    I hope you all will forgive me for the mostly theoretical post.  I had anticipated getting far enough to actually release the plugin itself. Unfortunately, I've run out of time and I must get to bed soon.  Please bear with me long enough to see what this thing can do 
    see you tomorrow
  • >

    > so will that picking thing be any good for families with containers?

    >

    >

    It means you won't really need families or containers. You can pick however you want. It kinda makes the pairer plugin obsolete.

    what davio said,

    if you wished, you could create structures with container and family like functionality at runtime, but with full control over how picking, creation, and destruction are handled. you could also arbritraily change the members.

  • ok, the alpha is complete

    if I think of anything simple between now and tomorrow, or I notice any simple bugs I will try to correct them

    This plugin won't make much sense without a tutorial

    so I will be putting one together as quickly as possible

    and posting that along with the alpha some time in the next few days, hopefully today (Oct7)

    This plugin serves 4 main functions. The first 2 are mostly complete in the alpha, all that remains is tweaks to streamline the workflow, and whatever comes up in this alpha test. The other 2 are not complete, and so not included in this alpha release.

    • To enable creation and manipulation of data structures, called supers, which enable unified conceptual organization of data, object instances, and object types. For instance, one could create a thing called a "party"(a super), which has a "name" (string), a "rating" (number), and contains an array of "characters" (array of supers). Each "character" has "hitpoints"(number), a "name"(string), an "inventory"(array of object types),"armor"(super), and a "weapon"(super). Each "weapon" consists of "strength"(number), "name"(string),and "sprite"(object). Any array can have data overwritten, inserted, or removed at any point in the array. Also ready for the alpha the ability to save and load the entire hierarchy in an encrypted format.
    • To allow unlimited control in picking. the ability to loop through, pick, unpick, toggle, pick only, or pick all of any object instance or type stored, and the ability to perform this picking as either the original object or as a family
    • To enable python to be used with the (SOL)picking system in construct
    • To augment the math functions already included in construct with more math functions, and also to integrate math functions into the data structure system to allow operations to be conducted on arrays of data, or applied to arrays of objects(such as interpolating the positions an angles of an array of objects with a single action). Also, expressions that can be applied to arrays of data for a single answer, such as an average of numbers, or a concatenation of strings. One function is included in this release - Seeded Random
  • quazi, there's certain stuff that's just nicer with scripting

    when you learn c++, you'll see how certain things are just easier that way;

    however, saying that scripting is not useful in construct without realizing/mentioning scripting is broken probably means he hasn't tried much

    also, xombul, if you feel comfortable with c++, you should try making plugins

    anywho, back to the thread topic

    yeah, construct is lightyears ahead of secondbest in this gamemaker genre

    it's the only one I've seen where you really don't have to make compromises as far as quality

    the fact that most questions are answered with Cap examples speaks volumes about it's ease of use

  • finally checked it out

    very nice

    especially the transition example

    makes even the simple example scene look pretty dynamic

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • global('FASTMODE')

    not sure about your interface problems though

  • sprites have to be facing toward the right

    that is 0 degrees

    so if you had a sprite of an arrow like this ---->

    that would follow the mouse with the actions you said

  • try doubleclicking the event sheet in on the project pane

    sometimes construct starts up without it open, and thats how I fix it

  • I think the problem is that the families are not in the containers

    the objects are

    and since the families have their own picking SOL

    it can't work

    whenever my new plugin comes in, you'll be able to do this

    and yes, I think pairer could solve this as well

  • excellent job

    very visceral

    love the eraser bits

  • pretty...

  • What in the name of-

    ...

    HOLY HELL. Awesome! Though, I imagine trying to actually build anything in 3D more complicated than a box is gonna, well, but somewhat difficult.

    the plugin im working on will make creating editors and loaders (of any kind, not just 3d) much easier

    remind me when i release the plugin, and i'll make a 3d model editor example

lucid's avatar

lucid

Member since 16 Jan, 2009

Twitter
lucid has 25 followers

Connect with lucid

Trophy Case

  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

24/44
How to earn trophies