Itenimum1's Recent Forum Activity

  • Well I know of one way, is to

    On Mouse is down event>>

    create your sprite at mouse.X/Mouse.Y or Mouse.X(0)/Mouse.Y(0)

    But, for a game LIKE the one you mentioned, you'd have to learn trigonometry or some kind of middle ground of hitting certain button combos and checking length and distance and size of a sprite to manipulate it like a rope and freeze its position. I'm totally unsure. I know there are some rope examples available that deal with free form shapes. You could perhaps try spawning shapes a certain size and length while mouse button is down and when on first mouse button is clicked set shape and length to initial change dir x of mouse and then width to a default size and for change in mouse X and Y since movement calculate shift and shift in change to make the newly spawned sprites take a length or shape of a more square or rectangle depending on the change in shift x and Y.

    Something:

    On Mouse button is down>>>
    begin a .. loop? hmmm dont know, a function that continously loops and compares the x and Y current?
    
    Ok first make 2 variables (globals, or locals) named CurX and CurY) and a MouseTracker object and set it to always folow your mouse.X and Y or Mouse.X(0) and Mouse.Y(0) which I find most reliable.. usually)
    Every tick>>>
    CurX: Mouse.X
    CurY: Mouse.Y
    
    Every tick >>>
    set  MouseTracker position: MouseTracker.X to Mouse.X, MouseTracker.Y to Mouse.Y
    
    Every tick >>>
    Set MouseTracker.MouseXVar to Current Mouse.X
    Set MouseTracker.MouseYVar to Current Mouse.Y
    
    Every tick>>> (all events below go off MouseTracker object vars)
    CurX!= MouseXVar >>
    CurY!= MouseYVar >>
    set CurX to MouseXvar
    set CurY to MouseYvar 
    
    Every 1 second >>>
    Set LastMouseX to Mouse.X
    Set LastMouseY to Mouse.Y 
    
    Every 2 second>>> (all events below go off MouseTracker object vars)
    MouseXvar != LastMouseX>>
    MouseYvar  != LastMouseY>>
    set LastMouseX to MouseXvar
    set LastMouseY to MouseYvar 
    
    On Mouse button is down>>>
    every tick >>>>
    
    //(applied to some variable or mouse tracker.. which could be constantly setting itself to the mouse itself) 
    begin function funcMouseDraw(param0: MouseXVar, param1: MouseYVar, param2: LastMouseX, param3: LastMouseY)
    
    Localvars for function:
    Localfunc1:
    Localfunc2:
    Localfunclast1:
    Localfunclast2:
    
    (dont quote me on this, you may not want to store the variable locally as it may not update, make them static as it seems to help witht his, otherwise dont bother as you can just test the functions params.)
    On function funcMouseDraw>>>
    set Localfunc1 to funcMouseDraw.param0()
    set Localfunc2: to funcMouseDraw.param1()
    set Localfunclast1 to funcMouseDraw.param2()
    set Localfunclast2: to funcMouseDraw.param3()
    1st level SubEvent--->>
    MouseTracker.CurX == Localfunclast1 >>
    &&
    MouseTracker.CurY == Localfunclast2 >>
    &&
    Not overlapping an objectSpriteDraw
    create objectSpriteDraw
    set objectSpriteDraw width to: <some default shape value here>
    set objectSpriteDraw height to: <some default shape value here.. for your default draw shape, using whatever the sprite is>
    
    else
    
    MouseTracker.CurX(or localfunc1) == Localfunclast1 >>
    &&
    MouseTracker.CurY(or localfunc2) == Localfunclast2 >>
    &&
    Is overlapping an objectSpriteDraw
    <Do nothing>
    
    else 
    
    MouseTracker.CurX == Localfunclast1 >>
    &&
    MouseTracker.CurY != Localfunclast2 >>
    &&
    Not overlapping an objectSpriteDraw
    create objectSpriteDraw
    set objectSpriteDraw width to: <some default shape value here>
    set objectSpriteDraw height to: <default shape + or - the change in Y using localfunclast2>
    
    [/code:17pm0o41]
    Anyway, this is a rough idea on how to approach this
    
    -- See, it doesnt help that Construct 2 has no access to the graphic renderer. So we cant draw simple sprites (like real ones) We have a sprite object class which has parameters we pass and is an object.
  • I fixed this is two ways just now and they only slightly confuse the crap out of me: (note: both ways include conditional else statements, where before I had no conditional else)

    First way:

    Pick searcher by  UID of searcher>>>
    Check state>>
    Inverted/Not Target varCondition != CorrectCondition>>> (so not not equals.. which means it does equals? I assume)
    Pick nearest to (searcher.X, searcher.Y)>>>>
    <do stuff>
    Else>>>
    Pick searcher by UID of searcher>>>
    Check state>>
    Target varCondition != CorrectCondition>>>
    Pick furthest to (searcher.X, searcher.Y)>>>
    <do same code above>
    [/code:1mbjwe91]
    
    yes somehow this worked
    this one below makes more sense sort of.
    
    Second way:
    [code:1mbjwe91]
    Pick searcher by  UID of searcher>>>
    Check state>>
    Target varCondition == CorrectCondition>>>
    Pick nearest to (searcher.X, searcher.Y)>>>>
    <do stuff>
    Else>>>
    Pick searcher by UID of searcher>>>
    Check state>>
    Target varCondition != CorrectCondition>>>
    <nothing>
    [/code:1mbjwe91]
    
    Of course, placing the "pick furthest" on the else conditional of this one breaks everything so I had to disable it and make it do no action. Which is also what I want.
    Right now though, I'd be more interested in knowing:
    
    A. Why this does nothing or not work the way I want if there is no ELSE, (makes sense code/programming wise of course, but I'm not coding with a scripted language so understanding event list editors is very confusing sometimes as to what can be accepted and what cannot.)
    
    B. with A, why does this not work if I just have one check at the top with If Target == CorrectCondition and just stop at finding the nearest. I assume it will stop at the nearest and check to see if it is correct, and then cease all further searches with things not nearer than that. Which I assume forces you to use the else condition to searcher either farther, or know that the thing you found is not equal to the condition so try the search again?? This is strange concerning the way I have it set up visually and seeing that it does work this way is confusing me somewhat. As in above it (second way) it is showing me looking for something that meets the condition, and then searching nearest to it. When I disable that objects condition intentionally and expect them to stop, they will, but if I spawn other objects meeting the condition farther away from it they will pause and not go farther unless I spawn something closer that does meet the condition,
    
    then I just added a else, and for some reason it works? (especially concerning the second way, where it chooses you if you are not equal and then literally does nothing and knows to choose things farther away) My only reasoning is that, it has picked the object previously that was not meeting the CorrectCondition and knew to disregard it somehow with the previous loop when it looped back over this statement. I have no idea.
  • Right now I want something to find something nearest to it, the UID for this object is stored, so its picked already, however, I don't want it to find the nearest of something that doesnt have meet a certain condition.

    How do you usually do this inside of construct 2, I tried using For Each loops but it kept choosing the farthest object or last one made and no longer sorted through them accurately in real time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • not sure how to go about typing this:

    (GlobalNumberN - CountIDLimitMax) > 0 ? (GlobalNumberN + CountIDLimitMax) > CountIDLimitMax ? CountIDLimitMax + GlobalNumberN[/code:2e86wj3m]
    
    giving me some error about expecting a " : " for comparison or something. I had made a Min and Max value but I wanted to see if I could do it without having to declare a Min variable (which is easy and works).
  • In case of someone who is keeping track of this, I combined R0J0hound's method of handling this with my other previously used method of cycling through only a certain number range of instances at a time which keeps the events within afew lines and yet is dynamic enough to be modular. Very nice stuff. (well, appending items needing to do tasks to lists is useful asweell. will experiment further)

    Edit 1:

    Still seems to be some terrible issues with resource management (on instances 1000+, around 400+ it seems OK.) , FPS, and unit count. I'm not sure but it still might require dedicated scoped loops (separate ones) due to the way its either

    1. Being executed

    2. used

    3. built in limitation or issue I cant see.

    oh well I'll keep experimenting with it. Kind of a bummer. Pretty sure itsbecause of the repeat event per tick. I wonder if there is a way to perhaps change the repeat event iteration to every other tick or something? so as not to bog down the processing of tons of units each and every tick?

  • Oh yea, that will loop through 100 times each tick? Will def check it out thanks, basically I'm trying to make the least lagiest for each loops for large amounts of sprite objects who will be given functionality through another function which will do whatever but do it in large volumes. Mostly for stress test purposes. I only use construct 2 to prototype ideas tbh and light game experiments. I was noticing there is a bottleneck everytime I try doing something like this so I had to manually create what you just did in multiple function loops only iterating through scoped object chunks of 1-200, 201-400, etc, etc. Which works great but is made simpler with other functions I discovered (something similar to yours but without nth picking.) I'll give your thing a shot and report back as I require rest now thanks alot

  • Oh, right basically I'm just cutting down on resource usage from the built in for each loops and appending each item to a manual loop iterator (using globals combined with a param in each function (note: only one function))

    but simply put it goes like

    call function loops:

    1-20

    add 1 to a value sort 1_20 (a list of sorts)

    20-40

    add 1 to a value sort 20_40 (you will always want to reset the counter once over 40 to the base 20 and then add 1, never counting 20 of course)

    etc etc each are loops.

    Each loop ends with one group of SpriteObject Variables (well, UIDs) being tested per loop, and with those being chosen, pass their param via one CENTRAL function with CentralFunc(Param0: SpriteObject.UID) its a way ive been creating class built in functions because I cant actual create classes in construct 2 which can inherent scripts within them and choose themselves. Atleast thats what is capable within game maker.

    Now I despise game Maker studio, not only is it buggy but their EULA is restrictive and they themselves say they will enforce it any time of their choosing. (Anyone know of an engine much like game maker with scripts? )

    So, Ive got issues, right now if you do stuff like

    Every "dt * value" seconds--->

    For each object ---->

    pass object to a function(param0: object.UID) and then in the function test to see if it is equal to function.param(0) it works,

    my problem stems from, yes I can do it instead like:

    pick object with a param/variable ---->

    test another condition or even overlap of a sensor object ---->

    pass object to a function(param0: object.UID) and then in the function test to see if it is equal to function.param(0) it works,

    The bad thing baout this, right now I got about 1000+ instances and the CPU usage is manageable, HOWEVER, if I dont create like 3 or 4 of these individual functions that only scope a certain about of objects each time (I.E. a range of objects with a unique variable, or objects onto a list (not sure how this is done in construct 2 tbh)) then I get TERRRIBLE bottle neck issues where some AI dont even get picked for over 50 seconds or more.

    I was wondering like what are some ways to go about managing these bottlenecks with the manageable way besides calling separate scoping loops ruining each tick in tandem with one another?

    GlobalVar1_1to100: 0

    add to GlobalVar1_1to100: 1

    On Loop 1-100>>

    ID > 0 <= 100>>

    pick if ID == GlobalVar1_1to100>>

    call function func(param0: UID)

    then function with matching UID as normal, make 4or 5 of these with blocks of 101-200, 201-300, etc etcetc

    seems to be the fastest way when dealing with instances over 1000+

  • umm, wellp, someone said to append the items which are pinged (flag/bool/var) to need a search onto a list of items which need to be sorted to use this appended search list to pull the UIDs on the list, which works.

    What i ended up doing in one of my tests is chunkify my lists of objects with limited scope. Which isnt new to programming I forget what this is called. Usually threaded I'm sure. But I just discovered event sheets can have functions which are called from other sheets which can end up being useful. Not sure if functions can get passed UIDs and store them PER(tick) call. Anyone know?

  • The has the bad habit of choosing all of them when trying to combine it with distance and compare functions sadly. Kind of important to use with pathfinding. But you can get around it by using a complex system of like 10 or more booleans however thats horrifically messy. Only way I know of choosing a single instance each manaul loop is to store its ID or you cant get unique pathing to the object or for the object/from the object.

    Otherwise you're left dealing with boolean flag hell which is horrible. Imagine the same scenario:

    Pick by comparison ->

    Sprite.Signature = "Heroes"

    Sprite.BoolHasSearched != true

    Sprite.BoolHasTarget != true

    Sprite.BoolJustSearched != true

    Everything else has to keep these in check, but this is only BASIC path finding, if I had conditionals:

    Sprite.BoolDamaged != true

    Sprite.BoolJustDamaged != true

    Sprite.BoolHasTargetInSight != true

    Each of these booleans has to get its own unique group of events which can exceed 100+. Now I COULD do it that way, in fact I've done it before and it is painful to keep the events clean when you do it this way, especially just reading the code back to yourself in the event sheet.

    In most other programming languages (typed) I just pass the object to a function as a parameter and it'll loop through the objects unique behavior that way. But we dont get class files/scripts, so choosing is done on one event list editor. Not just allowing the object/sprite to inherate a class/script and use it to do logic. Even if you do this manaully and pass it a GlobalUID you're back to square one. basically, the Sprite object in construct 2 cannot store a class inside of it which causes problems when looping through tons of instances because the instances are simply Sprites that hold variables and behaviors but choosing them is either done through:

    1. A global or Local Variable for UID/other unique identifier each loop

    2. A painfully slow built in For Each Loop

    3. A matching variable to either 1 and 2 through another instance, just as bad

    4. Matching to an existing number inside of an array, not that fast.

    This is discussing instances over 400+ mind you.

  • Are there any faster ways for dealing with a large amount of instances with unique pathfinding AI behavior other than using global_UIDs matching each instance or a number of global for each loops manually built using a few different global_UIDxxxx for instances over 400+?

  • Anyone have a backup of this? I can already do similar things myself but would love to have examples so I can compare list editor techniques.

  • Amazing work, thank you for this. Construct Classic still cant be replaced due to the content it has to offer. Also that nice BSD license for the games exported with it and the fact it is free GNU licensed software makes it a smart choice... I find even now owning Construct 2 license that Construct Classic -- even with built in limitations and bugs and quirks -- is still quality. I recommend it.

Itenimum1's avatar

Itenimum1

Member since 12 Jun, 2015

None one is following Itenimum1 yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies