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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

1st-person Adventure Game?

Discussion in 'General Discussion' started by Stardog, Dec 8, 2010.

  1. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,894
    If I'm a beginner with Unity, is a 1st-person adventure game a difficult project to start with?

    I know the basics of scripting, such as variables, conditional branches, events-based (OnCollisionEnter, etc), after learning on-and-off for years. I'm also experienced in animation and 3D modelling.

    The game would consist of these main features:

    1. A camera that flew through the different rooms when clicking on doors. It would be static every other time.
    2. When hovering some objects I'd need to create some kind of outline shader. onMouseClick they'd have to animate, or move to an inventory.
    3. Inventory + GUI for it... I would guess this would be an array. I've not really done arrays before.

    Are any of these difficult for a beginner?

    EDIT - 18th Mar 2011
    This is what I've come up with a few hours ago, and it's a bit tragic.

    http://www.stealmygameideas.com/test/WebPlayer.html
    Left-click zooms a highlighted object.
    Right-click zooms out

    I'm using an animation to move the camera, but that seems to have some problems. You can also play the zoom out anim half-way through the zoom in animation. I guess I could fix that with better variables.

    I would have to make a new anim for each zoom to the objects. This code seems a bit long to be copy pasting then changing the animation name. Should I be using functions or something?

    Any tips on where to go now? Should I move the camera on some kind of path instead?

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. using System.Collections;
    4.  
    5.  
    6.  
    7. public class MouseHover : MonoBehaviour {
    8.  
    9.    
    10.  
    11.     // =================================================================
    12.  
    13.     // VARIABLES
    14.  
    15.     // =================================================================
    16.  
    17.     private bool itemZoomed = false;
    18.  
    19.     private bool itemHovered = false;
    20.  
    21.    
    22.  
    23.     void Update ()
    24.  
    25.     {
    26.  
    27.         // =================================================================
    28.  
    29.         // IF LEFT-CLICKED ON OBJECT, AND itemZoomed=false, ZOOM IN
    30.  
    31.         // =================================================================
    32.  
    33.         if (Input.GetMouseButton(0)  itemHovered) {
    34.  
    35.            
    36.  
    37.             if (itemZoomed == false) {
    38.  
    39.                
    40.  
    41.                 // SET itemZoomed = true
    42.  
    43.                 itemZoomed = true;
    44.  
    45.                 Debug.Log("itemZoomed = TRUE");
    46.  
    47.                
    48.  
    49.                 // PLAY ZOOM IN ANIMATION
    50.  
    51.                 var myCamera = GameObject.Find("Camera1");
    52.  
    53.                 myCamera.animation.Play("AnimCubeCornerIn");
    54.  
    55.                
    56.  
    57.             }
    58.  
    59.  
    60.  
    61.         }
    62.  
    63.  
    64.  
    65.         // =================================================================
    66.  
    67.         // IF RIGHT-CLICKED, ZOOM OUT
    68.  
    69.         // =================================================================
    70.  
    71.         if (Input.GetMouseButton(1)) {
    72.  
    73.            
    74.  
    75.             if (itemZoomed == true) {
    76.  
    77.                
    78.  
    79.                 // SET itemZoomed = false
    80.  
    81.                 itemZoomed = false;
    82.  
    83.                 Debug.Log("itemZoomed = FALSE");
    84.  
    85.                
    86.  
    87.                 // PLAY ZOOM OUT ANIMATION
    88.  
    89.                 var myCamera = GameObject.Find("Camera1");
    90.  
    91.                 myCamera.animation.Play("AnimCubeCornerOut");
    92.  
    93.  
    94.  
    95.             }
    96.  
    97.  
    98.  
    99.         }
    100.  
    101.        
    102.  
    103.         // =================================================================
    104.  
    105.         // IF MMB
    106.  
    107.         // =================================================================
    108.  
    109.         if (Input.GetMouseButton(2)) {
    110.  
    111.             Debug.Log("MMB");
    112.  
    113.         }
    114.  
    115.     }
    116.  
    117.    
    118.  
    119.     // =================================================================
    120.  
    121.     // MOUSE HOVER. HIGHLIGHT.
    122.  
    123.     // =================================================================
    124.  
    125.     void OnMouseEnter ()
    126.  
    127.     {
    128.  
    129.         if (renderer.material.color != Color.red)
    130.  
    131.         {
    132.  
    133.             // Highlight
    134.  
    135.             renderer.material.color = Color.red;
    136.  
    137.            
    138.  
    139.             // Set itemHovered = true
    140.  
    141.             itemHovered = true;
    142.  
    143.         }
    144.  
    145.     }
    146.  
    147.    
    148.  
    149.     // =================================================================
    150.  
    151.     // MOUSE EXIT. UN-HIGHLIGHT.
    152.  
    153.     // =================================================================
    154.  
    155.     void OnMouseExit ()
    156.  
    157.     {
    158.  
    159.         if (renderer.material.color == Color.red)
    160.  
    161.         {
    162.  
    163.             // Un-highlight
    164.  
    165.             renderer.material.color = Color.white;
    166.  
    167.            
    168.  
    169.             // Set itemHovered = false
    170.  
    171.             itemHovered = false;
    172.  
    173.         }
    174.  
    175.     }
    176.  
    177.    
    178.  
    179. }
     
    Last edited: Mar 18, 2011
  2. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    988
    Not difficult, just depends if you can put the time and effort in
     
  3. Imani Gray

    Imani Gray

    Joined:
    Dec 1, 2010
    Posts:
    10
    Yep time + Effort are the Key

    And patients + a well thought out plan and Being Organized keep all that in mind

    Not to just rush in and take everything on by yourself unless thats how one likes it
     
  4. taumel

    taumel

    Joined:
    Jun 9, 2005
    Posts:
    5,292
    If we understand the same under the term adventure then the major part won't be about Unity specific stuff at all. It will be about the story/riddle design/dialogues and therefore it doesn't matter a lot how you visualise it.

    Speaking of the graphics third person adventures are a lot more interesting to watch than first person adventures because the aquarium effect is bigger. First person stuff always has the potential to feel empty and sterile but also is less work.

    It needs some talent in various fields(story telling, creating an atmosphere, writing dialogues, coming up with good riddles, ...)/taste/experience to get something decent out here. There are genres which are easier than the adventure genre. If you have your strengths in those fields then i wouldn't mind. If not then you better start with something else first.
     
    Last edited: Dec 9, 2010
  5. Ostagar

    Ostagar

    Joined:
    Sep 29, 2010
    Posts:
    445
    It's not too difficult to do with Unity as long as you're willing to stretch beyond being a beginner. :)
     
  6. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    I'm working on my first complete (hopefully, I will complete) game after doing a lot of simple starter things.
    I'm doing everything myself except the scripting and have used some free graphics and audio,
    though I do have a friend that does some sketches and have paid for one musical track, and expect to have more created.
    It's not the best looking game, the best modeling, probably not the best puzzles or even storyline but it's mine.
    I am not really very organized and started with some ideas and am developing from there.
    I have no real time constraints other than the time I have/will work on it (mostly days off from my regular job).
    I spent the first year "sketching" out five levels in Unity and have been working for about the last four months on one of the levels I hope to use as a demo or at least get some beta testing on, eventually.
    That's the plan right now.
    If it never comes to anything at all at least I am enjoying it.

    :)

    Oh yeah, it's a first person puzzle/adventure game.
     
  7. mikesgames

    mikesgames

    Joined:
    Apr 16, 2010
    Posts:
    1,071
    take the Tornado Twins Tutorials and you'll learn the basics :)

    Then work on from there :)
     
  8. vortex69

    vortex69

    Joined:
    Feb 4, 2010
    Posts:
    92
    I predict that you'll have more problems getting a good story and riddles for the game than to implement gameplay.

    Of course if you only know the basics about coding -- like me :) -- your code will look very "hackish" and probably not very optimized, but as long as it works it's a good start.

    In my opinion, when working on a game alone or with a friend or two on your free time, the most important thing is that you are really sure you want to make that project, or else you'll probably end up cancelling it at the first sign of trouble.

    Also, arrays are easy, as long as you understand what they are you'll be fine. If you don't really know anything about them, I believe a couple of hours -- maybe even minutes -- reading some programming tutorials will help you (obviously, reading the part about arrays :) ).
     
    Last edited: Dec 9, 2010
  9. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,894
    This is what I've come up with a few hours ago, and it's a bit tragic.

    http://www.stealmygameideas.com/test/WebPlayer.html
    Left-click zooms a highlighted object.
    Right-click zooms out

    I'm using an animation to move the camera, but that seems to have some problems. You can also play the zoom out anim half-way through the zoom in animation. I guess I could fix that with better variables.

    I would have to make a new anim for each zoom to the objects. This code seems a bit long to be copy pasting then changing the animation name. Should I be using functions or something?

    Any tips on where to go now? Should I move the camera on some kind of path instead?

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. using System.Collections;
    4.  
    5.  
    6.  
    7. public class MouseHover : MonoBehaviour {
    8.  
    9.    
    10.  
    11.     // =================================================================
    12.  
    13.     // VARIABLES
    14.  
    15.     // =================================================================
    16.  
    17.     private bool itemZoomed = false;
    18.  
    19.     private bool itemHovered = false;
    20.  
    21.    
    22.  
    23.     void Update ()
    24.  
    25.     {
    26.  
    27.         // =================================================================
    28.  
    29.         // IF LEFT-CLICKED ON OBJECT, AND itemZoomed=false, ZOOM IN
    30.  
    31.         // =================================================================
    32.  
    33.         if (Input.GetMouseButton(0)  itemHovered) {
    34.  
    35.            
    36.  
    37.             if (itemZoomed == false) {
    38.  
    39.                
    40.  
    41.                 // SET itemZoomed = true
    42.  
    43.                 itemZoomed = true;
    44.  
    45.                 Debug.Log("itemZoomed = TRUE");
    46.  
    47.                
    48.  
    49.                 // PLAY ZOOM IN ANIMATION
    50.  
    51.                 var myCamera = GameObject.Find("Camera1");
    52.  
    53.                 myCamera.animation.Play("AnimCubeCornerIn");
    54.  
    55.                
    56.  
    57.             }
    58.  
    59.  
    60.  
    61.         }
    62.  
    63.  
    64.  
    65.         // =================================================================
    66.  
    67.         // IF RIGHT-CLICKED, ZOOM OUT
    68.  
    69.         // =================================================================
    70.  
    71.         if (Input.GetMouseButton(1)) {
    72.  
    73.            
    74.  
    75.             if (itemZoomed == true) {
    76.  
    77.                
    78.  
    79.                 // SET itemZoomed = false
    80.  
    81.                 itemZoomed = false;
    82.  
    83.                 Debug.Log("itemZoomed = FALSE");
    84.  
    85.                
    86.  
    87.                 // PLAY ZOOM OUT ANIMATION
    88.  
    89.                 var myCamera = GameObject.Find("Camera1");
    90.  
    91.                 myCamera.animation.Play("AnimCubeCornerOut");
    92.  
    93.  
    94.  
    95.             }
    96.  
    97.  
    98.  
    99.         }
    100.  
    101.        
    102.  
    103.         // =================================================================
    104.  
    105.         // IF MMB
    106.  
    107.         // =================================================================
    108.  
    109.         if (Input.GetMouseButton(2)) {
    110.  
    111.             Debug.Log("MMB");
    112.  
    113.         }
    114.  
    115.     }
    116.  
    117.    
    118.  
    119.     // =================================================================
    120.  
    121.     // MOUSE HOVER. HIGHLIGHT.
    122.  
    123.     // =================================================================
    124.  
    125.     void OnMouseEnter ()
    126.  
    127.     {
    128.  
    129.         if (renderer.material.color != Color.red)
    130.  
    131.         {
    132.  
    133.             // Highlight
    134.  
    135.             renderer.material.color = Color.red;
    136.  
    137.            
    138.  
    139.             // Set itemHovered = true
    140.  
    141.             itemHovered = true;
    142.  
    143.         }
    144.  
    145.     }
    146.  
    147.    
    148.  
    149.     // =================================================================
    150.  
    151.     // MOUSE EXIT. UN-HIGHLIGHT.
    152.  
    153.     // =================================================================
    154.  
    155.     void OnMouseExit ()
    156.  
    157.     {
    158.  
    159.         if (renderer.material.color == Color.red)
    160.  
    161.         {
    162.  
    163.             // Un-highlight
    164.  
    165.             renderer.material.color = Color.white;
    166.  
    167.            
    168.  
    169.             // Set itemHovered = false
    170.  
    171.             itemHovered = false;
    172.  
    173.         }
    174.  
    175.     }
    176.  
    177.    
    178.  
    179. }
     
    Last edited: Mar 18, 2011