Search Unity

First project in Unity

Discussion in 'General Discussion' started by JPF55, Mar 2, 2015.

  1. JPF55

    JPF55

    Joined:
    Feb 26, 2015
    Posts:
    40
    Hello,
    I have taken a class where we used Unity, and now I want to make my first game app. I don't have much experience in Unity so I am in need of some help. The game is simple the only thing I need to figure out is how to program:
    • Player control: go left, go right
    • Player speed: it is set by which track they are playing
    • Collision: will walls and barriers
    • Traps and Boosts: slow down traps, which slow the players speed, and boost, boost, which speed up the player
    • Tracks: checkpoints, the gates the player goes through, how to stay with in the track, the track is a pipe the player must move within the circle of the track
    • Specials: two unique character physics and maybe a few other things
    All I need is someone who can help teach me the programming. I don't want someone to just do the programming and give it to me. Any help is greatly appreciated. Please message me if you want to help me. Thank you for reading.
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    The getting started section on this forum is a good place to start. Plenty of helpful advice there.

    I would also highly reccomend the learn section. There are complete projects, like Roll A Ball. As well as live training sessions and tutorials on all sorts of topics.
     
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    That's not "one simple thing". That's a list of a bunch of different parts of a non-trivial game. ;)

    The best option for this would be a university, college or online course if you're not interested in teaching yourself. If you are interested in teaching yourself, I hear great things about "The Yellow Book" for C#, which is available online for free.

    When asking questions it's key to be specific. Aside from pointing you towards learning resources and telling you to get started there's not really a lot we can do to help you learn the basics of programming. "How do I program?" is a super broad question, so it'll get a super broad answer. On the other hand, something like "Can anyone suggest a way to implement a checkpoint system on a race track?" could get you fairly specific ideas of how to approach the problem.

    Do stick around and ask those questions, though!
     
    Ryiah likes this.
  4. xxBarginsxx

    xxBarginsxx

    Joined:
    Mar 7, 2014
    Posts:
    68
    Is this gonna be an UnityScript or CSharp?
     
  5. xxBarginsxx

    xxBarginsxx

    Joined:
    Mar 7, 2014
    Posts:
    68
    Really?????? I learned all my skills off of youtube and tutorials, they teach (In my opinion.) as good as a university.
     
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    If you're not going to read whole sentences then it doesn't matter what you're learning from, really. :p;)
     
    Samuel411, Jimmy-P, elmar1028 and 3 others like this.
  7. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,183
    Okay. What do you have to show for it? :p
     
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    That's one of the things I learnt at uni. :)

    Uni is a legitimate option. Its probably the fastest way to climb the ladder. A person with a degree has reasonable proof of their skills. A person without a degree must constantly push their portfolio and experience.

    Not saying its the only option, but it certainly is a good one.
     
  9. xxBarginsxx

    xxBarginsxx

    Joined:
    Mar 7, 2014
    Posts:
    68
    ???? Are you really doing that? You can learn a BUNCH of if tutoring videos such as youtube :p
     
  10. knr_

    knr_

    Joined:
    Nov 17, 2012
    Posts:
    258
    Hi JPF55,

    That is quite a bit of things to cover. While I can't go through all of them, I can suggest a path of exploration (reading documentation and such) to get you on your way.

    First, understand the GameObject / Component model (more commonly referred to as the Entity / Component model). You can create C# classes that derive from a class called MonoBehaviour and put them on game objects in your scene. When you place a C# file (commonly referred to as a script in the world of Unity) onto a game object the logic in those classes are executed on that game object, turning the game object from being nothing into whatever you want the game object to be (based on the scripts you put on it).

    Player Control
    Unity provides some built in classes for character (player) control like a character controller, but if you want to understand it at a lower level and build out that functionality yourself then the first place is to look at is input because input drives moment (usually).

    Inputs work on the concept of events; that is when a key is pressed an event is raised. When that same key is released another event is raised. This is significant because if you want to keep track of a key being down or a key being up you will need to add a flag somewhere when the event for a key being down is raised and then reset the flag when the same key is released (which is crucial for continuous movement).

    To make that a little clearer, if we are working with the W key:

    Press W Key Down and hold -> Raises KeyDown event (W) -> Set flag (bWKeyPressed) to true.

    { in the Update function or anywhere else check to see if bWKeyPressed is true and if so, translate or move the player object left per unit time, usually Time.deltaTime multiplied by a speed value }

    Release W Key -> Raises KeyUp event (W) -> Set flag (bWKeyPressed) to false.

    Once you know that a key is pressed (say the W, A, S or D key) then you can tell the game object that is representing the player to move in a certain direction. This is built upon the concept of vectors. The idea is that you take your player, wherever he is in 3D space, and move that player (based on which keys are pressed or other form of input as you desire) and move that object through the world on a 3D vector per unit time (say, 3 units left, 2 units right and 1 unit forward per one second).

    Collisions
    Unity has quite a few collider components that you can add to game objects in your scene. When you add a collider component (box, sphere, capsule, etc...) if something interacts with that collider it will raise a collision event and an event handler will be called. You can then check what the collider collided with and do what you need from there for your gameplay.

    Looking at the documentation for the three things I mentioned above (input, movement and collisions) should get you far enough to create traps (two or more things colliding together and raising a collision event).

    If the whole track is a pipe and the vehicles are inside it then by using physics / colliders the vehicle won't be able to exit the pipe naturally. No additional coding required.

    Hope this helps. Unity's documentation and their tutorial videos should be able to help you out quite a bit in what you are attempting to do.
     
    Last edited: Mar 3, 2015
    MurDocINC and angrypenguin like this.
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,183
    I have a friend who recently finished his degree in Game Design at the University of Baltimore. I've had discussions with him over the various aspects of his degree but the one that stood out the most was the student projects.

    They have the students form teams and go through the entire process of designing and developing games including prototyping, writing up game design documents, creating the assets, writing the code, etc.

    They do this constantly throughout the entire degree. By the time the students graduate they will have to had to work on every single aspect of game development regardless of their skill at it.
     
    elmar1028 likes this.
  12. xxBarginsxx

    xxBarginsxx

    Joined:
    Mar 7, 2014
    Posts:
    68
    Um, I learned html, javascript, Java, C# and ASM using YouTube, and one other site I can't remember. So it's not all about going to an expensive Uni, I learned by making projects over and over again, just doing other stuff, and watching videos learning more, trying other things, learning about that thing again, etc. Yes you can learn alot from Uni's but still, you don't need a Uni to learn things...
     
  13. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    I am quite a skilled and pretty confident with Unity. But nobody believes it because I don't have something to show off (only some small projects)
    As a result I won't be able to find a job I n game industry. Can't just say that I've been learning "from YouTube tutorial videos and online courses".
     
    xxBarginsxx likes this.
  14. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    If you'd read some more of what was actually being said it'd be clear that I wasn't telling him to go to uni. It was one of several options I was presenting.

    For what it's worth, the benefit of formal education is that any decent school, regardless of type, should make sure you cover all of the fundamentals. The problem with being new to something is that you don't know what you don't know (do a search for "levels of competence" and "unconscious incompetence"), so missing something is easy. I've seen people paying the price of missing basics years into development, forging on by brute force, telling themselves that's just how it is, and sometimes passing those bad practices on to others.

    Self teaching is awesome, and it's something we all have to do in this field. We certainly can't go back to school every time a new technique is discovered, because we'd never get to leave. But making sure you've got the fundamentals covered properly, early on, is a great investment, and a formal education is one good option (of several) to achieve that.
     
    Ryiah and xxBarginsxx like this.
  15. xxBarginsxx

    xxBarginsxx

    Joined:
    Mar 7, 2014
    Posts:
    68
    Was there a job being mentioned??? No, I just said what I thought about it.
     
  16. xxBarginsxx

    xxBarginsxx

    Joined:
    Mar 7, 2014
    Posts:
    68
    Dude... I read your whole post :) And I know that. I was JUST saying that It's possible to learn with out a university. :)
     
  17. knr_

    knr_

    Joined:
    Nov 17, 2012
    Posts:
    258
    Just wanted to follow up -

    To program, simply download Unity and install it. After you install it start Unity and create a new project. Unity should load you into the editor with your newly created project open.

    Next, find the Project window. In this window you can place all of your assets that you are going to use (or could use) in your project. This includes art as well as code files (scripts). There should already be a folder called Assets. Click on that folder.

    After that, what I prefer to do is create a folder called Scripts under Assets to keep the files in my project organized. To do this you would right-click the Assets folder, select Create and then select Folder, and then call the folder Scripts.

    Click on the Scripts folder (or whatever folder you desire to store your scripts in). Right click on that folder, select Create and then select C# Script.

    This will create a new C# script that automatically is derived from a class called MonoBehaviour. The name of the new script will probably be called NewBehaviourScript and should be highlighted initially. Change the name of the file and press the enter key to save the name. If you did not change the name before the highlight went off, then you should click on the file (and then click on it a few seconds later) so that you can edit the name to something else. However, if you didn't change the name initially (before the highlight went off) and you change the name of the file then you will also have to change the name of the C# class it declared in the file (not a problem, I'll explain what you have to do in that case further down).

    So now you have your new C# script that represents an element of game logic - input, movement, both, neither, something else...

    To edit the script, simply double click the file. If it is a C# script Unity will load an external editor called MonoDevelop which is the code editor. Some of us like myself use Visual Studio but it is not necessary.

    If you changed the name of the file after the highlight went off this would be the perfect time to change the name of the class it made in the C# script. For example, if you changed the name of the file from NewBehaviourScript to PlayerInput you would change:

    public class NewBehaviourScript

    to

    public class PlayerInput

    in the actual file itself, in the MonoDevelop editor.

    It is important that the name of the file and the name of the class match; if they do not then you will not see the class's public properties in the Inspector (I think).

    Lastly, to add the script to a game object go back into Unity. From the menu select GameObject and then select Create Empty. You will notice that in the Hierarchy window there is a new game object with the default name of GameObject. Drag and drop your new C# script file in the Project window over the game object's name in the Hierarchy window and that script will be added to the game object. You can verify that the game object now is associated with your new script by clicking on the game object and looking at the game object's properties in the Inspector window.

    As you update your script in MonoDevelop the game object you added the script to will take on that functionality.

    Hope this helps, if you have any questions just ask. Good luck!
     
    Last edited: Mar 3, 2015
    elmar1028 likes this.
  18. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    That's quite a useful information for the very beginners. But OP said he have knowledge with Unity3D before.
     
  19. knr_

    knr_

    Joined:
    Nov 17, 2012
    Posts:
    258
    Just being thorough. :)
     
  20. JPF55

    JPF55

    Joined:
    Feb 26, 2015
    Posts:
    40
    Hello,
    Went through and re-watched the unity live training videos, did a few of the tutorial projects and I know know more about what I need to do. Thanks for the advice. Will be posting in a new for when I get stuck and need to ask another question.
     
  21. Moosetaco

    Moosetaco

    Joined:
    Jan 27, 2013
    Posts:
    77
    If I may make a simple suggestion that I'm currently finding extremely helpful - Read through the entire Unity Manual even the things you already know. I skimmed through it a while back, and while I didn't know WTF I was reading about, it certainly helped later as I was playing around and recognized some things. Now, I ran into animation issues and decided to re-read the manual and things are definitely clicking more. So, I decided I'm going to make it habit of reading the manual occasionally... plus, my day job is boring =)
     
    Kiwasi likes this.
  22. willemsenzo

    willemsenzo

    Joined:
    Nov 15, 2012
    Posts:
    585
    If you want to learn how to program the only thing you should be doing right now is start programming already. I read the forums every day and I'm amazed how often people think they don't have to do anything to make a game or that others will help them out. Not personally to you, but it just doesn't work like that. You have to put something in to get something out.

    I started programming 3 years ago, without experience, no people around to help me. Just me and google. I deliberately spent every day of these 3 years to learn how to program and guess what, I now know how to program. I'm still doing it everyday because I think it's important to keep momentum. In programming the only thing you'll be doing is solving problems. So who is going to need to solve that problem, you or somebody else?

    Asking questions is good don't get me wrong, but a question like this I can only answer with: stop talking and start walking.

    Good luck.
     
    Kiwasi likes this.
  23. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Udemy is a great place to learn! If you sign up and wait a day or so, you will get a coupon. My son took a class there in C# and loved it. A short time later he took C# in college and his professor was impressed with his programming skills, most of which he learned from that Udemy class. :) Just search for coupons since some of these classes have huge discounts.

    Good luck to you!