Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

What do i need to be a game programmer?

Discussion in 'General Discussion' started by BrunoPuccio, Jun 11, 2018.

  1. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I also often use coroutines for smaller workflows or state machines, example from our game

    Code (CSharp):
    1. [CreateAssetMenu(menuName = "Tutorial/SprintStep")]
    2.     public class SprintStep : TutorialStep
    3.     {
    4.         public SimpleNetworkedMonoBehavior Firearm;
    5.  
    6.         public override IEnumerator Execute()
    7.         {
    8.             ShowPopup(GetLiklyOffHand().transform, string.Format("You can enable sprinting by pressing {0} while moving.", GetCommandCaption(Command.Sprint)));
    9.  
    10.             yield return WaitForSprint();
    11.  
    12.             yield return Execute(new MessageStep { Message = "There are some limitations to sprinting, for example you can not sprint while aiming down sights."});
    13.  
    14.             Spawn(Firearm, Transform.position, Transform.rotation);
    15.             yield return Execute(new PreloadWeaponStep{ Attachments = new List<AttachmentTutorialConfig>()});
    16.  
    17.             yield return Execute(new InteractStep {ItemType = "SMG"});
    18.  
    19.             ShowPopup(GetLiklyOffHand().transform, "Sprint and try to raise the firearm and see what happens.");
    20.  
    21.             yield return WaitForSprint();
    22.         }
    23.  
    24.         private IEnumerator WaitForSprint()
    25.         {
    26.             float time = 0;
    27.  
    28.             while (time < 3)
    29.             {
    30.                 if (NVRPlayer.Instance.Sprinting)
    31.                     time += Time.deltaTime;
    32.              
    33.                 yield return null;
    34.             }
    35.         }
    36.     }
    The forum is slow as hell btw
     
    iamthwee and frosted like this.
  2. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Is it embarrassing to admit I have never used a state machine?
     
  3. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    You have. Mecanim is a state machine, lots of other stuff is also. People just don't often use them from raw code, it's almost always done visually (since FSM translates to visual really naturally).
     
  4. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    I have?? Well I import blender animations, is that using mecanim?
     
  5. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I tend to use coroutine for a lot of ai also. The main problem with coroutine honestly is that debugger can't resolve object references from generated ienumerator (at least, not with the version of VS I'm using). So debugging is really a pain since
    this.SomeValue
    can't be viewed, only variables declared locally (I believe
    this
    resolves to the generated enumerator at runtime which is super annoying).

    Debugger w/ unity is kind of a pain in general, but I've really found the lack of debugger support to be a huge headache.

    How do you rate nodecanvas, and do you have any examples in practice?
     
    AndersMalmgren likes this.
  6. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Yeah, VS does not like the runtime Unity uses, hmm, I need to test if this works better with the 4.5 runtime that 2018 uses...

    I have not used the other visual scripting tools so cant compare, but its pretty nice. I'm at my dayjob so can take screen shots from it sadly. (Only have team services access so I can only look at the code)
     
  7. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Shouldn't you be working though :D

    P.S Im chilling in the library with UT forums and online pool in the bottom window!
     
    AndersMalmgren likes this.
  8. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I'm waiting for the code to compile!
     
  9. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    I don't believe that, you're probably using a scripting language like php or python :D
     
  10. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Its alot less sexy code at my dayjob, but its still C# atleast! upload_2018-6-14_16-4-28.png
     
    iamthwee likes this.
  11. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
  12. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Before they prune the thread, I'll joined my non elite ass and complained once more about programming. I wish we had higher order function, like in javascript but in less crappy language with proper typing and error detection.

    When I did a procedural text prototype in javascript that was like a big big big revelation, one line code instead of 10 :( now I'm back to serious stuff like c#.

    Most of the time I must do convoluted logic where I could just pop a list of function and pass function to function, and create custom loop. It's one prime reason I'm slowass at doing programming stuff, it's bad enough I'm considering wrapping single function into object with an interface.
     
    iamthwee likes this.
  13. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Bro what we need is a language like python but runs like the wind and is compiled, that's what golang was touted for!
     
  14. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    uhh... c# has higher order functions. Like everything does. JavaScript ppl making a big deal out of higher order functions did so because it was the only language feature javascript had, so everything had to be written w/ them.
     
  15. Well, that's good, but don't tell anyone who wants to hire you or you want them to hire you. :)

    First of all, build your portfolio, do stuff, in Unity, or in other engines you're targeting (Unreal, whatever).

    Second, get a copy of Donald Knuth: The Art of Computer Programming.
    https://en.wikipedia.org/wiki/The_Art_of_Computer_Programming

    This is a book (or set of books) which I think should be read by all developers (regardless of field) and the exercises in it should be solved and understood all of us. Great algorithm-ramp up.

    But most importantly, do stuff what you can show off. Make small games and/or contribute with stuff to engines or just useful things (assets on AS or on github or whatever).
     
    Last edited by a moderator: Jun 17, 2018
    Ryiah and BrunoPuccio like this.