help with a list of family and picking problems and hacks

This forum is currently in read-only mode.
0 favourites
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • please post any issues you've had where either you had no way to pick something the way you wanted to, or where you needed to use the object/family hack or the double family hack. this can include situations where the solution included creating a new private variable just for the sake of helping you pick, where the private variable served no other purpose.

    when i've made a reasonable amount of headway on my game project, and updated custom controls, i will be making a new multipurpose plugin.

    so this is also the place to post suggestions

    im on break at work, so ill try to explain briefly.

    first, wherever i say arrays, that means arrays, stacks or queues.

    it will provide:(if it all works out)

    strings and numbers(separate from private and global variables, this will make sense in a minute)

    a way to create arrays of objects, that can be picked by index.

    and create families and containers which contain any combination of objects strings, numbers, arrays, and other families

    objects in arrays can be accessed by index, or by traditional picking means of course...anywho:

    EDIT: what I had here before very confusing, so I will post my more rational example from later in this thread:

    [quote:2jymb8fn]the idea of the family and the arrays are separate

    you can add several things to a family, and they aren't thought of in any particular order

    they are just together

    like a regular family or container

    you can also have an array

    this is ordered, you can add stuff to the top or bottom, remove stuff from the top or bottom

    you will probably be able to do this to the middle as well, but I need to test the efficiency

    you can put arrays inside families, and you can have arrays of families

    you could create a family called 'item'

    [item]

    sprite object of item

    string object's name

    number for the repair level of the object

    you can access it all as if it were one thing, the commands will be different than with private variables, but you will be able to access the name as if it were part of the item

    if item sprite collides blah blah blah

    and item name is "sword"

    -1 from item repair level

    you could make an array of 'item's called 'inventory'

    and then access them by 'name' inside 'item'

    by an index in the array

    and you can pop or push them to the bottom or top of a stack

    then you can make another family called 'character'

    [character]

    string for name

    number for hit points

    inventory (the array of items)

    then you can create an array of 'characters' called 'party'

    as I said before, you'd be able to create a random group of objects and put together families randomly for one time use

    like remembering a group of objects a character encountered,

    or a list of coordinates

    but this is an example of how it could be used more powerfully through organization

    and solidly defined containers

    using the stacks and queues are like arrays that you only about the top or bottom of

    a queue is like a line at a grocery store

    the person who got there first, will leave first, and they are gone, no longer part of the line

    a stack is like a stack of books, the book you placed last on top, is the first one you will remove, then no longer part of the stack

    I'd like to make this fully flexible, where all arrays can be used as stacks, queues, or arrays at any time, and you don't need to think about the terminology, just add, or remove, or get, or pick from front or back.

    but examples of uses can be:

    having an AI character go to one location at a time, or attack one character at a time, and move on to the next when the last one is done,

    have a list of functions (Strings), and then call the functions in the order they were received, if a new high priority function comes along, it can be added to the bottom of the array (used as a queue). when a function is done, it is removed, and with no loops or commands, the next function is ready to be called with no separate command to do so.

    a third use would be a multiple targeting system, where pressing a key locks on to the next thing

    this is already possible, but could be much simpler with something like this

    remember also, that this isn't just for stable organized objects

    you can create a random list of random objects to save in a group to remember at any time for later use

    the idea here is to fill in any remaining gaps that the normal family/container/pairer/picking built into construct can't do, or could be easier. combined with the stuff that's already there

  • I don't really get what you are describing, but I am all for a simple, quick and lightweight data container (stack, queue, whatever). Hashtable is a bit unwieldy, array is like trying to use a cauldron to fry eggs etc.

    Basically, what I am looking for is a linked list object or something, that can accept numbers or strings, it would have the following features:

    • sorting (automatic, manual, on request, disabled)
    • dynamic (add, remove, replace elements without hassle)
    • stack (LIFO - last in, first out container, the most recently added object is the first to come out, has uses such as undo feature)
    • queue (FIFO - first in, first out container, the first object is first to go, essential for stuff like queued commands etc.)
    • indexing - by native index (number) or by name (named list, much like hashtable but allow capital letters)

    Think it'd make sense to create a custom data object, which you'd be able to customize to meet your ends - simple list, stack, queue or more complex named fixed list. This could shift focus from private variables to personal data objects, give more freedom. But this is too much already...

    A simple stack, queue and list will do.

  • basically everything you described is what i was trying to describe, but without saying lifo and fifo,

    i was giving situations is can be used in, but yes, the plugin would focus on giving you as much control as possible over the creation and management of customizable containers, with the ability to index by any member, one of which could be a name string, or by actual numerical index.

    i would prefer to have it be flexible, so you can use fifo,lifo, or regular array and chyange at any time

  • That would be awesome! It would be ideal to also have a pairer plugin, well, a simpler one than Object Pairer. Imagine if you could link sprites and data containers like that into a relationship, organizing a parent-child hierarchy!

    I've been trying to post a feature request for it, but then I realized that it may be more difficult than I thought. Perhaps this linker object should be limited to unique instances. I'd love to be able to access children directly and manipulate them without having to use elaborate conditions and subevents that likely mess SOL up. Like containers, but flexible. You get the idea. Problem is, Construct doesn't really like roundabout ways of object references.

    Oh well. A flexible data container would be a great feature indeed!

  • So, you are creating some kind of customisable "struct", like in C? (or object in c++) So that the members of the structure can be other data types or objects of construct?

  • So, you are creating some kind of customisable "struct", like in C? (or object in c++) So that the members of the structure can be other data types or objects of construct?

    exactly

    also adding arrays of objects

    and the ability(like structs)

    to use these containers to hold other containers

    That would be awesome! It would be ideal to also have a pairer plugin, well, a simpler one than Object Pairer. Imagine if you could link sprites and data containers like that into a relationship, organizing a parent-child hierarchy!

    yeah thats the idea too

    something very simple

    like 'remember' picked "charsprite"s in "mymem"

    'remember' "20" as "bullets left" in "mymem"

    and then later - 'recall' "mymem"

    and 'forget' "mymem"

    a completely flexible object pairer

    with backward lookup ability

  • Basically something like a family without a families restrictions(different objects types, etc.), with added functionality of adding to the family on the fly, and a customizable hierarchy within the family, IE when I create this object and add it to the family it will be added to the last(or first) of the list.

    So I can do something like this:

    sprite on collision with sprite2

    sprite2 create sprite3

    add sprite3 to family.blue.last

    family.blue.new

    add to family.blue.stack

    set position to family.blue.last

    I wonder what kind of controls you can have for the stack tho.....

  • kinda

    the idea of the family and the arrays are separate

    you can add several things to a family, and they aren't thought of in any particular order

    they are just together

    like a regular family or container

    you can also have an array

    this is ordered, you can add stuff to the top or bottom, remove stuff from the top or bottom

    you will probably be able to do this to the middle as well, but I need to test the efficiency

    you can put arrays inside families, and you can have arrays of families

    you could create a family called 'item'

    [item]

    sprite object of item

    string object's name

    number for the repair level of the object

    you can access it all as if it were one thing, the commands will be different than with private variables, but you will be able to access the name as if it were part of the item

    if item sprite collides blah blah blah

    and item name is "sword"

    -1 from item repair level

    you could make an array of items called 'inventory'

    and then access them by the name inside item

    by an index in the array

    and you can pop or push them to the bottom or top of a stack

    then you can make another family called 'character'

    [character]

    string for name

    number for hit points

    inventory (the array of items)

    then you can create an array called 'army'

    which would be an array of 'characters'

    as I said before, you'd be able to create a random group of objects and put together families randomly for one time use

    like remembering a group of objects a character encountered,

    or a list of coordinates

    but this is an example of how it could be used more powerfully through organization

    and solidly defined containers

    as for the stack controls you could have,

    pick bottom, pick top, push and pop bottom or top

    for starters,

    but any suggestions anyone has, let me know

    oh yeah, and when exactly do you need the double family hack again?

    I haven't had to in a while, and I don't remember

    it falls in this general area though, and a more logical workaround is probably possible here

    also, if anyone has any ideas for what this object should be called...?

  • Hmmm, how about stack object? Oh wait will this even be an object? Cause it kinda needs to be built in. You know with the functionality of an object, as well as a behavior, kinda like families are.

    As to the double family hack take a look at this:

    http://dl.getdropbox.com/u/666516/stareater.cap

    Taken from one of the compo's lol

    Also for the stack, how about placement as a percent?

  • Hmmm, how about stack object?

    eh...I don't know, it does alot more than stacks, and stack is a programmer's term

    construct is supposed to be a tool especially made for nonprogrammers to be able to jump in and use

    [quote:10sz4cw5]Oh wait will this even be an object? Cause it kinda needs to be built in. You know with the functionality of an object, as well as a behavior, kinda like families are.

    I can't build it in. I can only make plugins, but I'm not sure why it needs to be like a behavior, or how are families like behaviors?

    you won't be able to use it like a family in the sense that there won't be an icon representing your custom families

    however, I do plan to have collisions and comparisons, etc.

    you would have to use the objects' conditions to test for collisions, as opposed to the sprites' collision tests, though

    but it will amount to the same, and use the same collision testing techniques

    as for object specific things, like sprite 20 having a behavior, or being a panel instead of a sprite, and you want to access those things, one of the main points of this plugin is to fill in any gaps with picking you would have

    the picking system is awesome, but there are certain things that are difficult or impossible to do with picking right now, picking objects included in the plugin is going to be as comprehensive as possible. I am going to try to cover all the bases

    [quote:10sz4cw5]

    As to the double family hack take a look at this:

    http://dl.getdropbox.com/u/666516/stareater.cap

    Taken from one of the compo's lol

    thank you, but can you just give me a sentence or two that describes why you'd need it

    all this segmentation stuff is distracting me from the basic picking issue that makes the family hack necessary

    [quote:10sz4cw5]

    Also for the stack, how about placement as a percent?

    what do you mean?

    like add object at 50%?

    what happens if you have 10 objects and you tell it to place at 15%?

  • [quote:1llin47d]how are families like behaviors?

    In that you can add it to an object, or well vice versa.

    But yeah guess you cant change the program.

    As to the family hack I'll let someone else explain. As its a pretty new concept to me.

    [quote:1llin47d]what do you mean?

    like add object at 50%?

    what happens if you have 10 objects and you tell it to place at 15%?

    Well if 10 is 100% of the stack, and 1 is 1% 15 would fall somewhere at the bottom. Yeah some interpolation would be required. An expression like get stack amount would be nice.

  • Family hack? The Stareater, is that my project? Well gee, guess I should explain the trick!

    Well, it is not a hack per se, just bit of a clever solution. What you do is add two or more families, depends how complex your picking code gets.

    With two families, let's name 'em A and B, you can pick from other family INDEPENDENTLY of the SOL of first family. You see, families have their own SOL, as do objects. That is three different selected object lists!

    So, with more than one family, when you are working with already selected members of family A, you can select another bunch from family B without messing the selected members of A up.

    If it is too confusing, let me illustrate it:

    You have balls. Normal, ordinary round balls, not the furry kind. Add two families to these balls, name them Red and Blue. Even if balls actually are pink, but who cares.

    So, you have a condition that, say, filters balls by their relative position. Balls on the left side of the table, for example. You make a condition, using the family Red:

    +Red.X < LayoutWidth/2 (Assuming the table is the size of a layout)

    Now, we want to also pick balls that are on lower half of the table. But wait, we can't do that, we've already selected balls and if we refine search any more, we won't be able to grab balls on lower right! Oh wait, we've got one more family to abuse. Phew.

    +Blue.Y < LayoutHeight/2

    Now we have two selected groups of balls, first group of balls that are on left side of the table and second group of balls that are on lower half of the table! Two selections, independent of each other! You can make operations with them, like count them, see how many balls are in either group, which side of the table is more populated etc.

    Within the same event. That, friends, is the beauty of multiple families; they grant you access to extra SOLs (Selected Object List or something, it remembers objects that passed the condition). You can combine this into elaborate picking procedures! Oh, and don't forget: objects have their own SOL as well, so that is three ways to abuse! Whee!

    And that's it from me.

  • Yeah some interpolation would be required. An expression like get stack amount would be nice.

    definitely going to have "get size" stuff

    also considering interpolating, but for other purposes, like

    an action to Lerp Object positions between blank and blank

    which would automatically lerp, qerp, or cubicly interpolate the positions of all the objects automatically making the first and last objects be in the correct positions

    it would be a nice shortcut for a commonly done function

    ...

    Well, it is not a hack per se, just bit of a clever solution. What you do is add two or more families, depends how complex your picking code gets....And that's it from me.

    thanks for the explanation

    and that's a perfect example

    you could do something like this without using the family trick

    I understand the family trick works perfectly well, but logically it doesn't correspond with the intended purpose, as in, reading the events doesn't make it immediately obvious what it's doing like it normally would

    and being able to create these picking relationships on the fly would allow more power and flexibility

    so you could do something like

    if Sprite.x<100 place spriteA in group "LeftFam"

    if Sprite.x<100 place spriteA in group "RightFam" if Sprite.x>100

    if sprite('yodude') = "whatup" place spriteA in group "CoolGuy"

    if spriteA in "CoolGuy" is overlapping spriteA in "LeftFam", do whatever

    know what I mean?

  • [quote:h9i6lw3s]definitely going to have "get size" stuff

    also considering interpolating, but for other purposes, like

    an action to Lerp Object positions between blank and blank

    which would automatically lerp, qerp, or cubicly interpolate the positions of all the objects automatically making the first and last objects be in the correct positions

    it would be a nice shortcut for a commonly done function

    Thats what I need, a simple way to arrange multiple objects, like a snake, or a platoon in an rts.

    Of course in the rts situation you wouldn't want the picking event to set position, just the ability to get the information and tell the objects where to go via the rts calls.

    Like

    repeat stacksize object.tank times

    object.tank stack=loopindex

    rtsobject.tank move to rtsobject.tankstack(loopindex-1)

    Or something like that, but the problem currently is picking from the actions side of the event.

    [quote:h9i6lw3s]

    Family hack? The Stareater, is that my project? Well gee, guess I should explain the trick!

    Yeah Its fun to play with.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • lucid What you are describing would be awesome and a very useful addition! Can't wait to see an early prototype!

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