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 adept22 · May 04, 2012 at 08:15 AM · pathfindingturn-based

A* Pathfinding in a turn based game

Hi i am currently building a very simple 3d turn based game and I am having some issues with doing pathfinding.

Currently i am using Arongranberg.com A* Pathfinding Project, I have path finding working perfectly fine in a real time scenario for my game objects so thats not the problem.

The problem i have is im now implementing the "turns"

Basically i plan on splitting the turns up into a number of seconds ie 15 seconds per turn. The player object will only be able to move a certain distance based on its speed. so if it can move 1metre a second in a turn it can move 15metres.

I'm a bit stuck on ideas on how to handle path-finding in this scenario. I would want it to that when i am in the movement phase i will use the A* library to calculate a path based on the mouse cursor position highlight in green how far that object will be able to move in the "turn" and show red for any part of the path that is out of that objects range.

Hopefully somebody could possibly give me some ideas on how to handle this?

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by adept22 · May 07, 2012 at 02:24 PM

hi yes not really worried about covering ground thats not the issue ive already got that covered. its trying to come up with a formula that will calculate how far a unit can move based on the turn time, and the base speed of the unit.

Comment
Add comment · Show 1 · Share
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 captaincrunch80 · May 08, 2012 at 11:31 PM 0
Share

$$anonymous$$aybe turnTime*baseSpeed*yourScaleFactor?

avatar image
0

Answer by Berenger · May 04, 2012 at 03:12 PM

I guess you want the player to prepare its action without the counter going down and then he execute. It probably woudn't be that hard to trace the path, calculated with the mouse, with lineRenderer, green if the total length < maxDist and red otherwise. But if you want to cover the entire ground with red or green based on weither it can be reached, that's sounds complicated, especially if your games isn't based on tiles.

Comment
Add comment · Share
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
0

Answer by captaincrunch80 · May 08, 2012 at 11:27 PM

Simple! Calculate a path for every changed mouse or cam position. Calculate it's length and give the path red or green color to indicate if it is possible to move there this round.

Is the game based on squares? Because maybe you can implement something smaller and faster performing than A*. (I do not know your scenario, maybe A* is the right choice allready.) - I recommend the book Artificial Intelligence for Games from Millington&Fudge.

Comment
Add comment · Show 1 · Share
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 adept22 · May 08, 2012 at 11:48 PM 0
Share

Thanks for that book quite interesting. Yes i have pretty much gotten rid of the notion of use A and going to write my own pathfinding as i have now implemented a grid square based system which will make pathfinding easier.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Hexagon A* Pathfinding - limiting path length 0 Answers

How can I get my pathfinding algorithm to know that it cant go through certain sides of tiles 1 Answer

3D Grid Based Movement (X-Com 2012 etc) – How to implement vertical movement? 0 Answers

Astar Pathfinding ai moves more nodes than it should 0 Answers

Board-game pathfinding system (Similar to Mario Party style) 1 Answer


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