- Home /
Do I learn Javascript or another programming language?
Hello everybody,
I am new to all of this and I am wondering which direction I should go when learning a programming language. I have a game in mind that I would like to create.
Two avatars in close conbat, each avatar has its own stats ie strength, speed, stamina, dex, defense and moves as well as other variables like weapon damage and armor obsorbing damage etc. And the stats can change either over time or instantly as the character grows in experience and or becomes fatigued or injured. I also want there to be a lvl of AI involved where the avatar will decide on a thrust move or a slash move etc. The two avatars combat without user intervention until one is beaten. Is that something I can do with Javascript or do I need to learn another language that Unity will support? Is this something one can write and test in code alone before it is attached to the avatars? Any advice would be helpful.
Thanks,
Mfreeman
I've re-tagged your question, as it's actually about choosing a language and not about AI (which means it would not be of interest to others looking at questions with that tag).
Answer by Tetrad · Jun 24, 2010 at 04:01 AM
On a high level, anything you can do in one language you can do in another. There's nothing specific about Javascript or C# that makes one more capable of doing one thing over another. If you want to throw out nerd jargon, as long as they're Turing Complete and have access to these same APIs you can do whatever you want.
That being said, there have been lots of discussions as to which language to go for.
Here's probably the most apt: http://answers.unity3d.com/questions/5/how-should-i-decide-if-i-should-use-c-javascript-unityscript-or-boo-for-my-pr
And here's one with a slightly different slant: http://answers.unity3d.com/questions/6056/why-is-javascript-recommended-over-c
And here's an answer with a list of a bunch of tutorials, not necessarily programming related: http://answers.unity3d.com/questions/4897/how-can-i-start-learning-unity-fast-list-of-tutorials/7235#7235
Personally I prefer C# mainly because I come from a C++ background (I like staticly typed languages), and there are a couple of more advanced things you can do in C# (like the ref
keyword). And the MSDN .NET documentation is lacking in JScript.NET code samples. But that really doesn't matter, since what you need to do is just learn programming and not programming in a specific language.
Edit: I think people learning how to code shouldn't use Javascript to learn how to do game programming in Unity for a couple of reasons.
The big ones:
1) The fact that it can implicitly create coroutines is probably detrimental to game programmers who don't fully grok the concept of Ticking/Thinking. I see that here with a lot of "why is this while loop causing my program to hang" questions.
2) A lot of the inferred typing can hide what's actually going on behind the scenes, whereas an arguably more verbose, manually typed language like C# could help the person learn what's going on behind the scenes easier since they have to understand the idea of types.
Some littler ones:
3) Most game programming is done in C++, and converting C++ algorithms/concepts (i.e. those found on more general purpose game development websites) to C# is arguably easier than going from C++ to Javascript.
4) You'll find a lot more references on how to do .NET things in C# than Javascript.
The .NET documentation includes JScript.NET though, which is really similar to Javascript in Unity (which is mostly statically typed and completely so if you use "#pragma strict", which is the default for Unity iPhone). Although the JScript code examples seem to be somewhat lacking compared to C#.
@Tetrad - LOL. I looked at your edit history to see what changes you made, and saw the reason for change #3...
Answer by Pirate___man · Jun 24, 2010 at 03:27 PM
I think that Javascript is the easiest to learn, while C# is the easiest to use. If you are just starting out I would reccomend javascript but if you are familiar with other programming languages than C# is the better option.
Answer by TaigaStudios · Jun 30, 2010 at 08:12 PM
I would recommend you to look into both languages (javascript and c#), google some basic tutorials (AND WRITE THEM) and find out which syntax you prefer.
I had a university level programming carreer, but the most help for programming with unity i got from this simple simple 2d shooter tutorial at 3dbuzz.com ( its free but requires you to register a free account)
after finding some tutorials around the web ( google unity3d tutorials) I would recommend to check into this youtube channel steamis50 with unity3d tutorials (found it today and looks pretty good)
If you get more questions feel free to ask here, good luck with your gamecarreer and I hope you have as fun time learning as I did.
Your answer
Follow this Question
Related Questions
how would i write this in C#? 1 Answer
Best Language for Unity 0 Answers
Audio for tutorial playing once 0 Answers
How should I decide if I should use C#, JavaScript (UnityScript) or Boo for my project? 14 Answers