Flow field path finding

edited June 2017 in Share Your Work

https://vimeo.com//220571608

https://github.com/lmccandless/Processing3/tree/master/pathFlowing

After getting really frustrated with(and giving up on) A* search, I reinvented something that as usual, already existed, called flow field path finding. This is a pixel based approach that detects red pixels as obstacles. I implemented it on both the CPU and the GPU. The path finders run on the CPU, only using the GPU generated path map for understanding their immediate surroundings. I get 90+ fps on the GPU version with a couple thousands entities pathing per frame.

Toggle between CPU/GPU flow field engines with (q) key.

-/+ gpu shader passes with (1/2) keys.

Toggle 60fps frame rate lock with (a) key.

A brief explanation of how flow field tech works. Imagine your house is totally blacked out, now put a very bright flashlight in one of the rooms. If the flashlight is bright enough, you should be able to find your way to the flashlight in the fastest possible route from any other room by looking at your feet and moving in the direction that is brightest.

Comments

  • I get an error on line 81

    NumberFormat Exception: For input string: "#"

  • changed
    Float formatedFloat = new Float(renderTimeFormat.format(renderTime/1000000.0));

    to just

    Float formatedFloat = new Float(renderTime/1000000.0);

    and now it somehow works for me

    cool stuff, I like it

  • edited June 2017

    It didn't error for me but I cleaned up that part and added a second version to the github that uses a shader to draw all the collision map, it runs twice as fast and takes a lot of load off the cpu.

    I am a big fan of tower defense games and hope someone finds this useful!

  • Very impressive work -- and beautiful -- work!

Sign In or Register to comment.