User Tag List

Results 1 to 10 of 10

Thread: Simple top down pathfinding

  1. #1
    Clicker Install Creator Pro
    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)

    Join Date
    May 2016
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple top down pathfinding

    So, I am working on a roguelike game. There are rooms that have holes that act as traps and I want the walking enemies to avoid them. But I don't want to use complex pathfinding as I think it will slow down the game. So is there any simple solutions to this?

    Right now it just makes the enemy stops upon collision with the hole, like this:
    screenshot.jpg

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 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)
    Sparckman's Avatar
    Join Date
    Feb 2011
    Location
    Planet of the Kangaroos
    Posts
    1,423
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Here is a simple solution I used before, it might be a little too simplistic lol but it works.

    https://youtu.be/BwdhL46_X3Q



  3. #3
    Clicker Fusion 2.5 MaciOS Export ModuleInstall Creator Pro
    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)
    Jokk3's Avatar
    Join Date
    Dec 2013
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pathfinding extension should be fast enough. I tested it on 420*200 tile map grid with 20+ enemies tracking moving player in real time without no noticeable hit on performance (didn't try to go past that because that was enough for me). You can even create maps from the collision backdrops or from bitmap images with it. It is easy to change tiles property to be passable in real time (useful for revealed secret doors or dismantled traps). I think you can also give tile a cost value, for example you can make enemy decide if it goes over the lava or goes around it based on the cost value. If you want higher performance you can deactivate enemies from using pathfinding by setting zone or distance qualifiers, or just create pathfinding map for the room that enemy is in, or just do pathfinding on timed intervals or... But again, it should be fast enough without it.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 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)

    Join Date
    Apr 2007
    Location
    Australia
    Posts
    1,151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can safely ignore the video posted above, it's basically just a path movement done via events for some reason?? Not very good for the type of thing you want to do.

    Sketchy/Muddymole has an example of basic pathfinding in his RTS engine (no extensions). http://www.sketchy.co.nf/ - It's a bit down the page under "Realtime Strategy Engine". It also downloads straight away without having to go through malware providers.

    You can also use the Flocking Object, which is what I used in my Weirder Stuff game. I've attached a quick example of using the Flocking Object, with bonus line of sight engine!
    Attached files Attached files

  5. #5
    Clicker Install Creator Pro
    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)

    Join Date
    May 2016
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies guys!
    @Sparckman: your method is not efficient as my layout is randomly generated, and I don't want to generate tons of nodes to do that. And as RhysD said, why use objects as nodes while you could use the path movement?
    @Jokk3: if there are no easier ways then I might use the Pathfinding object. But, does the Pathfinding extension works with non-tile-based movements?
    @RhysD: I will take a look later when I'm back home

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 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)

    Join Date
    Apr 2007
    Location
    Australia
    Posts
    1,151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The pathfinding object relies on a grid for movement, but I assume you could make the cell size it uses pretty small to make it look less grid like.

  7. #7
    Clicker Fusion 2.5 MaciOS Export ModuleInstall Creator Pro
    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)
    Jokk3's Avatar
    Join Date
    Dec 2013
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pathfinding is almost always based on a grid because of efficiency and accuracy of A* algorithm. Seeing how your game seems to emulate look of an older tile based game, PF being grid based should not be a problem. You can make pathfinding more efficient if you make your levels to be based on fixed tile size. This will make pathfinding easier to implement. However pathfinding does not need to use same cell size as the tile size is, for example 32x32 tile based game can use 16*16 pathfind cell size. However, if enemy has own movement between pathfind result nodes, it is really hard to see " the grid" - especially if you combine pathfinding with other sort of movement behaviours. For example (if player is close enough, in a right zone... ) you do line of sight check to see if there are obstacles between enemy and player, if there is, enemy pathfinds and walks towards player until there is not. If line towards player is clear, enemy runs at player using just simple directional movement.

  8. #8
    Clicker Install Creator Pro
    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)

    Join Date
    May 2016
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @RhysD: Your flocking example kinda works but enemies often get stuck in obstacles. I guess I have to use the pathfinding object then.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 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)

    Join Date
    Apr 2007
    Location
    Australia
    Posts
    1,151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah it works mostly for what I needed. Still a few bugs as you can see

    The pathfinding object will work fine, but its a nuicance having to use the in object array saving / loading for multiple actives.

  10. #10
    Clicker Fusion 2.5 MaciOS Export ModuleInstall Creator Pro
    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)
    Jokk3's Avatar
    Join Date
    Dec 2013
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Most of the hassle with Pathfind extension can be reduced by putting objects that use it in a special group(s). Than use fixed val of instance as array save name. You can make functional pathfinding group that can have multiple enemies just with few events (I have made one with 5 events and one of those is just to start the forEach loop). Events will look messy due to the CTF Something(some(some(),some())) structure and due to the need to convert fixed vals to str$()ings and cellXY to gameXY. However, you get a system that can work in varied conditions without need to alter anything code-wise after the setup, with good performance and consistent results.

Similar Threads

  1. Simple Ai Pathfinding Method
    By Lukiester in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 15th July 2015, 06:06 AM
  2. Simple Pathfinding help
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 27th October 2012, 12:38 AM
  3. Simple Example of pathfinding.
    By SEELE in forum File Archive
    Replies: 13
    Last Post: 28th June 2008, 02:47 AM
  4. Simple pathfinding?
    By ruffgang in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th February 2008, 02:09 PM
  5. simple pathfinding example
    By integrality in forum File Archive
    Replies: 4
    Last Post: 22nd February 2007, 06:09 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
  •