Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by FeeeshMeister · Jul 05, 2016 at 03:46 AM · c#javascriptai

C# or Javascript for enemy AI

I'm sorry if this has already been answered, but I could not find this anywhere in the forums. I have been working on a game in Unity and will be starting on enemy AI soon. My question is which language (of C# or Javascript) is better for my game. When I say "better" I am talking about a few things, mostly overall speed, loading time, hard disk space, and functionality (easy to fix bugs/glitches, easy to do more complex things in less time, etc.) I am somewhat new to Unity and C#, but I know very little about Unity's version of Javascript. My game is a top-down 3D rpg. Most models are very simple and should not effect speed very much. The battle system for which I will use this AI and the AI system itself are somewhat complex, and will not be turn-based. I use Unity Personal Edition version 5.3.2f1 64-bit on a 64-bit PC.

Thanks in advance.

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
Best Answer

Answer by ericbegue · Jul 05, 2016 at 07:37 AM

Both C# and JavaScript (aka UnityScript) are compiled to CIL bytecode. So, the difference is only a matter of syntax; both languages should be equivalent in terms of speed and memory usage. Which language to choose depends on your own preference (or the preference of your team).

If you are new to Unity, I would suggest to go for C#. Since it is the most used language, you will be more likely to find online examples and help from other users. Also there are rumors that UnityScript might not be supported in the future, but there is no official announcement about that.

About writing AIs, both languages are general-purpose and does not provide specific AI functionalities. So, the language choice is irrelevant when it comes to AI. Rather, you would need to learn about AI techniques or methodologies.

Here are some techniques you might want to look up for:

  • Finite-State Machines

  • Decision Trees

  • Behavior Trees

  • Hierarchical Task Networks

  • Utility Systems

I am a Behaviour Tree enthusiast and developed a script-based framework based on this technique, you might be interested to have a look at Panda BT.

Also Unity has built-in support for navigation and pathfinding. You can use this system to make your character models be aware of their environment and make them move from a point A to a point B by finding the shortest path and by avoiding obstacles.

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 FeeeshMeister · Jul 05, 2016 at 03:56 PM

How do I comment and show your answer is correct?

Comment
Add comment · Show 2 · 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 ericbegue · Jul 05, 2016 at 05:28 PM 0
Share

You have the "Accept" and "Add comment" buttons at the bottom of the message.

avatar image FeeeshMeister ericbegue · Jul 05, 2016 at 05:38 PM 0
Share

Thanks, I'm new to the Unity website as well.

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

205 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Save system 1 Answer

How do I make a enter and exit car script? 0 Answers

Custom Camera Script Toggle Enabled / Disabled 2 Answers

Trying to make a Parkour Platformer! 0 Answers

Adding and calling to .js files in build 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