Guess what?
I’ve decided to learn how to code. That’s right, you read me right. No, the new developer hasn't quit but I figured I'd better be ready for any eventualities. I also want to help coding wise to help out the current programmer of his task. I don't think it's something I could have avoided a lot longer anyway.
I’ve gotten a few books about the topic and I’m slowly getting into it. I’ve gotten over my aversion of it and am now curious about it. It *is* very complicated for sure. I'm still struggling to figure out how it all works to be honest, the logistics of it.
As you may or may not know, STX is made with Unity and coded in C#. I didn’t actually know C# existed before I started to read about it. Three languages are available in Unity: Boo, Javascript and C#. From what I understand, C# is the “best” one. At this point in time however I’m too much of a neophyte to tell you why C# is the best I’ll admit.
I started with
“Game Coding Complete” but it was clearly aimed at more advanced programmers. I then moved to another book about C# but this was also too complex, I wasn’t familiar with the vocabulary and felt lost.
I finally checked out C# for Dummies.
I learned a bunch of things but a lot stuff is still fuzzy.
-Things I Learned-
1. Apparently, by typing:
#region
[something]
#endregion
I can hide what’s between the two #.
2. Typing // is a way to indicate that what comes after is just instructions about the code, not actual commands for the program to interpret. Those are called
Comments.
3. Before you use a variable, you must declare it.
4. To initialize means to assign an initial value to a variable.
5. You must initialize a variable before using it.
6. The book then talks about the Integer types. This is something I didn’t really understand. If integer can go from -2 billion to 2 billion, what’s the point of using different types of integer?
7. Integer truncation and rounding is not the same thing. For example, an integer truncation of 1.9 would be 1 while rounding would be 2.
8. We should use double variables instead of float. To be honest, as a n00b, I don’t really see a point of being so precise number-wise. I guess it’ll become clearer as I go along.
9. I’ll admit the floating point thing is sort of confusing to me. I understand that it has the advantage over an integer to take into account the decimals. According to the book you can’t count using floating points. Also, it’s difficult to compare floating points because of the decimals. The computer doesn’t understand that 1.000001 is basically the same as 1.000000 (or 1).
10. Integer are faster to process than floating points.
11. Another option is the decimal. So basically so far we have: integer, floating-point, double and decimal.
12. Adding M after a number declares it as a decimal.
13. Decimals are the slowest.
14. a “bool” variable can either be one of two things: true or false. In C++ 0 was false and other numbers was true but not in C#.
15. C# treats letters as part of two categories:
a. char
b. string
16. ‘char’ allows to use a single character. Not too sure what would be the point of that just yet though.
17. If you put some letters after a \, you can get special functions to trigger:
18. You can’t have a string over two lines, you need to use \n.
19. String is not a value type. I don’t know what “value type” means just yet but string isn’t one.
20. char use ‘x’ while strings use “x”.
21. Unity has big list of the all behaviors the Game Objects can have.
22. The file name and the class name in the scripts must be the same.
23. Function and method in Unity refer to the same thing.
24. OOP = Object Oriented Programming
25. You need to identify variables in order to use them. Which variable contains what.
26. A script linked to a game object is called a “Component”.
27. dot syntax is when you write files like this: Cabbage.point
28. a method is a substitute for a block of code.
29. Programming grammar is called C# syntax
30. semi-colons (
are used to end a sentence. Not periods (.) because those are used in dot syntax.
31. You can write code over multiple lines, Unity doesn’t care about that as long as you finish your statements with ;.
As you can read, I’m still far away from actually rolling up my sleeves and getting into the code per se but it’s a start. I’m already a lot less ignorant about this topic than I used to be.