Easy pathfinding in python [almost without math]

preview_player
Показать описание
A tutorial on creating pathfinding in python & pygame. We will be using the pathfinding module to avoid doing complicated math and instead focus on implementing it in an actual project.

(You also get lots of perks)

Social stuff:

Timestamps:
0:00:00 - Intro + pathfinding theory
0:01:51 - Simple pathfinding project
0:12:14 - Creating the Roomba project

Project files:
Рекомендации по теме
Комментарии
Автор

library has changed.
So use
for point in self.path:
x = (point.x * 32) + 16
y = (point.y * 32) + 16

in those 2 places.

yucelonal
Автор

Man, you're doing great job for beginners. Everything is clearly explained like everytime :) I don't know how this channel is not 1kk+ subs

patrinho
Автор

Wow, this works amazingly well for my NPC's in my text adventure. I had to translate the given path into their language (1 north, 2 west, 3, east, 4 south) but they work and find their paths respectfully. Thank you for this awesome tutorial, you just boosted my NPC's brains 10 times lol.

adventuresoftext
Автор

1:01:15 was what I was looking for. In fb groups and discord and everyone told me to use vectors. I am glad I watched this video since I will be implementing pathfinding in my next game and it also solved my problem of floating point error. Thank you mate you have helped me immensely with your content.

ammarshahzad
Автор

After watching your tutorial, I understand that I am not a good instructor. Keep up the good work!!!

HaKaNOGUZ
Автор

wow... I built a pathfinder myself. Why did I not just wait for a clear code tutorial?

sylvanfranklin
Автор

Love ur tutorials. It’s very detailed and it made me do something😆

joezheng
Автор

This was so useful thank you I was writing out my own pathfinders which all had terrible performance

dumbhusk
Автор

1:06:48 "Oh, it's actually working." I think this comment is because in the code provided in github, if you let the roomba get all the way to the final point, then click a new path, it starts moving in the last direction and does not follow the path. As long as you click while a path exists, the code works.

housecaldwell
Автор

Excellent Video for Path planning and excellent game formation

gulrukh
Автор

Hey Dude ! You have the best Pygame tutorials on YT !!

patrickslomian
Автор

Very useful <3 Thanks you very much.

thangphu
Автор

100% the best python channel on yt, please do c++ soon

ethankhamis
Автор

I am Benedek Vass and I love your content!

benedekvass
Автор

Very usefull tutorial! I implemented this into my game. I recomend also using this: print(self.grid.grid_str(path, start_grid, end_grid)) for debugging purpose. Shows nicely in console the whole pathfinding matrix and path. Could you also make some tutorial how to make large levels with multiple tiles (ie. 100x100 matrix)? Because the problem Im dealing with is not related to pathfinding. The problem i have with such large levels is that i get performance issues when i want to update every tile position in every frame. That goes to updates per second and i dont know how to work around this (framerate drops significantly). I tried adding all tiles to one surface and bliting only that surface on screen and it did help a lot but still im not satisfied with framerate. surface.scroll is not really good option in my case because it works on intigers and my movement needs to be float. Please help...

RqUiM
Автор

Hey, great tutorial! I noticed that the Roomba does never stop at the exakt middle of the tiles because the collision rects stop the movement before the Roomba is in the exact center. Any thoughts on how to fix this?

lucasblomgren
Автор

on version 1 0 4, it does not display coordinates quite correctly

ijovreg
Автор

This no longer works. It will not read the GridNode. The docs for this are not readily available do you have any knowledge of where to look for a solution? I was really looking forward to implementing this in my games.

shizon
Автор

8:01 path now returns a gridnode: <GridNode(0:0 0x1f0a5dafc50)> instead of (0, 0). You can now print an ASCII representation of it with print(grid.grid_str(path=path, start=start, end=end)). And that's cool, but I want to see just the list like you have it here and I can't find a way to do that.

housecaldwell
Автор

im having a problem where the vectors in get-direction are appearing as zeros, so that they cannot be normalised which stops the code from working

fbe