Home General Discussion

Attn: DIY game makers, how did you learn (the coding bits)?

2

Replies

  • System
    Options
    Offline / Send Message
    System admin
    Ah ok, I've just looked through all the links in the thread again and it seems C# is the least covered one! Udacity looks like it focuses on Python, Codeacademy is Javascript.

    Is there anything similar for C#? Nitewalkr mentioned some books like the Dummies books, should I grab them?

    EDIT: TheNewBoston has C#.

    It's got me thinking though, would it be better to go with a less accessible, less beginner-friendly language with more Unity (and Mac) support like Javascript, or will I be competent enough by the end of something like The New Boston guides to jump into Unity?
  • Davision3D
    Options
    Offline / Send Message
    Davision3D polycounter
    Im currently using the playmaker plugin to make a unity game: http://www.hutonggames.com/ Its a great visual scripting language that allows you to make a whole game just by scripting with nodes. I think this visual approach is much easier for "Art" orientated people to program. Especially much easier to grasp the logic and then to debug. You can even see on play how the logic flows. But it seems you already want to get much deeper into programming.
  • Spacey
    Options
    Offline / Send Message
    Spacey polycounter lvl 18
    To be honest you've got some great feedback in here though the one thing you need to remember is that the heart of programming isn't in the syntax but in the logic. (psuedocode and flow diagrams always help me) When I was messing about in WebGL, I had no freaking clue about javascript and documentation and google was my go to. I would say stop stressing too much about which language, just choose one and start making stuff :) Sure it won't look the best but in time you will build a knowledge in logic, flow, oop practices etc. (kind of like art haha)

    Once you get the basics of a language down (especially something like java,C# or python) you can move pretty well between any programming language and probably would need like a 2 day primer on language dependent stuff. O and dont lose motivation! That's what I think a lot of people hate code, they don't understand it and stress about it and then don't come in with the right mindset.

    I just wanted to emphasize this post. When starting out, the language is fairly unimportant. What you're really trying to learn are the methodologies of programming across all languages; things like Looping, Arrays, Classes and Objects. I've bounced between a few languages myself when starting out and the only hurdle is the syntax which isn't much of a hurdle when you understand the basics (mostly "oh, I just need to move these few keywords around").

    I'd suggest starting out in whatever language has the most teaching resources available. Once you start getting better and have a larger understanding, the leap to another language will be easy.

    Besides a few poorly worded instructions, the JavaScript Fundamentals module on Codecademy is really great at teaching the basics. You might need to run through a lesson more than once to fully understand a concept, but it isn't that hard as the exercises are bite-sized.

    Edit: I also don't know where all the "beginner-unfriendly" talk is coming from. When I was starting out every language was a nightmare because the basic concepts were so hard for me to grasp. I don't know how long it took for me to really understand the differences between objects, classes, methods, and functions. Really, just pick a any language as a starting point and try and learn the fundamentals. You can switch at any time if it doesn't meet your needs.
  • walreu
    Options
    Offline / Send Message
    To be honest you've got some great feedback in here though the one thing you need to remember is that the heart of programming isn't in the syntax but in the logic. (psuedocode and flow diagrams always help me) When I was messing about in WebGL, I had no freaking clue about javascript and documentation and google was my go to. I would say stop stressing too much about which language, just choose one and start making stuff :) Sure it won't look the best but in time you will build a knowledge in logic, flow, oop practices etc. (kind of like art haha)

    Once you get the basics of a language down (especially something like java,C# or python) you can move pretty well between any programming language and probably would need like a 2 day primer on language dependent stuff. O and dont lose motivation! That's what I think a lot of people hate code, they don't understand it and stress about it and then don't come in with the right mindset.

    I'm down with this. Exactly to the point.

    So as you already said you are going with Unity. So you have two options C# and Java.
    Make it easy and just pick one. You can't pick wrong trust me.

    And don't stress about books either. You can start learning Unity scripting without any books, it's all in the web.
    When you get to the advanced stuff and you think you will need one, go get it.
  • Nostradamus
    Options
    Offline / Send Message
    Nostradamus polycounter lvl 18
    Unity's own script reference has all examples in both javascript and C#. As mentioned before it's all about grasping the concepts, then the language is fairly irrelevant. As long as you are using object oriented languages, the same methos apply in a general sense.
  • iniside
    Options
    Offline / Send Message
    iniside polycounter lvl 6
    Python is not good for beginner. Solely because is dynamic typed langue, and can learn bad habits.
    It's better to learn from beginning that integer is in fact different from string.
    Other than that, there is not much difference between languages, and most apparent whether is strongly or dynamic typed. I recommend starting from the first one. Main difference are default libraries for language.
    Is there anything similar for C#? Nitewalkr mentioned some books like the Dummies books, should I grab them?
    Absolutely not. Books for beginners are waste of money.
    Your main friend is:
    1. MSDN. http://msdn.microsoft.com/en-us/ms348103.aspx
    2. Stackoverflow. http://stackoverflow.com/
    3. http://www.codeguru.com/
    4. Various .NET developers blogs. You will find them as you progress.
  • eld
    Options
    Offline / Send Message
    eld polycounter lvl 18
    iniside wrote: »
    Python is not good for beginner. Solely because is dynamic typed langue, and can learn bad habits.

    The best games are the ones that are made, bad habits or not. Python is pretty fantastic, and I'm saying that as c++ programmer.

    Regardless though, once one has learned any language, switching is easy, it's pretty much the programming equalent of learning a 3d application, the hard part is learning have to do good art/good logic.
  • gray
    Options
    Offline / Send Message
    iniside wrote: »
    Absolutely not. Books for beginners are waste of money.
    .

    when ever i see this sort of advice i think to myself, really? no books? just jumping around on websites and copying bits of code smashing something together that runs without understanding the overall language concepts and philosophy? it makes me think there are a lot of people who can write code but don't really get the full scope of a language and the structure or design. they write books to give you a detailed over view of the 'full' language. show you how to use all of the features and give you lots of examples to help you along with the syntax and semantics. then you can use it as a reference. web tutorials don't go into that depth. and forums definitely don't. especially at the introduction level books are the best resource and have the most information. i did a search on amazon for c# and get pages and pages of books. they publish these for a reason. if your going to take the time to learn a language i think would be wise to buy at least one or two books. you can always look around on the net for info also.

    also if you want to learn more advanced programming techniques with data structures and algorithms you absolutely have to get books. there is no way you can just surf the net and pick that stuff up. so you might as well get in the habit from the beginning.

    as an example, i learned c mainly from 'K&R Kernigham & Ritchie' which is probably one of the most famous programming books ever. and then learned c++ from 'C++ Primer 4ed Lippman & Moo'. which is also a recommended book. and i can tell you that without theses book i would be totally lost and have probubly given up entirely.

    can someone recommend a similar high quality book for C#?
  • Gestalt
    Options
    Offline / Send Message
    Gestalt polycounter lvl 11
    iniside wrote: »
    Python is not good for beginner. Solely because is dynamic typed langue, and can learn bad habits.
    It's better to learn from beginning that integer is in fact different from string.
    Other than that, there is not much difference between languages, and most apparent whether is strongly or dynamic typed. I recommend starting from the first one. Main difference are default libraries for language.

    Absolutely not. Books for beginners are waste of money.
    Your main friend is:
    1. MSDN. http://msdn.microsoft.com/en-us/ms348103.aspx
    2. Stackoverflow. http://stackoverflow.com/
    3. http://www.codeguru.com/
    4. Various .NET developers blogs. You will find them as you progress.

    In python variables still have types, and you definitely need to know the difference. The only core topic that python isn't good for learning imo is the oop stuff since it is very flexible on that end (unlike something like java which has a huge emphasis on oop).
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Gestalt: all dynamically typed languages still have types, its just more transparent... and easy to break.

    something worth knowing which i missed initially is that all the code samples in the unity docs have a little dropdown menu which lets you choose the language to show them in. by default its JS
  • R3D
    Options
    Offline / Send Message
    R3D interpolator
    lots and lots of googling
  • Gestalt
    Options
    Offline / Send Message
    Gestalt polycounter lvl 11
    r_fletch_r wrote: »
    Gestalt: all dynamically typed languages still have types, its just more transparent... and easy to break.

    Yeah I was more responding to the fact that it sounded like he was mixing weak/strong typed for dynamic/static. Python is still strongly typed so I wasn't sure what he meant about a user mixing strings with ints. For learning and coding I don't think dynamically typed versus static should be a huge deal for someone just starting out; they aren't worried about how something compiles and runs(that's the type of thing you'd probably want to build up to).
  • Ben Apuna
    Options
    Offline / Send Message
    IF anyone is looking for C# books, O'Reilly is having a sale this week 50% off. http://shop.oreilly.com/category/deals/csharp-owo.do?cmp=tw-code-lp-c#-programming

    The Head First C# book might be a good book for beginners. I went through quite a bit of Head First Java which taught through example programs rather than just being a language reference which C# Unleashed seemed to be.
  • Kwramm
    Options
    Offline / Send Message
    Kwramm interpolator
    I wouldn't worry about making it "right" the first time either. With your first programs you'll be happy when they run at all and you see some results. Then get more familiar with the languages data types and control structures. Later you might want to look into handling memory, bad and good coding habits for your language, basic optimization (e.g. organizing your loops better). Then it's just practice and learning from others.

    It's pretty much like 3d modeling if you think about it. First you don't care about topology or how it animated... later when you feel comfortable modeling, you will start to worry a lot more about those. and then again, practice and more practice...
  • iniside
    Options
    Offline / Send Message
    iniside polycounter lvl 6
    gray wrote: »
    when ever i see this sort of advice i think to myself, really? no books? just jumping around on websites and copying bits of code smashing something together that runs without understanding the overall language concepts and philosophy? it makes me think there are a lot of people who can write code but don't really get the full scope of a language and the structure or design. they write books to give you a detailed over view of the 'full' language. show you how to use all of the features and give you lots of examples to help you along with the syntax and semantics. then you can use it as a reference. web tutorials don't go into that depth. and forums definitely don't. especially at the introduction level books are the best resource and have the most information. i did a search on amazon for c# and get pages and pages of books. they publish these for a reason. if your going to take the time to learn a language i think would be wise to buy at least one or two books. you can always look around on the net for info also.

    also if you want to learn more advanced programming techniques with data structures and algorithms you absolutely have to get books. there is no way you can just surf the net and pick that stuff up. so you might as well get in the habit from the beginning.

    as an example, i learned c mainly from 'K&R Kernigham & Ritchie' which is probably one of the most famous programming books ever. and then learned c++ from 'C++ Primer 4ed Lippman & Moo'. which is also a recommended book. and i can tell you that without theses book i would be totally lost and have probubly given up entirely.

    can someone recommend a similar high quality book for C#?
    Well I bough several books, and can say for sure it was waste of money.There was nothing in books that I cloudn't find over internet.
    If you want to learn programming you must... well program. No rocket science about it. Book won't help you with that.

    I simply started by coding web apps. Blog engine, discussion board, and game server.


    And yes. They definitely publish they for reason. And the reason is to get your money ;p.

    Gestalt wrote: »
    Yeah I was more responding to the fact that it sounded like he was mixing weak/strong typed for dynamic/static. Python is still strongly typed so I wasn't sure what he meant about a user mixing strings with ints. For learning and coding I don't think dynamically typed versus static should be a huge deal for someone just starting out; they aren't worried about how something compiles and runs(that's the type of thing you'd probably want to build up to).

    What I mean it's not clear for user. It's big diffrence when everything is converted dynamically, to type that is needed, and when you have to convert types by yourself. And that's why beginner shouldn't start from dynamic typed languages. It's better to know exactly what's is going on, that rely on magic that happen behind.
  • System
    Options
    Offline / Send Message
    System admin
    So, in an interesting turn of events, I think I'm actually going to go with Javascript based solely on the fact that the resources available seem a little more accessible at this stage. As many have pointed out, it seems that I can make a pretty comfortable switch to another language once I understand the concepts of programming.

    I started the CodeAcademy lessons and I love the way they are presented, I think this is the most ideal way for me to learn. Add to that the fact that the guide Ben linked earlier (ActiveTuts) and the huge range of stuff Digital Tutors have is based on Unity/Javascript and I think it's going to be the best language for me to start with.

    Whilst I've no doubt that C# would be more appropriate and useful for game development in the long run, I'm concerned that a lot of the resources are Windows based, and there's not a whole lot of Unity specific info on C# which is aimed at beginners. I do intend to make the jump at some stage though, just later on when I understand programming enough to recognize the differences between C#/Javascript.
  • rooster
    Options
    Offline / Send Message
    rooster mod
    In case it's of interest btw, I don't know any traditional coding- everything I've ever done has been using node based programming, in quest3d and now unity/antares universe.

    Doing it the regular way is bound to be the best way to learn, but for me I tried a few times and bounced straight off it. I can't stand reams of text. Node based lets you code in a visual way- but, since I'm using a product like antares it puts me at the mercy of the designers of that product. Still- I love it as a work method.
  • System
    Options
    Offline / Send Message
    System admin
    Ah thanks for the comment Rooster. I'm glad to hear from you since I love what you've done with Pineapple Smash Bros.

    I must admit, I'm not sure why I haven't given node-based/visual coding a good look because really it would make perfect sense. I suppose I'm just not familiar with the shortcomings (if any) in comparison to writing code.

    Obviously knowing how to write code has much further reaching benefits, but I suppose since I have no intention of ever becoming a programmer by profession, and simply want to make games for fun, maybe node-based scripting would be a better route.
  • jerry
    Options
    Offline / Send Message
    TeeJay wrote: »
    So, in an interesting turn of events, I think I'm actually going to go with Javascript based solely on the fact that the resources available seem a little more accessible at this stage. As many have pointed out, it seems that I can make a pretty comfortable switch to another language once I understand the concepts of programming.

    I started the CodeAcademy lessons and I love the way they are presented, I think this is the most ideal way for me to learn. Add to that the fact that the guide Ben linked earlier (ActiveTuts) and the huge range of stuff Digital Tutors have is based on Unity/Javascript and I think it's going to be the best language for me to start with.

    Whilst I've no doubt that C# would be more appropriate and useful for game development in the long run, I'm concerned that a lot of the resources are Windows based, and there's not a whole lot of Unity specific info on C# which is aimed at beginners. I do intend to make the jump at some stage though, just later on when I understand programming enough to recognize the differences between C#/Javascript.

    I think this is a good choice. In the context of using it within Unity3D it's probably the best way to start.

    I know that the resources for C# in combination with Unity aren't great and It's good that you bring that up again. I've had a tutorial in the works for a while and I'll be picking that up again because this gap should not exist.

    @Rooster, programming is a means to an end and your work absolutely proves it's not the only valid way to create awesome stuff. Keep rockin!
  • laapsaap
    Options
    Offline / Send Message
    In Unity c# and unity script are pretty much the same. I convert most scripts from C# to unity script and the other way around, line by line.

    I think Unity Script is easier to pick up compared to C#.
  • WarrenM
    Options
    Offline / Send Message
    He doesn't even know how to code yet and your friend is recommending he focus on IK and spring physics? Good lord... I agree that the stuff he mentioned is great for making games but, geez, let's walk before we run.
  • Fomori
    Options
    Offline / Send Message
    Fomori polycounter lvl 12
    Loads of great info. Excellent thread.

    I'm in the same situation in that I want to make my own little games and have been looking where to start. Going to have a go at those node based editors for Unity. I also looked at Flash based software for making games like Stencyl http://www.stencyl.com/

    I've also spent a few days experimenting with Processing (http://www.processing.org/), which is a language similar to Java, but it's a very visual way to learn Java. Lots of cool tutorials for that: http://funprogramming.org/

    Long road ahead. Difficult to balance it with working on my 3D arts as well.
  • System
    Options
    Offline / Send Message
    System admin
    Man CodeAcademy is amazing. I got stuck into the Javascript lessons earlier and it's really well taught, instant feedback too!

    I covered basic syntax, operators, if/else and loops. I actually got into it better than I'd thought. I used to be pretty well-versed in HTML/CSS so I'm used to writing structured code and once I picked up the way it should be written, I really enjoyed experimenting a bit outside of what the lesson exercise taught.
  • Kwramm
    Options
    Offline / Send Message
    Kwramm interpolator
    Some specific things a programmer friend of mine recommends familiarizing yourself with:

    • How v-table/RTTI works (check out "more effective C++")
    • Inverse Kinematics
    • "Spring" physics equation (spring is the simplest starting point of physics)
    • How to find the distance between a point and a plane or intersecting point between a plane and a segment line
    • The characteristics of OrthoNormal rotation matrix
    • How to move coordination system from A to B; eg: from tangent to world
    • The characteristics of cross/dot product and quaternion (the length of cross-product vector, Conjugation of quaternion, rotation with quaternion)
    • Barycentric in triangle
    • A* path finding
    • BSP-tree, Octree, kD-tree
    • Phong shading (how to find reflection vector, how to calculate diffuse/specular)

    Sounds like something you want to look into when you want to write your own 3D engine or shaders or rigging tools or Maya plugins. There's some advanced stuff and math in that list.
    I feel a lot of it is not needed for a newbie trying to mess around with Unity though - Unity takes care of a lot of this for you. If you want to program a simple 2D game (e.g. with pyGame or C++/SDL) you won't need it either.
  • DrunkShaman
    Options
    Offline / Send Message
    DrunkShaman polycounter lvl 14
    iniside wrote: »
    Python is not good for beginner. Solely because is dynamic typed langue, and can learn bad habits.
    It's better to learn from beginning that integer is in fact different from string.
    Other than that, there is not much difference between languages, and most apparent whether is strongly or dynamic typed. I recommend starting from the first one. Main difference are default libraries for language.

    Absolutely not. Books for beginners are waste of money.
    Your main friend is:
    1. MSDN. http://msdn.microsoft.com/en-us/ms348103.aspx
    2. Stackoverflow. http://stackoverflow.com/
    3. http://www.codeguru.com/
    4. Various .NET developers blogs. You will find them as you progress.

    Really!! Why didnt I meet you 8 years ago, you could've saved me alot of college tuition fees and book fees. :(

    I think I also said that those sites such as MSDN, Dreamincode.net, etc will work for him if he has any idea (remotely) how programming works.

    To the OP: Use whatever method you prefer.

    gray wrote: »
    when ever i see this sort of advice i think to myself, really? no books? just jumping around on websites and copying bits of code smashing something together that runs without understanding the overall language concepts and philosophy? it makes me think there are a lot of people who can write code but don't really get the full scope of a language and the structure or design. they write books to give you a detailed over view of the 'full' language. show you how to use all of the features and give you lots of examples to help you along with the syntax and semantics. then you can use it as a reference. web tutorials don't go into that depth. and forums definitely don't. especially at the introduction level books are the best resource and have the most information. i did a search on amazon for c# and get pages and pages of books. they publish these for a reason. if your going to take the time to learn a language i think would be wise to buy at least one or two books. you can always look around on the net for info also.

    also if you want to learn more advanced programming techniques with data structures and algorithms you absolutely have to get books. there is no way you can just surf the net and pick that stuff up. so you might as well get in the habit from the beginning.

    as an example, i learned c mainly from 'K&R Kernigham & Ritchie' which is probably one of the most famous programming books ever. and then learned c++ from 'C++ Primer 4ed Lippman & Moo'. which is also a recommended book. and i can tell you that without theses book i would be totally lost and have probubly given up entirely.

    can someone recommend a similar high quality book for C#?

    lol ya I learned C# 2.0 with this old book that I even forgot the name of, and lost it. I bought this book for the review and since its C# 4.0 now. I preferred books because they explain what the line of code do and where one should use it.

    Same thing goes for C, C++, Java, HTML, XML, WML, ASP.NET, Oracle and so on.

    Thank god I didnt state how many math books I have and how many game programming books and so on.

    You cant find everything online but its all about self pref. Many people dont require the entire intel before jumping in to coding the game, others want to know, thoroughly what they are jumping in to.
  • arrangemonk
    Options
    Offline / Send Message
    arrangemonk polycounter lvl 15
    http://programming-motherfucker.com/

    also,
    dont listen to what Nite says (even if it has value), i saw his code XD

    and msdn usually only makes me angry
    most of the time i find my answers in stackoverflow or thecodeproject

    And c++ isnt really the language one should begin with.
    not because of its complexity, but the frustration you get when it does not build, and it doesnt build most of the time. especially project examples you download somewhere
  • System
    Options
    Offline / Send Message
    System admin
    I think I'm stuck already. CodeAcademy seems to miss something, or I'm missing something;

    In the 'Functions' section talking about the Return function, it has a section saying 'Let's focus on two things we've learned, Arrays and Loops'... except I haven't covered Arrays?!!

    Not sure if this link will work if you're not signed in, but here goes:

    http://www.codecademy.com/courses/functions-in-javascript-2-0?curriculum_id=4f4b35445cb288000300000c

    Section 3-5
  • DrunkShaman
    Options
    Offline / Send Message
    DrunkShaman polycounter lvl 14
    http://programming-motherfucker.com/

    also,
    dont listen to what Nite says (even if it has value), i saw his code XD

    and msdn usually only makes me angry
    most of the time i find my answers in stackoverflow or thecodeproject

    And c++ isnt really the language one should begin with.
    not because of its complexity, but the frustration you get when it does not build, and it doesnt build most of the time. especially project examples you download somewhere

    A person who makes the code on the fly should be the very last person to umm..Give him (the OP,) any sort of advice. You've dodged a bullet and the wall text there sir Zeus Konrad. My coding is just fine. Its the after math (if any) takes me like 5-6 hours and I really hate it if that. (and sorry I asked your help this one time 2 years ago.) :p

    Think from the starters point of view mate. You may hate msdn right now but you were using it before along with other websites to find the proper reference. You need to learn how to read the code and understand it before you look for the ref code blocks and find the right ones.

    Then again, like I said before; Its all about self pref.

    TeeJay wrote: »
    I think I'm stuck already. CodeAcademy seems to miss something, or I'm missing something;

    In the 'Functions' section talking about the Return function, it has a section saying 'Let's focus on two things we've learned, Arrays and Loops'... except I haven't covered Arrays?!!

    Not sure if this link will work if you're not signed in, but here goes:

    http://www.codecademy.com/courses/functions-in-javascript-2-0?curriculum_id=4f4b35445cb288000300000c

    Section 3-5

    you are way far ahead of yourself sir. You need to specify which code language you are about to learn before I post the right links.

    If you are sticking to C#: Here is the code block for For loop and Arrays:

    http://www.dotnetperls.com/loop-string-array

    You have to learn the conditional statements before this, because there is ForEach, for, If else, If, Do, Do While, and then arrays: arrays and String Arrays.

    For Java:

    http://stackoverflow.com/questions/3010840/loop-through-array-in-javascript

    You still need to learn the conditional statements and how array works.
  • Joseph Silverman
    Options
    Offline / Send Message
    Joseph Silverman polycounter lvl 17
    TeeJay wrote: »
    I think I'm stuck already. CodeAcademy seems to miss something, or I'm missing something;

    In the 'Functions' section talking about the Return function, it has a section saying 'Let's focus on two things we've learned, Arrays and Loops'... except I haven't covered Arrays?!!

    Not sure if this link will work if you're not signed in, but here goes:

    http://www.codecademy.com/courses/functions-in-javascript-2-0?curriculum_id=4f4b35445cb288000300000c

    Section 3-5

    Yeah teejay looks like they havent taught you about arrays yet. You can learn about them here if you're curious:

    https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array

    Arrays are pretty simple to conceptualize: They're a type of object that contains a series of variables, which are assigned position 0, 1, 2, 3, 4, etc. in the array. There are a number of methods you can call from arrays, and it holds some info such as "[array name].length", which returns the number of entries in the array.

    In 3-5 you dont really to worry about arrays much at all to solve it!
    You're not going to be touching any code that operates on or reads anything from the array.
  • jerry
    Options
    Offline / Send Message
    I don't particularly like what i'm seeing on that site but whatever. Let me give it a shot:

    An array is essentially a variable that can hold more than one value. It does this by storing each value in sequence.

    Maybe you could equate it to a shopping list, you write down what you need:
    -milk
    -eggs
    -bread
    -carrots
    -sugar

    So, here also, sequence matters. Milk is the first item on the list and sugar is the last, this is important to note.

    If you want to save information like this in javascript you declare it like this:
    //note: this array contains strings, the names of the items.
    var myShoppingList = ["milk", "eggs", "bread", "carrots", "sugar"];
    
    //another way:
    var myOtherShoppingList = []; //empty
    
    myOtherShoppingList.push("milk");
    myOtherShoppingList.push("eggs");
    myOtherShoppingList.push("bread");
    myOtherShoppingList.push("carrots");
    myOtherShoppingList.push("sugar");
    
    //Both lists now contain identical items, in identical order.
    

    Clearly an array (list) is only useful when you can read the contents.

    One way of doing that is by asking it questions:
    //What is the value of the first item in the array? (First item is at position 0)
    var theFirstValue = myShoppingList[0];
    //theFirstValue now contains "milk"
    
    //Another question:
    //What is the value of the 31st item in the array?
    var theFirstValue = myShoppingList[30];
    //Now, it should be clear that this won't work. we only have 5 things stored in our array.
    

    So, what you might want to do instead is ask another question: What is the value of every item that the array contains? This means you will never ask for an item that does not exist, which is great.
    Now this is where you use a for-loop.
    //You can translate a for-loop to english like this:
    //"for each item in the list, what is the value?"
    //So the syntax for this is:
    
    for (x in myShoppingList)
    {
     //prints the item on the list
     console.log(myShoppingList[x]);
    }
    
    //Output of this will be:
    //milk
    //eggs
    //bread
    //carrots
    //sugar
    
    //Note that the order did not change.
    
    //Another way, which carries over to pretty much every programming language:
    for (var i = 0; i < myShoppingList.length; ++i)
    {
     console.log(myShoppingList[i]);
    }
    //Output is exactly the same.
    

    more info:
    http://www.w3schools.com/js/js_obj_array.asp
    http://www.w3schools.com/js/js_loop_for.asp
    http://www.w3schools.com/js/js_loop_for_in.asp

    Hope that helps.
  • Kwramm
    Options
    Offline / Send Message
    Kwramm interpolator

    not because of its complexity, but the frustration you get when it does not build, and it doesnt build most of the time. especially project examples you download somewhere


    haha true. Although it's not a bad feature. The compiler makes sure that your syntax and types work.

    In Python or JS you have to wait till the code execution is at the faulty point and then the program stops, unless you catch the exception. It just gives you the illusion that it's less frustrating than C++ but it really isn't. C++ throws the errors right in your face at the beginning.... Python does its sneak attack later when you feel safe ;)
  • Joseph Silverman
    Options
    Offline / Send Message
    Joseph Silverman polycounter lvl 17
    ALSO, I shouldve linked this a while ago -- stanford school of engineering offers youtube lectures from their 3 intro to programming courses. Java and C++ covered.

    http://see.stanford.edu/see/courses.aspx

    [ame="http://www.youtube.com/watch?v=KkMDCCdjyW8&quot;]www.youtube.com/watch?v=KkMDCCdjyW8[/ame]
  • Gestalt
    Options
    Offline / Send Message
    Gestalt polycounter lvl 11
    I don't know about for Unity, but arrays are used all the time and are super useful for tons of stuff (they're sort of a core concept and very powerful/(I'd say essential) so I wouldn't skip over them. If you want to store more than one related value of something, iterate through data, organize a basic data structure, get a nice range of values, count the number of something, lots of random stuff, you could/would use arrays.

    I need to update, I decided to go through C++ last night and it isn't nearly as difficult as I remembered (I tried to learn it a long ago as my first language which is probably why I have a bitter memory of it). If you go through Udacity's python courses you should have a solid enough foundation to not get overwhelmed, and if you know something like java then it's pretty straight-forward. In terms of difficulty I still stand by python>javascript>C#>C++ but If you know any language and have experience with the fundamentals you should be ok.
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    Arrays are awesome. Searching through them is even more fun.

    foreach(Item thing in ShoppingList)
    (
    console.log(thing);
    }

    //Will come out the same like above.
  • System
    Options
    Offline / Send Message
    System admin
    Ok thanks guys, I figured out that exercise I was stuck on. Turns out arrays are covered later anyway, I get the concept though.

    This one's got me baffled though, I got the program running (calculates the power, returns true/false), but I can't get my head around part of it (bold part), it makes no sense.
    var [COLOR="Yellow"]power[/COLOR] = function(base, exponent){
    if (exponent === 0) {
    return 1;}
    [SIZE="4"][B]return (base * [COLOR="yellow"]power[/COLOR](base, exponent-1));[/B] ????[/SIZE]
    };
    
    console.log(power (2,2) === 4);
    

    How is power defined when it is called inside a function definition? I'm so confused right now.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    thats a recursive function... and its making my brain hurt looking at it.

    recursion is when a function calls itself usually to handle nested tasks like searches or math functions.
  • Spacey
    Options
    Offline / Send Message
    Spacey polycounter lvl 18
    Codecademy must be playing with their lesson structure right now, because I don't remember going through such tough ideas so early.

    Math.pow is essentially what you're creating, but what they are trying to teach you is the concept of recusion. Recusion is calling a function inside itself. I think one of the better and simplier examples of this is with factorials. If you go through the recusion lesson you'll have a better grasp of it.

    http://www.codecademy.com/courses/javascript-lesson-205?curriculum_id=4f4b35445cb288000300000c
  • System
    Options
    Offline / Send Message
    System admin
    Cheers guys, glad I'm not just being dumb.

    Spacey - Yeah there's been a few queries on their forums by the looks of things, and they've said they're rearranging things. I think the 'Codeyear' course is in one order, and the Javascript course is in another, but they got mixed up.

    Yeah this is some heavy math stuff, I'm struggling more with the math than I am with the programming concepts. I always thought I was ok with math, up until I started learning this stuff.

    Just out of interest, how much of this kind of math related stuff is involved in coding for games (basic) games? I feel like I should be brushing up on my maths skills too if it's going to be this complex.

    Also, CodeAcademy is starting to get frustrating with the screwy order. I've just tried the Codeyear lessons and they're also completely jacked up, referring to topics that haven't been covered.

    Has anyone got any experience with this http://eloquentjavascript.net/? Looks pretty comprehensive. Probably not as fun as Codeacademy, but the fun can come later.
  • Justin Meisse
    Options
    Offline / Send Message
    Justin Meisse polycounter lvl 18
    Rooster: does that node based programming tool for unity spit out code? I was thinking about using it to prototype some things and eventually team up or hire a programmer to polish it. I was lamenting how I could never get a hang of programming last night but I realized it's because I don't enjoy doing it.
  • rooster
    Options
    Offline / Send Message
    rooster mod
    Justin: naw, not really- uScript *technically* can export code I think, but I hear it's not really unusable by a normal human :)

    I still think you should give it a look, if you 'bounced off' regular coding like me. I should be clear though, there's still a steep learning curve so it's important to stick to it through the early stages- everything you do is still programming so the logic needs to be right
  • Gestalt
    Options
    Offline / Send Message
    Gestalt polycounter lvl 11
    TeeJay wrote: »
    Just out of interest, how much of this kind of math related stuff is involved in coding for games (basic) games? I feel like I should be brushing up on my maths skills too if it's going to be this complex.

    Depends what you're doing, but math is pretty much how everything works. You'll want to be familiar with vector math and linear algebra(more so if you are getting technical), but you can learn and freshen up on things as you go for the most part. Most of the learning material I've seen has been pretty good with either summing up the math involved or clearly stating what you'd need to look into. For scripting I'm assuming that you won't need too much more than vector math but then again I'm not too familiar with Unity.
  • Kwramm
    Options
    Offline / Send Message
    Kwramm interpolator
    TeeJay wrote: »
    Yeah this is some heavy math stuff, I'm struggling more with the math than I am with the programming concepts. I always thought I was ok with math, up until I started learning this stuff.

    very little to a lot. All depends on the game, the language/engine and what you want to do.

    If you just write game logic, you will need less math than when writing an engine to handle gfx code (unless you write a RPG with complex math based rules, or you write some clever AI system (but that's more algorithms than formula based math)). Example: writing a 3D game in Unity requires less math understanding than writing a game in Python using OpenGL.

    Rendering and Lighting may be handled by the engine - little math here (e.g. in Unity). If you do it yourself: tons and tons of math.

    Writing shaders - for this you should understand math. Or you use default or 3rd party shaders (free or Unity store) and get around this.

    Physics may be handled by the engine - if you write it yourself, it's very math heavy!

    Some engines / libraries offer convenience functions that do the math for you. You still have to understand WHAT the function does, but you don't necessarily have to understand HOW the function does the calculation inside (e.g. there's functions in unity how to do hit checks in 3D space - no need to know what's going on exactly inside that function)

    (you should see by now why Unity is so popular ;) )

    Having said that, it is entirely possible to write a simple game (especially a 2D one) with just basic math knowledge.
  • System
    Options
    Offline / Send Message
    System admin
    Ok thanks guys.

    I'm gonna jump into Unity soon I think so I can actually apply some of what I've learned so far. I think actually seeing the code in action will help me understand it better.

    For now, I'm planning to stay inside an engine so all of the more complex stuff will be handled hopefully, but if all goes well then I may continue to explore the more difficult topics.
  • arrangemonk
    Options
    Offline / Send Message
    arrangemonk polycounter lvl 15
    Kwramm wrote: »
    haha true. Although it's not a bad feature. The compiler makes sure that your syntax and types work.

    In Python or JS you have to wait till the code execution is at the faulty point and then the program stops, unless you catch the exception. It just gives you the illusion that it's less frustrating than C++ but it really isn't. C++ throws the errors right in your face at the beginning.... Python does its sneak attack later when you feel safe ;)

    i didnt mean compiler erros, but linker erros, because of weird references to libraries you dont have installed, (for example, try downloading doom3 source, and build-> never works the first time )
  • Kwramm
    Options
    Offline / Send Message
    Kwramm interpolator
    i didnt mean compiler erros, but linker erros, because of weird references to libraries you dont have installed, (for example, try downloading doom3 source, and build-> never works the first time )

    that's true. C++ can be pretty tough, especially when you're using different compilers, different linking options and what not or get version 1.0.1b3.rc1 of the library and the program only works with 1.0.0a3.alpha1whatever of some library.

    C++ is probably the worst, but 3rd party dependencies can be annoying in any language.
  • System
    Options
    Offline / Send Message
    System admin
    I was lamenting how I could never get a hang of programming last night but I realized it's because I don't enjoy doing it.

    Ok so I'm feeling like this now.

    Coding bores me to tears already, I can't even seem to focus on it since the script just becomes a jumble of crap.

    I tried out the free version of Antares Universe... now we're talking. Admittedly I only made a sphere to move with the mouse, but that's further than I got with coding by hand.


    So now in a complete U-turn, I'm gonna forget coding and just go the visual route, it clicks with me much more than typing code.

    I noticed there's another visual tool called 'uScript', is anyone using that? How does it compare to Universe? There's no trial unfortunately, so I may stick with Universe.

    My biggest question though (mainly to you, Rooster) is learning Universe, are there any good guides/tuts to get started with it?
  • PhattyEwok
    Options
    Offline / Send Message
    PhattyEwok polycounter lvl 9
    Remember what that first few weeks of a 3d package was like (at least for me) it was terribly boring using primitives and learning the basics. Eventually 3d wasn't about learning the software but using it to make cool stuff.

    Programming is the same way. Its gonna take awhile to learn the logic and syntax behind it before your able to delve into the fun stuff.
  • System
    Options
    Offline / Send Message
    System admin
    Yeah I see your point. I just feel like right now I can't see the connection between the basic stuff I'm learning and the kind of stuff used in games coding.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    TeeJay wrote: »
    Yeah I see your point. I just feel like right now I can't see the connection between the basic stuff I'm learning and the kind of stuff used in games coding.

    I think I see where you're coming from. Back in high school we were doing ode programs for math equations which totally threw off programming for me. Just remember that again its baby steps. Maybe once you're down with the basics like arrays, variables, functions etc dive into a tutorial (digital tutors has some stuff on Unity or follow some free tutorials). Once you understand the core essentials start dissecting people's code,,projects etc. Knowledge just comes with time :)
2
Sign In or Register to comment.