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 Apocolyptosaur · Feb 11, 2012 at 05:59 PM · aipathfindinggridbuildingrts

RTS Grid and Pathfinding

I'm making an RTS game, but I don't know how to make a grid for building objects. How would I go about doing that?

Also, I really have no idea where to start on my AI pathfinding. I've seen something about A*; What is that?

I'm pretty new to Unity and only know some very, VERY basic crappy scripting (but I want to learn), so try not to use too much fancy lingo, and if you do, please explain it.

All help is appreciated!

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Berenger · Feb 11, 2012 at 07:26 PM

If you're that new to Unity, pathfinding might be a bit of a stretch. A* is the name of the algorithm used for most path finding. I think it's about nodes, finding the closest neighboor etc. Anyway, if you still want to go for it, try AngryAnt or AronGranberg's packages.

About the grid, if you need only the visual part, projectors are great for that (see the unity package about projectors). If you need it for positionning stuff, that's another matter. There is some assets on the assetstore that could interest you, or you could do your own.

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 Apocolyptosaur · Feb 12, 2012 at 04:18 AM 0
Share

Actually, I looked into A-Star a bit more, and I think I might actually be able to manage that within time. The grid would be used in collaboration with the A-Star, so yes I do need it for positioning.

avatar image
0

Answer by gamenut30111 · Sep 01, 2012 at 05:55 PM

I must agree with Berenger, A* pathfinding is quite a jump for someone new to unity, however to make a grid, here is a simple code :

 var length : int;
 var width : int;
 var nodeSize : int;
 var gridArray : new Array();
 
 function Generate () {
    for(var x = 0; x < width; x++){
       for(var z = 0; z < length; z++){
          gridArray.Add(Vector3(x*nodeSize, 0, z*nodeSize));
       }
     }
 }
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

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

6 People are following this question.

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

Related Questions

Grid system visualization 1 Answer

Best solution for Grid-based building system? 0 Answers

Pathfinding and AI for an RTS game 3 Answers

RTS dynamic formation width and length 0 Answers

How to write a basic pathfinding script 5 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