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 E___ · Feb 05, 2012 at 10:52 PM · javascriptlistmapprioritydijkstra

Implementing Dijkstra's Algorithm in UnityScript

Hi,

I'm working on a turn-based tactics game in which the action takes place on a 2D grid. (I should probably mention that this is my first major Unity project.) I'd like to use Dijkstra's algorithm for finding the movement and attack ranges of units in Manhattan distance. However, Unity doesn't appear to support some of the data structures I need for this implementation (specifically priority queue, map, and list types). What are the best ways to resolve this?

Right now, I'd like to import standard JavaScript library implementations, but it doesn't seem like that's possible. I might be overlooking something really obvious, but as far as I can tell so far, Unity isn't compatible with standard JavaScript. My background is in design and not engineering, so I'm not too enthusiastic about having to write efficient custom implementations of these. Any recommendations? Thanks in advance.

Comment
Add comment · Show 2
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 syclamoth · Feb 05, 2012 at 10:55 PM 0
Share

Use .net classes.

avatar image Eric5h5 · Feb 06, 2012 at 03:25 AM 0
Share

http://msdn.microsoft.com/en-us/library/0sbxh9x2.aspx It would be much easier to port C# code to Unityscript than Javascript code.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by tingham · Feb 06, 2012 at 02:13 AM

You might want to check out the source for Three.js Many of the algorithms can be ported over to Unity by simply fixing the namespace of the class references and function names.

If nothing else you could probably prototype your game in WebGL using Three.js and then work backwards porting in to unity from there (if it's even required.)

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 E___ · Feb 08, 2012 at 08:32 PM 0
Share

Well, one of the main reasons I'm using Unity for this project was to be able to prototype in-engine. I'm also not seeing the classes I'm looking for in Three.js, although it's got enough source content that I might be overlooking them somewhere, or not recognizing them. Thanks for the recommendation though.

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

7 People are following this question.

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

Related Questions

A node in a childnode? 1 Answer

Call the same function on different scripts. 1 Answer

What can i do? Unity no responding when i load a list. 1 Answer

null reference exception problem with generic lists in unityscript (i think...) 1 Answer

Is there a way to convert a 2d generic list to a string in unityscript 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