PFinding Demo

posted in Beals Software
Published August 02, 2006
Advertisement
I got my pathfinding to an actual useable state so I decided I'd post a demo.

Controls first though:
Select unit: left clickMove: left click on an unoccupied tileQuit: escape/click the x

Clicking on a spot while the entity is moving will cause it get stuck mid move. I actually had one run off screen somehow.
Linky (~770kb)(D3DX9_30.dll required)

Edit: I'd appreciate comments on whether or not it works, runs slow, etc. If it fails to run, It'd make things easier if you also post the contents of the log.html file. Thanks!

Now, it doesn't work perfect. A lot of the time it will search more nodes than it needs too and it won't always choose the best path, but I think I did pretty well for my first time without looking at any articles or code (well, I did a couple months ago.)

Also, I'm going to post my code. BUT, be warned. I did some things that I would never EVER do in an actual project. For example, my Entity class accesses my Map class data directly (which means my Map class data is in public.) There are a couple other things and I'm too lazy to point them all out. Why post it then? So that someone like me can get some use out of it. I would look at this code and throw up, but I'd still be able to get some positive use out of how things are being done, whilst ignoring the bad code. So, any of you beginner C++ programmers, DON'T download this, PLEASE. It'll just confuse you majorly.

PFinding_Src.zip (~20kb)

For those of you that don't love me enough to download it, you can check out the screenshots in my last entry.
Previous Entry Pathfinding and a rant
Next Entry Untitled
0 likes 2 comments

Comments

Tallitus
Worked and ran nicely!

It does seem to search backwards at first though once you try to move more than 2 tiles away.
August 03, 2006 03:52 AM
Programmer16
Thanks Tallitus! It's nice to know that it works on someone PC other than mine lol.

I seemed to have fix the searching backwards problem with my new algorithm. The problem was that tiles with the flipped values (column 4, row 8 and column 8, row 4) would recieve the same distance value and thus might be searched first.
August 03, 2006 05:04 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement