Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to deal with problems and chosing the right project next ?

Discussion in 'Getting Started' started by Shamlei, Jan 17, 2016.

  1. Shamlei

    Shamlei

    Joined:
    Jan 17, 2016
    Posts:
    10
    Hey everyone i'm new to Unity3D, game making and C# as well.
    I took up course on C# on udemy and i think i unterstood all the basic / intermediate concepts of the language and a bit of the advanced stuff.
    So far i've downloaded Unity and made a Pong clone game.
    Now i'm actually trying to make a Snake clone but i struggle with correctly spawning the body parts and making it follow the head.
    So my questions are :
    -How do you react when facing a coding problem ?
    -Is making a snake clone a good idea ? Should i go directly to 3D after that or stick to 2D for a bit ? (Obviously if i still have problem with doing snake i think i need to fix it before moving on.)

    I'm looking for expertise, I want to be a good programmer, not someone who runs to youtube videos / forums anytime he encounters a problem, so I would like to know what's the best way to become this.
    Thanks for answers and sorry if this was already asked.
     
  2. Farelle

    Farelle

    Joined:
    Feb 20, 2015
    Posts:
    504
    -How do you react when facing a coding problem ?

    1. I try to solve it by testing out things that I think could maybe work(with help of docs etc.), quite often I try several approaches until I find something that works, if not:
    2. google for possible solutions/for the thing I want to solve(tutorials, quora etc.)
    3. find similar problems/solutions and try to adapt them to my project.
    4. ask someone I know personally who knows that stuff or ask on specific forums, like here (so far I never got to this point, because I found solutions before that)

    not sure about the clone thing though...I think it doesn't matter so much that you make a clone of something (and I find it rather boring) than that you do something really simple that somewhat pushes you to get better but at the same time doesn't frustrate you so much that you simply want to give up after weeks of no progress.
    Personally I think it's good to try to think of small own projects, where you concentrate on just ONE game mechanic and try to make it as good as possible and then try to finish the game with everything that belongs to it from menus to sounds, music etc.
    And the reasons are several and simple.
    A finished game is something that you can proudly show to others and feel good about yourself.
    Something finished is also taking away the fear of finishing something.
    It helps to get a good understanding of the whole process! Maybe even publishing, if you feel brave enough for eventual critique.
    One mechanic might sound too small, but it can be very challenging to stay simple, but it's very important to be able to know how to focus on improving just ONE thing.
    more time spend in not just running into walls and giving the feeling of actual progress.

    Also since you can work with unity, I don't think that 2D or 3D is making much of a difference. I worked with both and I can say that 2D feels in some ways more comfortable for me because I have a strong background in drawing/arts, but I prefer games in 3D just because of them feeling more "free" to me in terms of movement etc.
     
  3. Shamlei

    Shamlei

    Joined:
    Jan 17, 2016
    Posts:
    10
    Thanks for your reply :) !
    About the problem solving part, aren't you afraid that you won't be able to do anything on your own if you rely on the internet ? That's my major concern personally, and that's why i'm so hesitant towards searching for solutions online.
    What are your thoughts on that ?
     
  4. Farelle

    Farelle

    Joined:
    Feb 20, 2015
    Posts:
    504
    the first path IS solving it on my own, by experimenting and trying out, I only need the documentation and stuff for the first step, since I just don't have all the functions bells and whistles that unity uses and C# has in the top of my head ;D that sounds like an insane task to remember all that.
    I think I can relate to the thought of "doing it on my own" though, I had that troubling thoughts for years keeping me from actually doing programming, thinking that I need to be able to program without checking up on code "vocabulary" , because I perceived it as cheating, but you don't expect a child to be able to speak in whole grammatically correct sentences when they start speaking for the first time either or?:)

    If you start out with programming or are new to it(but even if you are experienced) you will always come to a point where you might need help and searching and finding solutions that work for you is one way of learning and in the future you might not need to look it up anymore, but for now it might be better to rely on the support you can get, by using the internet as a tool to help you overcome those first barriers in the process of learning programming (believe me, it's hard enough even WITH the internet, because you still need to filter through all the crap and still need to make it work with rest of your code).

    And just to tickle braincells a little more :D:
    at what point, do you consider something to be done on your own?
    what expectation(s) do you have on yourself?
     
  5. Shamlei

    Shamlei

    Joined:
    Jan 17, 2016
    Posts:
    10
    Well first i consider that looking for documentation is not "cheating" what i would refer as "cheating" is actually asking to others about how to solve your problem and that's what i'm afraid of doing since i think it is detrimental to you in the long run (Do you think it is ?). But yeah checking documentation is required and not really a problem since you USE that to make something on your own imo.
    When i say doing something on your own I mean that you had a problem and you came up with the solution (Logic of the solution and the coding implementation) alone.
    My expectations are pretty high i think, I want to be a good programmer to make my ideas come true and I want to be able to do that without asking for help everytime.
     
  6. Farelle

    Farelle

    Joined:
    Feb 20, 2015
    Posts:
    504
    yes, I think it's detrimental to ask for help, specially when one is stuck on a problem too long and starts to notice first signs of wanting to give it up completely. Personally I keep it as my last option though to actually ask for help (like I said, I try it first on my own). I also have very high expectations of myself and I definitely also need to learn a bit more about actually asking for help. The only thing I can tell you though is, that everyone started somewhere and in order to become as good as you want to be, you won't get around asking questions. Questions are also a very good way of learning. Not sure what else I can say :) I'm not a "senior" programmer myself and I still have alot to learn also, but I noticed a huge relief the moment I got less afraid of asking questions if I really get stuck. It's like a safety net from giving up.
    It's also still not said that someone can come up with a solution for you, even if you ask, so you might end up finding the solution yourself anyway. Not to mention that there might be problems you encounter that have nothing to do with your programming abilities, but might be an engine issue or something else out of your control. So asking can prevent alot of headaches too!
     
  7. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    If you were at school & didn't know how to do something would you think it was cheating to ask a teacher, a friend or to go to the library to look up reference books? I wouldn't because that's how I learnt way back in prehistoric times (probably given away by saying library instead of Google).
    I find the best way to learn is to try to work it out myself but to then try & find a solution myself by research which is basically what @Farelle is saying, noting of course that there is a difference between finding someone that has worked out a similar problem & then adapting their solution to your specific game & just blindly copying someone's code & using it without understanding what they did or how/why.

    As for making snake, I did a 3D version 2yrs ago in class & we modified it to be a multiplication solving game. That provided interesting problems with for & while loops to ensure the same answers weren't shown all the time & that answers weren't spawned to close to each other causing them to overlap & be hard to read. I struggled with the movement as well so without giving you code I will tell you how I did it & you can experiment.

    Note that every prefab except the walls was a 1-unit sphere, so the tees (that's what I called the objects) & the snakes body segments were 1-unit so just brushing past them triggered a collision. I wanted the visual look of them being that close so I simply shrunk the colliders in to 0.75.

    Ok, movement. I struggled to get that nice vertical/horizontal movement like the original as following just caused it to start curving. Eventually I made a list of the body segments that could expand & shrink as needed for my game. I removed the last segment on the list, moved it 1unit in front of the 1st segment, inserted it into the list. Because this was essentially using instantiating & destroy there was no movement into colliders, the body segment just instantiating directly into it (keeping all objects 1-unit meant that the movement of vector3.forward etc was a lot more exact). I realise now that pooling would have been better but the game was so simple there were no performance issues to worry about..

    Anyway, hope that gives you something to consider. Good luck.
     
    Farelle likes this.
  8. Shamlei

    Shamlei

    Joined:
    Jan 17, 2016
    Posts:
    10
    Thanks for your answer, but if you're trying to solve an equation and struggle there's nothing wrong with checking on how to solve any equation (Looking for references / Documentation) to help you solve it, but asking someone to specifically solve your equation won't help you learn from it, that's what i was talking about.

    Thanks for the help for the snake game ! I'm going forward even if I struggle and this will definetely help me.
     
  9. Farelle

    Farelle

    Joined:
    Feb 20, 2015
    Posts:
    504
    this video has also some advice regarding approaching problems and getting help from others
     
    JoeStrout likes this.
  10. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,510
    I think this is a simple matter of not BSing yourself. There's a big difference between asking someone to help you solve an equation and just copying their answer.

    Many companies have their junior developers team up with senior devs as sort of a mentoring system. Reading code and adapting patterns and styles from experienced programmers is one of the best ways to learn, and is in no way considered cheating or short-cutting. Asking questions about parts you don't understand, experimenting and reading documentation... These are all viable methods of learning and growing.

    What you shouldn't do is copy-and-paste answers you find, implementing them without understanding what they really do. You shouldn't take advice blindly (back when I used UnityScript, I would always see "delete '#pragma strict' from the top of your script" as advice on removing errors), and you should never assume you know enough about any given topic.
     
    Ryiah likes this.
  11. Shamlei

    Shamlei

    Joined:
    Jan 17, 2016
    Posts:
    10
    Yeah I understand what you all mean now I guess.
    But do you have any idea / advice on how to get better at writing "clean code", everytime i'm writing a script the very next day i can't figure out what i was exactly doing and where did i left out and I need to waste several minutes to "get back in it".
    I think that my code is very messy because i don't use the best practices everytime I really want to become better but I don't know what to do other than trial and error, I think I should try to make a project and see how a real good programmer did it so I can see what I can improve in my coding practices.

    Do you know any place where I can find source codes of Unity Games made by "good" programmers ?

    Thanks for your answer it's really helping !
     
  12. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,510
    There's no shortcut to experience. You have to write a ton of crappy code before you can write good stuff. Even then, as you improve you'll constantly look back at stuff you wrote a month ago and think how terrible it is. That's the nature of improving a skill.

    Don't worry about clean, elegant code yet. Just write stuff that works. Make anything and see it through to completion. When you're done, then you can go back through and refactor it if you want. Or just start a new project and use what you learn to do things differently.

    Getting caught up on only doing things the "right" way is a sure way to never do anything.
     
    Farelle likes this.
  13. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    Comment it so you know what you were doing with each bit but also so others looking at your code can see what you were trying to do. Then if you think it could be done better post it up & ask for constructive suggestions. You might get some, you might not, but it can't hurt to show you want to learn & have made an attempt.
     
  14. Farelle

    Farelle

    Joined:
    Feb 20, 2015
    Posts:
    504
    agree with Schneider here, you will learn your own methods to make everything look cleaner over time.
    You could compare starting to learn coding like moving into a new Apartment/house and now you have boxes standing around everywhere. It's likely it will be messy for quite some time and you don't know yet where you want everything to go and stay. You will probably unbox one box after another, maybe buy some furniture and then you go and find places and try out what fits for you. It's the same for coding, you just try out things, learn what you feel most comfortable with, learn which scripts in a game should be closer to each other (as example name wise) or which ones should be clearer distinguishable.

    I hope that made any sense. I just learned coding "quite" recently also and I was also afraid of it getting messy...well for once, it helped me alot to have a separate project going thats just for experimenting, so if I figure out something that works I can implement it more easily into the game, because I know how it works now AND I can think of a more organized way of approaching it now since I don't need to worry so much about making it work anymore.
    Second commenting helps :eek: write comments regularly. I also use comments to help me get back into it again like:"I want to move my character with WASD" so I know where I left of or what I wanted to do next. Those kind of comments should be deleted later though.
    Consistency is also a key to making it more clean, like as example, I have several gameobjects in the scene that are holding my scripts for audio, behaviours etc. it makes sense to give them a recognizable name that displays what theya re for, as example : AudioManager or BehaviourManager.
     
    Schneider21 likes this.
  15. Shamlei

    Shamlei

    Joined:
    Jan 17, 2016
    Posts:
    10
    Ok thanks a lot guys :)