Search Unity

Feedback I am starting my second game ever, how do I start remembering the code I write?

Discussion in 'General Discussion' started by polymacin29, Jan 25, 2021.

  1. polymacin29

    polymacin29

    Joined:
    Jan 25, 2021
    Posts:
    1
    So I finnished my first game and I don't remember anything of the code I was just copying tutorials. What is the best way to start learning the code, should I make a whole game or just practise moving or shooting on smaller games? And is there like the best script for moving and shooting or do you just pick which is best for you? SHAREit
     
    Last edited: Jan 26, 2021
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Well try making something without copying tutorials. Thats how you learn. Try making a small game on your own, everytime you get stuck look up help for that one particular problem, but only after trying to tackle it on your own first. Over time you will learn properly. Dont use a "complete" tutorial to find the help either (i.e. if you are making an RPG dont find a complete RPG tutorial and then keep coming back when stuck, use different resources to increase variety of code you come across - as its likely each tutorial will teach you some good stuff but also some bad too so its good to ensure you are not learning from a single source).

    If you are not just copying, you wont have to ask this question as you will naturally learn it. Think back to how you learn stuff at school, its not just all copying you have to do some of your own learning and exercises too.
     
    Socrates, Vryken, JoNax97 and 2 others like this.
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Design yourself a simple game.

    Break your design down into "problems", eg: "I need a character controller that does X, Y and Z."

    Break those problems down into smaller, easier problems, eg: "I the character needs to move based on player input."

    Keep repeating that, splitting the problems into smaller ones until you can solve them. Eg: "I need to get input... which I can do by setting up an axis and calling Input.GetAxis(...) in my code."
    "I need to move... which I can do by attaching a CharacterController and calling... hmm... I need to check the docs to find out."

    Implement the solutions you come up with, and you're on your way.



    By the way, you won't remember all of your code. I sure don't. It's not really a problem as long as things are logical. Give things descriptive names. When it's not obvious why you're doing something, add a comment. Get familiar with OO programming principles and stick to them (for now). And take the time to keep your code tidy and readable - it really helps. With that stuff and practise it won't be an issue when you can't remember your code, it'll make sense when you come back anyway.
     
    Socrates, Vryken and JoNax97 like this.
  4. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Also to add to this, once you break the problem down into small enough parts - it becomes easy to seek help as your questions become very direct.

    So instead of asking things like "how can I make a character controller like assasins creed" your questions break down into things like "how do I get input from X button" or "how do I have my character animation place its hands on a wall while it jumps over it?" etc.

    Which in turn means you will learn faster as when you seek help, its easier to get good quality help :)

    As mentioned above, you wont ever remember all the code, but you will slowly remember individual commands in the API and that will be enough. I dont remember all the overloads of Physics.Raycast, but I know what Physics.Raycast does and that allows me to quickly look up when I need more specific info about it, otherwise I am able to get by with just that knowledge + intellisense. Good luck OP!
     
    angrypenguin likes this.
  5. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    don't worry about it.

    just make another and the less you are doing from tutorials and more you are doing figuring out on your own you'll just magically start remembering.
     
    Kiwasi likes this.
  6. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    You should stop copying tutorials and start writing your own stuff, because if you copy-paste, then you learn nothing. Code in tutorials does not exist. Start writing your own game with this mindset.
     
  7. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If you copy the code, the best you can hope for is you remember where you copied it from. If you write the code you're more likely to remember the process of writing it.
     
  8. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    Copying tutorials is fine if you try to understand what you are copying. It is a lot easier than trying to start from scratch on your own. You will soon learn more when you have to correct any mistakes, which is likely to happen.

    But don't keep doing tutorials forever (I did 2 when I started). The next step is to start modifying what you have done in the tutorials. Make something new happen. This way you will have to learn more, but in smaller bites.

    When you get a bit comfortable, try something on your own. When I was learning, I used to pick something interesting sounding from the Scripting API documentation and make something simple using it.

    Trying to do everything without tutorials is fine for some, but an almost certain path to getting frustrated and moving onto something else for others. Do what works for you, but don't stand still.