Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by AlucardJay · Apr 04, 2013 at 04:04 PM · pathfindingastar

Lost in Pathfinding again

With some awesome help from whydoidoit and unitygems, I was able to make some hexagonal pathfinding : http://www.alucardj.net16.net/examples/StrategyGridPath0-1.html

Built after help on this question : http://answers.unity3d.com/questions/361204/lost-in-pathfinding.html

Before the new year, that turned into this little game : http://www.alucardj.net16.net/examples/StrategyGrid1-0.html

So I thought I was ready to develop my pathfinding to a navmesh, but I was wrong : http://www.alucardj.net16.net/unityquestions/WaypointPathfinding1.html

There is something wrong with the way the heuristics are calculated. This can be seen when you select a position on a different height or around an obstacle, the charcter zig-zags his way to the destination. He will get there, just not directly.

I have been over my code until my eyes glaze over, yet I cannot see where I am assigning the wrong heuristic value, or or simply adding the wrong thing to a list, or not removing something from a list.

I need an expert eye, someone with experience in this type of pathfinding to help me see where I am making mistakes leaving my character to pick zig-zag paths. He absolutely gets there, and uses the virtual paths, it's just the zig-zagging that has me stumped. (nudge-nudge, wink-wink, I see you have some spare time at the moment whydoidoit !).

If anyone can help me realize where I am going wrong with my heuristic calculations, then my joy will be indescribable =]

Here is the script : http://www.alucardj.net16.net/unityquestions/TroopScript.js

And here is a package of the project : http://www.alucardj.net16.net/unityquestions/WaypointPathfinding1.unitypackage

lmb shows my virtual navmesh, rmb to move.

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ByteSheep · Apr 05, 2013 at 05:57 PM 0
Share

Was going to read your question, but got stuck playing the game ;)

avatar image Dracorat · Apr 05, 2013 at 06:00 PM 0
Share

In A* pathfinding, this sort of behavior sometimes happens, so to combat it, I give one axis a slightly higher "score" than the other axis. Can something like this be applied to your algorithm?

avatar image AlucardJay · Apr 07, 2013 at 12:44 PM 0
Share

Heh, no worries merry_christmas, it actually feels good that someone apart from me has played one of my games. As you can see, it is very much an early prototype. All my projects get to this stage, then I get bored of looking at it, or interested in something else, so I havn't got a single game that's finished and polished to completion. The map editor definitely needs multi-select which I know how to do. $$anonymous$$aybe if you think it's worth it I shall start working to make it a real proper game. For me that project wasn't really about the RTS, more the pathfinding, and the random map generator and hexagonal grid procedural mesh. I was going to develop this to voxels and have destructible environments.

Dracorat : thank you for the suggestion, I shall certainly take a look at increasing the heuristics for diagonal navPoints, and let you know the results. That is a really good suggestion =]

avatar image Turbine · Apr 19, 2013 at 08:47 PM 0
Share

I've made a very similar hex based game and pathing system before. It looks like you could be have any number of small bugs

  • You are not calculating your heuristics properly

  • You are not calculating your actual cost properly. It seems to get confused if co$$anonymous$$g from specific sides.

  • You may be running into floating point problems. This seems unlikely, but it produces this kind of erratic pathing

  • I once ran into this where because of a program$$anonymous$$g bug the AI could only go to five of the six sides. I felt really dumb.

I would recommend making a gizmo to show the pathing cost of going between every node. Something like a colored arrow showing the transition cost. It is maddening to debug AI without graphical debugging tools.

avatar image Turbine · Apr 19, 2013 at 08:49 PM 0
Share

I like your camera controls btw.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to calculate distance based on A*? 2 Answers

Path finding algorithm for 2d game 2 Answers

How do i get the IsPathPossible() function to ignore some nodes using Astar Pathfinding Project 0 Answers

Implementation of Navmesh terrain dijkstra algorithm 0 Answers

Pathfinding unity 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges