ome6a1717's Forum Posts

  • Conditions only check the instances picked by previous conditions. So you can use a condition to filter down the picked instances to just a few, and then the next conditions will only run on those instances.

    Testing overlaps is actually a good way to filter down instances, because it uses the collision cells optimisation to avoid even checking far-away instances. So it can even scale to enormous layouts with thousands of instances and stay efficient.

    So does that mean, in theory, if I do a for each enemies, I should create a Boolean that says “Exists” and check that first before the for each? (And Exists would always be true, but it would stop the for each from checking objects that don’t exist)

    Hopefully that makes sense? I’m only asking because I remember seeing a tutorial on the subject (that I would have to do some digging for) that stated that checks with families checked for every sprite in the family even if they didn’t exist in the layout.

  • I'm a bit curious about a specific scenario.

    Let's pretend you have two families; "playerProjectile" and "enemies". Now, let's also pretend each of those families have over 200 objects in each of them. When you do a "for each" loop on say, <is playerProjectiles overlapping enemies>, does it have to check for every single instance of that family even if 99% of the sprites aren't even in the layout?

    If this is still the case (I believe it was in C2, hence my asking), what would a way around this be without having to manually do overlap checks (or other random things)?

  • If I understand correctly I would just set the array value to “100,200,Player”

    Create object by name of <tokenat(arrayXYZ, 2, “,”)> at location <tokenat(arrayXYZ, 0, “,”)> and <tokenat(arrayXYZ, 1, “,”)>

    Hopefully that makes sense?

  • Ashley - Understood, thank you! I think I’ve kept checking the c2 manual by mistake :)

  • I couldn’t really find any manual entry on this, but can someone explain to me the point of using a JSON object instead of an array or dictionary?

  • Ah I misunderstood; I thought you meant right click the layer in the layer properties, not the actual layer itself. I got it to work for a new sprite I tested, but I can't seem to find the one I'm having an issue with, and it seems I'm not creating it anywhere in the event system. I'll just resort to deleting the object and recreating it for now.

    Thanks for both your help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley - any insight on this? I can't seem to find any manual entry on how to fix this...

  • Wulfy - yeah, that only seems to unlock the layer, but not the locked sprite. Hmm....

  • Wulfy - if you select a sprite, you can select "lock > lock selection". That's what I can't figure out how to undo.

  • I know I'm just being stupid, but for the life of me I can't figure out how to unlock an object that I locked so I wouldn't select it by accident...

  • - the way the pathfinding behavior works is that it has to search the entire map when created or enabled. Because the layout is over 16k by 16k, it takes about 4 seconds on creation. So if we had 50 enemies each with their own individual pathfinding sprite, it would take a few minutes to load the game. (and before you ask, the game is a very small pixel scale, so that amount of memory shouldn't be a problem).

    Things will be dynamically created and destroyed in the end, so the best way I figured to have pathfinding in the game was to only have 1 object generate the map and just link each pathfinding sprite to any sprite that utilizes it (enemies, your dog, etc.) Hopefully that makes more sense?

    Also, side question; what looks dangerous every tick?

    UPDATE: Also, confirmed - it is not selecting the appropriate sprite on the UID check. Not sure why, though, the numbers match. I've been having a lot of issues with integers and strings ever since I switched to the new runtime.

  • NoSoul8 - nah that didn't work. Disabling that wouldn't; it would also break more things below that line (that have nothing to do with pathfinding). I'm wondering if just the more pathfinding objects on screen, the less it's able to find a path and stick to it?

    I've narrowed down the problem to the pathfinding object triggers. (on path found; arrived, etc) It's not pushing the booleans to the sprites. Not sure why, though - it's literally picking a UID by an instance var.

  • I'm trying to create a "pathfinding" sprite that can be used and pinned to every enemy that requires it (essentially only ever having ONE pathfind sprite for every enemy, npc, etc. in the game).

    For the absolute LIFE of me, I cannot figure out why this incredibly simple few lines of events aren't working:

    ...and the function it's calling:

    For some reason, only one pathfinding object is moving at once. (ie if there are multiple flies on the screen, they all just sit there updating the destX and Y)

    Am I missing something?

  • - the way I’m regenerating the map is fine. I’ve tried it with around 20-30 enemies at the same time and it seems to be okay.

    If I can’t get rid of the opening lag, I’m not sure what else to do.

  • - right; but if you consider ~3-4 seconds per enemy and over 20 enemies have pathfinding enabled, you can see the issue right there. I'm only ever updating the obstacles in a region and don't want the whole map checked, but it doesn't seem to be able to enable the behavior and stop it from checking literally everything...