99Instances2Go's Forum Posts

  • you know, adding obstacles for Los- and pathfinding behaviors.

    There is a deep logic in C2. A lot is very similar.

    There are actions that take time, some even more time then 1 tick. 'Find path' is one of those. That is why you have the 'on path found' conditions. Same Ajax actions. You have the 'on completed' conditions.

    But, there are also actions/conditions that take a lot of time, but stay in the SAME TICK. The obvious loop conditions, by instance. You will not find a 'on loop completed condition'. Same logic goes for adding obstacles. You will not find a 'on obstacle map completed' condition. Hence, it happens in the same tick. If the generation of the obstacle map takes 5 seconds, the tick will rest for 5 seconds.

    The obstacle map is build on the end of the tick. And is therefor available in the tick after you initiate the action.

    But it gets 'worse'. There are obstacle maps that you dont realise. Like that one associated with the platform, to map the solids. And there is only 1 obstacle map for all instances with a paltform behavior. This is by design, for performance issues (those you try to obey, but it is impossible)

    Also pathfinding has 1 and only 1 obstacle map for all instances of an object, with the bahavior attached. Change the obstacle map for one, and you change it for all. Same goes for LoS.

    So, given that creating obstacle maps take time, that they happen in the same tick and that there is only 1 obstacle map ..... and If you use a loop to assign obstacles .. then .. i say ...

    1/ the time for that one tick gets really long

    2/ the pathfinders in that same tick start as there are no obstacles

    3/ its a little dumb, do assign obstacles 1 (and only 1) time after all objects are in place

    3/bis Attention with the 'newly created objects théorème'. You have to make a new Top-Level_Event to pick them.

  • Yeah i am that idiot that forgot his capx. So familiar.

    https://www.dropbox.com/s/mljvdhuws7q4g ... .capx?dl=0

  • add obstacle and targets for behaviours

    Obstacles? Explain ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I dont understand your capx. Kinda hell to debug. So many objects, so many globals. You should use more instances and different animations. Each instance, in stead of again a new object, is 30 % code less. 30 % less errors. 30% less headaches. My opinion.

    So let me show you (one of the many) way(s) to pathfind in a way that it does not looks for a path every tick.

    I hope you see the easy use of instances.

    And i offer you a very easy way to organise things in an array. I have no idea how you ever gonna balance the troupes in your logic flow. So many variables to change for so many objects in so much code. Look at how easy it gonna be this way.

    Hope i helped you, without disturbing.

  • Think they are the same, put that way.

    Pick by comparison is just more flexible. By instance :

    Expression = sprite.platform.VectorY ... > ... 0

    You can mimic all picks found in the sprite conditions by a pick by compare.

  • I dont know how to help you with that. How ever way i advance (while running the game) to the 'BattlefieldHK1' layout. There are no demons and there are no humans in the layout.

  • I made a capital error. You have to pass the UID in a parameter to the function. Ans (re)pick that sprite by UID, beeing the parameter. Sorry, a bit difficult so without writing the actual code.

    You set the boolean to true, in 'on find' path. So it again keeps searching for a path every tick again, making the same error as you come from.

    Why did't you implement the last part of my suggestion ?

    Might be better if you drop the capx.

  • I dont understand ? If it can not see trough the first walls, it will not see those behind them. It will not reveal anything behind an obstacle.

    Does this capx shows you the possible combinations ? And the principle ?

    https://www.dropbox.com/s/5fogt05zwrwnu ... .capx?dl=0

    The LOS is really a nice behavior.

  • Wrong? Did't want you to spell a lesson. Just wanted you to know why you had no responds, in a forum that is very alive.

    My English is way away from my moms language, an it is all self taught, it is for sure worse then yours.

    Never say sorry, you adapted to the best of your abilities, (as i try), they dont. But in here, i never seen one complain about bad English, lucky for me.

    For only using C2 for weeks, it is pretty nice. Just a bit to much 'If-Then'. I could not do all that in two weeks. And i sure have this particles still not under control as you do.

    Now, i think this is what you want to do :

    https://www.dropbox.com/s/xnjag04aisd0q ... .capx?dl=0

    I wrote comments in the capx, plz read them.

  • You need an family Boolean 'InBatlle'. When they start a battle, set the Boolean to true. False when they stop fightiing.

    Now.

    I dont know how you currently check when they stop fighting. So

    Event --- When they stop fighting.

    --------------- Call function "ride"

    New event

    On function "ride"

    Local variable 'Pos_X'

    Local variable 'Pos_Y'

    ------sub > every tick

    -----------------------Set those locals to the position of the object that stopped with fighting.

    ------sub > system > pick all family

    ------ > Family > Is boolean instance variable 'InBatlle' set > inverted. This picks all those that are not in a fight.

    -------> Family > Pick nearest (to position Pos_x and Pos_y.

    ----------------------- Find path to falily.x and family.y

    New event

    -> family > on path found

    -----------------------Follow path

    -----------------------Set InBatlle to false

    Now they will find a path to the nearest.

    To make em find a new path, every so much time.

    New event.

    -> family > is moving along path

    Sytem > compare two values > Family.Pathfinding.CurrentNode = 2 (zero based, so when it starts moving to the second index)

    --------------------------Call function "ride"

    Now they dont find paths at the same time, and not to often.

  • You probably wonder why no one is reacting. Well, there are two reason, i think.

    1/ The linked file is a backup file. Can be made a capx by just renaming it, but is it really the last version of your project ?

    2/ It leans on a bunch of plugins. It is a bit rude to expect me to dive in the forums, search & find all those plugins and install them. You should at least link to each plugin. Better, and nicer, is to isolate the problem in a new capx. You will get more and better responses.

    Nevertheless, when i have time later, i will make you an example. Starting from scratch. Plz, show me at least a picture of your layout. Is it top view ? Is it side view ?

  • There is a funny side at this discussion.

    Say the 'plugin' is up and ironed out. New and shiny. 3 Weeks later the same problems will arrive. Unavoidable.

    The architecture stays the same, as well as the workflow.

    c2 > Plugin > Electron > Device.

    That is 3 + 100 different developers. 1 tiny change in the chain, and it is back to square 1.

    It is funny (to me), as it seems that some think that this is avoidable.

  • If you move it by physis, physics has a 'is sleeping' condition.

    Else you got to elaborate about how you move it.

  • LOS does not see obstacles. Whats more, it kan not see trough obstacles. So if you make the 'viewer' solid with solids as obstacles it can not see trough itself.

    I suppose the easy way is to have the LOS behavior attachted 2 times. With custom obstacles.

    1 To not see trough the walls, with its event system.

    1 To see the walls, with its event system.

  • rexrainbow

    No probs.

    99Instances2Go

    Thanks for the suggestion, but unfortunately I need it to be as accurate as possible. (It's for something timing based.)

    I can get an accurate total length of a predesignated curved path, which would help, but from what I can see the Spline behavior doesn't seem to move through a multiple waypoint curved path at a constant speed.

    If it is faster in the turnings, then the its a pretty constant average speed. Else, i have no suggestions left.