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

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.

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.

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.