S
S
s2sk13372017-07-12 16:49:05
Algorithms
s2sk1337, 2017-07-12 16:49:05

How to make a navigator for the game?

I think everyone played GTA5 and there was a GPS navigator. I tried to do this first: write down the coordinates of the intersections and look for the nearest intersection for the player and put a mark there. I did it, but I did not take into account the fact that the intersection may be behind a fence and the player will stupidly not be able to get there ... And the fact that there may be a bridge over the player and it turns out that he will stupidly not get there ... My second idea is to redraw game map in the format: 1 - road, 0 - everything else. For example
:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
billion
_
_
But
there
are two questions. Is it possible to make it even easier and how to programmatically draw such a map?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Daniil Basmanov, 2017-07-12
@s2sk1337

You need to read about pathfinding algorithms, you can start with wikipedia . For the general case of graph navigation, the A* algorithm is usually used . For 3D worlds it is more convenient to use navigation mesh , there is a good Recast library to work with them .

X
x67, 2017-07-12
@x67

Why not make these intersections the vertices of the graph? edges - passability between vertices, and edge parameters - distance between intersections.

D
devalone, 2017-07-12
@devalone

First you need to properly compose a question, indicate what technologies are used and what exactly is needed (you may be surprised, but not everyone played GTA5). If you need to find a route to a point, then use pathfinding algorithms, there are many of them, google it.

A
Astrohas, 2017-07-12
@Astrohas

type in google search for the shortest path in the maze. He will give you options such as BFS, Wave Algorithm, A*, etc., etc. Learn any

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question