A simple method to speed up path finding
Red grid is block grid,Green grid can walk. first,Pre process on map to get datas that we need: 1) The map is divided into many regions, each region consist of a number of grids, these regions must be convex polygon(int most cases,they are rectangulars), there are not block grids in these regions.
2) then generate the shortest path information between regions, such as: the shortest path information between region r1 to region r4 is: r1 -> r2 -> r3 -> r4, save these information in a table. 3) get shared adjacent grid between regions,for the sake of brevity,I shall select middle grid in share adiacents. 4) Save the above information to map data file. Second, path finding process: 1)Determine region where the source grid at and region where dest grid at, for example the source grid in the region r1, the dest grid in the region r4. 2) find the shortest path between the two regions by searching the region path table, the shortest path between the region r1 and region r4 is: r1 -> r2 -> r3 -> r4, this is rough path. 3) the result path will is: source grid -> g2(regions r1 and r2 share grid g2) -> g3(region r2 and region r3 shared grid g3)-> dest grid.
Because there are not block grids in these convex polygon regions, so we can walk a straight line in these regions.
Related Tutorials
What To do If Your Game Received a Copyright Complaint
This tutorial explains how to respond to copyright complaints and why you shouldn't be scared of Apple's emails. It inc…
Video Game PR Basics
A brief guide to the very basics of video game public relations.
Felicia McEntire
Building a Discord
Mega Cat Studios walk us through the journey the followed in setting up their Discord server.
Mega Cat Studios
Publishing 103 - What Publishers Look For in Games
A detailed look at what publishers want from a game, and the materials that you as a developer should have prepared.
Publishing 102 - How To Find The Best Publisher For You
In this article, I will be detailing the tactics you should use while you are on the search for the best publisher. It’…
A Guide to DIY Market Research for Indie Game Devs
Ah, market research. Just seeing those words probably sent shivers down your spine. Market research for indie game devs…
Discussion