Get the latest tech news

Pathfinding to a moving target in evolving terrain


In this post, I'm going to describe how I used direction fields to introduce fast and dynamic pathfinding to a browser game. I recently publ...

The direction field approach produced no noticeable lag in the browser, allowed the game to scale to more enemies, and most importantly, was really fun to figure out. [5] This algorithm assumes that placing an obstacle does not created a disconnected component of the grid, meaning an enemy in any (non-obstacle) space can reach the player. [6] If you're implementing diagonal movement, a route is also ruined if there's an obstacle orthogonal to the direction of the pointer, even if the start and end cells themselves are clear.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of moving target

moving target

Photo of terrain

terrain

Related news:

News photo

Robots can now walk through muddy and slippery terrain, thanks to moose-like feet

News photo

VoxelSpace: Terrain rendering algorithm in less than 20 lines of code (2020)

News photo

Programming terrain from scratch using C++ and OpenGL by Shamus Young (2006)