User Tag List

Page 16 of 21 FirstFirst ... 6 14 15 16 17 18 ... LastLast
Results 151 to 160 of 205

Thread: Easy Pathfinding Widget (extensionless)

  1. #151
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Would be a nice idea, and I seem to remember I was thinking at doing something like that,
    unfortunately I couldn't due to the fact you can't use qualifiers inside behaviors,
    and I thought it was nicer keeping the path engine tidy inside its own object behavior,
    (so it would have been easier to implement in other projects, just copy-paste the engine objects)

    Btw, with the small code modification above you can detect both (backdrops and active obstacles) at the same time,
    do you need to toggle between them?

  2. #152
    No Products Registered

    Join Date
    May 2016
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I only need it to detect active obstacles so I have disabled the line that detects backdrops.

    Works great, thanks schrodinger. Saved me a lot of time going through each line trying to find it myself

    I'll be putting this through it's paces where speed is concerned. My NPC's will detect if the player is in line of sight and within range of sight, and if already en route to player checks if they are still in the same grid co-ordinate. If not, then they are queued in a list waiting for the new path to be found. So with multiple NPC's all over the place and the player running around trying to avoid/escape them it will be interesting to see the results.

  3. #153
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    seems like a very well thought system
    I think you should have no issues going like that, will be interesting to see in action!

    just one consideration to prevent headaches
    making clear how the engine behaves in certain situations:
    if this will be ported to mobile,
    the engine splits the pathfinding loop in chunks to avoid crashes (specifically, it does it only for android)
    this has the disadvantage of not being able to calculate multiple paths in the very same moment (frame cycle), again, this limitation only on android
    so, if you have a queue list, make sure you wait for the complete path to be calculated ("path_ready" function called back by the engine)
    before you fire the next pathfinding loop
    calculating paths will anyway take very small time (few frames) if your map is not huge and/or enemies not too far / too many
    so you should'nt experience too much of a "wait" for each of them before it's their path turn

  4. #154
    No Products Registered

    Join Date
    May 2016
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I won't be porting to Android so this shouldn't be an issue. But the queuing system doesn't trigger the next NPC in the queue's pathfinding until the path_ready function is triggered. I wanted to ensure the entire cycle was completed before going on to the next in the queue in case of any conflicts.

    I'm using the Internal List extension for my queuing, one for pending pathfinder requests and one for pending path step requests. These run side by side, so a pathfinding request is first made then completed, then a path step request is made to find the next step in the path, then back to the next pathfinding request etc.

    What I may need to do is remove the path_steps function from the pathfinding object and place it in a seperate object. This way I'll only be using the path_find function of the pathfinding object and can run path_steps function in parallel without conflict.

  5. #155
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,337
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Fantastic widget, Schrodinger! I just discovered it, and I wonder if what I want to do is possible, and if there perhaps already are any examples of this? I scanned through most of the pages here but didn't find anything.
    I want all enemies within a radius of a point to chase that point, and the enemies should not overlap each other. They should also stop chasing when they see the player and are within shooting range.

  6. #156
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Thank you Popcorn! Glad you like it

    I want all enemies within a radius of a point to chase that point
    a plain radius, like everyone within 300 pixels from a point to pathfind towards that point?
    a bit like a line of sight, but without taking into account obstructed visual, correct?
    The widget should be fine for that, and since all the enemies (within range) would chase the same point,
    calculations would be optimized (about half of the calculations will be "buffered" to cut on loops)

    and the enemies should not overlap each other
    this has proved to be much more tricky, scrolling posts backwards you can see some tests done for Mehrdad,
    but results were not completely satisfactory, I think...
    Best thing (imo) is probably not doing this within the pathfinding code,
    but detecting with simple "collision-overlapping" events when two enemies touch, and then just "stop" one of them,
    and reactivate movement after a bit of pause, to see when the path is clear..
    The issue then would be enemies "hanging" when situation get crowded

    They should also stop chasing when they see the player and are within shooting range.
    this would be no problem
    you can start/stop the provided chase-path code(s) very easily,
    or build your own on your preference.

  7. #157
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,337
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks! I can maybe live without the overlapping issue, at least for now, but I try for the life of me to make them stop chasing the path, but I cannot figure out how...

    The idea is that you as a player move about in a topdown level like Alien Breed, and when you do anything to alarm nearby enemies, they will chase you and when they spot you, some will stop and shoot while others will charge at you. An example of this would be awesome, but some instructions on how to alter the basic example to my needs is also fine

    Btw, what is the preferred basic example now? there seem to be several different ones..

  8. #158
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    The first frame in the latest mfa is the "full" example, showing all features (blit paths, draw lines, multi paths..),
    and uses a (very simple and not very detailed) custom movement
    while the second frame shows a very basic setup with only pathfinding, using bouncing ball movement
    (third frame is just a bonus idea for showing "walkable areas")

    In the "full example", with custom movement, the movement code is fired for each "bug" when its flag 0 is on
    so you can just add a test line like:

    user clicks with right button over "bug"
    >>> toggle flag 0 of "bug"

    this will allow you to start/stop bugs when right-clicking on them
    (when the path is over, last node reached, if you start the bug movement he will move towards its last direction he followed and so could eventually run out of the screen)

    Replicating the same in the "basic" example would be a little more awkward,
    you could do something like this:

    stop_bug.jpg

    You need to "destroy" the relative path node object, otherwise it will always "call" its parent to follow him
    and I made the "repeat while mouse pressed + mouse over bug" instead of "user clicks on object" because the latter is a green event,
    and that would have caused this to trigger too early,
    before the movement code, causing the bug to misbehave when called by the movement code

    If you want to make characters stop only when reaching a cell, and not in the middle of the grid lines,
    you can play with "path node" object "node_no" value
    so i.e. it will destroy and stop its parent when reaching next node
    (whenever the player reaches this object, the path node will move to next node and "node_no" will grow by 1)

    Both movement examples were provided as basic templates,
    they are similar and I don't think I would suggest one over the other,
    it mostly depends on your "other" needs for your game.
    Of course you can use all the functions included in any way you like and code your own movement,
    there is a "decent" (I think ) documentation on all functions included in the first frame

    Would be super-cool making an example of your game idea
    and would be probably useful for other users interested
    I'm not sure if I'll be able within short time though - I hope I'll do

  9. #159
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,337
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Schrodinger! The attachment link doesn't work, though!
    I'll have a go at what I got anyway

    Edit: Was able to stop the bugs in the basic example the way you described

  10. #160
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    whoops - sorry, fixed link, glad you got it working anyway

Page 16 of 21 FirstFirst ... 6 14 15 16 17 18 ... LastLast

Similar Threads

  1. Multiple pathfinding with Pathfinding Object
    By Erkabubben in forum Fusion 2.5
    Replies: 12
    Last Post: 16th July 2017, 07:54 PM
  2. Pathfinding
    By Limyr in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 28th November 2012, 09:58 PM
  3. pathfinding example
    By method72 in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 27th June 2012, 08:23 PM
  4. 3D menu Widget - Wild Widget Contest entry
    By Czentnar in forum Widgets
    Replies: 16
    Last Post: 26th March 2011, 12:51 AM
  5. The Digit Widget [WIP] (multi-widget)
    By Raylax in forum Widgets
    Replies: 1
    Last Post: 13th December 2008, 11:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •