CJD's Recent Forum Activity

  • i.gyazo.com/c619ad52533e9988e8ca43125b587ff3.gif

    Ok, so in this gif, it shows it working, but not for the same reasons as I hoped it would;

    You can see a box engulfing AI sprites ( which dont have any paths for testing purposes ),

    it moves to their position every 0.5 seconds, but it favors the first instance which initiated this event,

    which is why you can see it teleport back to the first AI that touched the view range of another.

    So its working, but how well it does this purely depends on the size of the container.

    It moves to the center of both AI instances its closest to within a radius of 100, I initially set this to the container's width since its height and width are even.

    But I quickly realized a circle does better at this than a square.

    But it isn't perfect, would there be any way to eliminate its preference for the first AI instance that spawned this container in so that it stops rocking back and forth?

  • The benefit of a horde is they all share the same calculated path of one instance.

    With the way I want to set it up, anyway; So the calculation is made once.

    1.) to pick the lead,

    2.) lead picks an end route to move on, spawns an area for other AI to call to action,

    if they don't make it, they are left behind;

    3.) And finally one more to disperse any AI within that field so that they aren't overlapping each other.

    Im confident I can do the other two, its just picking the lead that I figured Id have problems with.

    I also have a chunk system that will unrender and pause any AI not currently within proxy of the player, so lag would only be an issue if I hoarded every NPC up into one chunk and let them roam around.

    But Im sure I could fix that by limiting the number that can stay in one chunk at any given point in time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh no for the path finding direction I already had something in mind for it,

    All I need the box for is just to count any AI within the horde, pick any that are touching it, then select one as a lead which will then forward a path finding direction for the rest, its critical for strategy and allows hordes to break apart slowly if they don't all make it to the lead's end position.

    But if this is just to move a sprite inbetween multiples of the same instance, then this is great help, I'll plug it in with some modifications and see if it works.

    I'll tell you how it went.

  • This forum post was made after discontinuing an old thread I realized is far more extensive than just the few questions I started out with.

    My goals are and will have to remain for this thread:

    1.) Use the Pathfinding behavior.

    2.) Use a custom LOS ( Line of Sight ) object ( In my case an invisible sprite ).

    3.) Work for multiples of the same instance, separately and individually.

    I'll start with my last question on that forum post, I'm working on an AI behavior or path finding type ( each type is separated as modules I can request ).

    The current one I'm working on is a horde behavior, and although I know how I wanna approach it, I lack the mathmatical know-how to make it work.

    How do you make a sprite follow inbetween two moving points of the same instance?

    Say I have 2 AI_Sprites, I want a huge box around them to use as a sprite counter, I need this box to be in the middle of all of them, and follow as they move until they break off from one-another.

    I feel like the solution for this is as simple as an action, perhaps something like "distance(AI(AI.IID = 1).X/Y, AI(AI.IID = 2).X/Y)"

    I used a similar formula in my first attempt which didn't work too well.

    My current solution is casting a ray between AI#1 and AI#2, and spawning a sprite in the middle of those two points, and removing it when I don't need it.

    This works, but I know this will lag after a couple hundred of them at once.

    But obviously I'm sure someone else knows better so let me know, it has to follow the conditions above is the only take away, families are also off the table.

  • Alright, Ill be closing this forum post and starting a new one, I formulated my own answers to most of the questions that I've asked but the help I got was helpful in deciding on what I should do,

    and gave me quite abit of bounce-back to enhance my thought process.

    My next forum post will be on the topic of pushing the path finding behavior, and likely will start with the last question I had on this forum post.

  • I find navigating the forum's page genuinely confusing,

    This is gonna be embarrassing but trying to find the " post new forum page " button just doesnt click in my head.

    So Ill post a question here since its critical for the next step of my AI.

    I am now working on a horde behavior, where AI move in unison.

    I need to spawn a sprite in between two of the same instance, and have it move with them, isolating it for those sprites is no longer an issue, I solved it and kinda mastered it.

    How do you spawn a sprite and have it move inbetween multiple of the same instance?

    Let me share a picture explaining what I wanna do:

    Until then Ill try to get this working myself, but any help is appreciated.

    If anyone new is reading this, I am using the same instance for my AI; I'm not changing this as its important for scaling of my game.

    I've already broken multiple barriers with my progress and don't plan on switching any time soon.

  • When the loop ends yeah, Would me switching from a for every ( loop )

    to a pick one with that characteristic not close that loop?

    In my head it would be, and correct me if I'm wrong;

    For every ViewRange...

    Pick an AIHolder who does not equal the owner of that ViewRange.

    So in otherwords, if another AI sees another AI, pick an AI in its view range that isn't itself.

    Again, this is an Interceptor AI, so it needs to know where its buddy is, and where the player is.

    If its buddy is engaging another target, jump in and attack the player.

    Maybe it would be better if I switched that for every to a pick single ViewRange because it would apply to every AI holder thats true to anyway,

    But this is the only way that worked for me so far so no chance that idea would actually work.

  • I cannot set it to true else it'll always be true for all that applies within those conditions.

    So if true means it'll follow the player, it will follow the player.

    If it isn't true it will not follow the player.

    Even if the opposite is true for either of these at some other point in time, it will still favor the first result.

    Which is why I'm forced to use a toggle since it seems to get around this issue.

    Also, I assume C2-3 read from the top down with sub events happening every other tick, don't see why a else after a loop is a bad thing.

    When I loop through all the view range instances, I close that loop by then picking one out of all of them with those characteristics.

    The reason why I don't skip the first step is because I want this to individually apply for every AI instance.

    But you did mention something interesting, what do you mean by it isn't defined and how would I better define it?

  • No ideas on eliminating random Boolean triggers?

    Because currently what I'm doing to get around this is kinda messy, I mean, anyone reading this post can see what I mean,

    All of this is to make sure the boolean is set to false when it needs to be false, and toggled if it meets certain conditions to true.

    I can't eliminate all of these and simply have an elseif statement immediately trigger something false or true,

    It just doesn't work, and I have no clue why.

    So instead, its abunch of comparisons with set false,

    And only one toggle to set to true.

  • It did not work, and I'm gonna chop that up to I don't know how even after doing research into it.

    However, good news, I came up with my own solution, it isn't perfect but it does exactly what I want it to, doesn't change my code, and works for each instance of the same object.

    Doesn't use families, Doesn't use unique objects, Doesn't use LOS.

    Well, technically it does use a unique object, but this unique object is pared with my AI anyway lol.

    Its VisionRange, which is a sprite that acts as my own custom LOS.

    Then I used a boolean, which I had to fidget with to get working, again, it isn't perfect and it tends to flip true/false on random occasions,

    But I managed to eliminate as much of it as possible.

    This whole thing is so jank but I don't mind it at all, specially considering I couldn't find these answers on any forum post, always suggesting the easy route which ever it may be,

    And trust me I've seen all kinds of methods to differentiate instances of the same object.

    Id love to post how I made this later in the forums, I don't mind sharing this tech since once it goes into a final product, it wont be recognizable.

    Here's a picture of what I did, feel free to suggest any more methods of eliminating that random boolean swapping nonsense it tends to do:

  • Each AI instance actually has room for option 2, but I didn't think I'd ever need to utilize this as a method to get it to work.

    Each AIHolder has a Variable "Entity ID" or EID, which it would use to spawn a sprite according to that EID.

    I won't be doing the keep each AI instance as a unique one, because thats not the direction I'd like to take.

    Its the easy path out and although attractive Id have to make a unique instance for every AI Id implement, and likely copy and paste code for each.

    So long run, not optimal, also not as customizable as it would first seem.

    I'll first try the family method then try the dummy sprite method ( since there is room for it and it was technically planned, kinda ).

    Thanks for the reply, I'll be back with you if it is or isn't the solution.

  • This isn't relevant to the problem but it does show in action how all of this works.

    These are gifs of my AI in action.

    Interceptor ( when it sort of works )

    i.gyazo.com/fe2823c08cc625c7cd208861d2144937.gif

    Aggressor

    i.gyazo.com/f5f8930650db6a83490a6764fc3d174d.gif

    Self-Preservation

    i.gyazo.com/dc5e3e126ff960110c22a78fdd6fd162.gif

    So this is proof of concept that this does work, but I have to fix it after adding something new just about everytime.

    And yes this does still hold up when there are multiples of the same instance, I make sure of it with condtions and variables narrowing it down, this thankfully still works even at the current version of this project.

    This also works without families, and If possible I'd like to keep it that way.

CJD's avatar

CJD

Member since 22 Jul, 2018

Twitter
CJD has 1 followers

Trophy Case

  • 6-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

8/44
How to earn trophies