Skip to main content
Participant
June 3, 2014

C# Developer Wants to Switch to Oculus!

Hi Guys,

Very first of what will hopefully be many posts, hopefully helping others as well as asking for help. I'm posting to this forum, instead of the Community Support forum, because it's more of a general "getting started" question, rather than solving a particular problem. I expect you'll be getting this question a lot, as more and more developers realize that developing for VR is what they've always wanted to do.

For the past 12 years I've been developing against the CLR in C# and VB, for both web and Windows, including a fair bit of XAML development for WPF and Silverlight. Lately I've been doing HTML 5 stuff as well: JQuery, JavaScript etc.

I want to develop VR experiences for the Oculus Rift. I learned C++ in school, but have been using C# ever since. I've never coded a game in my life, short of Blackjack for the console. I know Visual Studio pretty well, but again, mostly using the .NET framework.

So I got some time before my DK2 arrives. What technologies would you suggest that I bone up on? Should I be focussing on Visual C++ or would ANSI Standard C++ be a better bet? What about a graphics/gaming platform? DirectX, OpenGL, Unity or a combination? Any good books you would recommend? What about Tutorials, websites etc?

Thanks so much!

Aaron

    14 replies

    Up and Coming
    June 5, 2014
    If you use the SharpDX Toolkit like I do in the sample project, you don't really need to know DirectX, although it never hurts to understand what's happening behind the scenes. It is in fact a great way to learn it.

    Garbage Collection can be avoided with object pooling and making sure you don't allocate objects on every frame. There is a lot of information out there on the techniques to avoid GC issues. In terms of performance, SharpDX claims a 1.35x performance penalty compared to native C++. This is likely to come down with SIMD support and/or .NET native coming soon.
    Virtual Desktop Developer
    New Participant
    August 25, 2014
    "drash" wrote:
    Here's a short not-exhaustive list of terminology and concepts that would have been helpful for me when I first started working with Unity:


    • A Project contains Assets that can be neatly organized into a folder structure. (Project window)

    • Assets include scenes, textures, materials, meshes, prefabs, audio clips, etc.

    • A scene is a hierarchical definition of GameObjects. (Hierarchy window)

    • Each GameObject has a Transform which denotes a position, rotation, and scale.

    • This hierarchy of GameObjects/Transforms means that you can do something like rescale the entire scene simply by changing the scale of the top-most transform in the hierarchy.

    • A GameObject can be active or inactive. When a GameObject is inactive, all descendents of that GameObject are also effectively inactive even if they are individually still marked as active.

    • Transform is just one type of "component", and each GameObject is a container for as many components as you want.

    • A component is simply a script that is responsible for doing something. Components can be individually enabled or disabled.

    • A script is written with C# (the best choice), Javascript (which is not really Javascript), or Boo (no one uses this).

    • The underlying script for a component always inherits from "MonoBehaviour". When you create a C# script in Unity, by default this puts you into a template of a MonoBehaviour that does nothing.

    • This template has two empty methods, Start() and Update().

    • Start() is called when that component is first made active (i.e. the gameobject is active, all the gameobject's parents up to the root are also active, and the component is enabled).

    • Update() is called every frame. You know how long has elapsed since the previous frame by checking Time.deltaTime (which is in seconds).

    • There are many other methods that are called each frame and in the life cycle of the component, if you implement them:

      • Awake() is called when the component is first loaded up.

      • OnEnable() is called each time the component is enabled (and this includes the scenario where the component's gameobject was inactive and then made active). OnDisable() is called when the component is somehow disabled/made inactive.

      • Start() is called after the first time OnEnable() is called.

      • FixedUpdate() is called in fixed timesteps (configurable) regardless of how fast or slow the program is running. As a result, it may be called more than once per frame or not every frame. This is usually where physics get involved.

      • Update() is called each frame.

      • LateUpdate() is called each frame after Update() has been called for all active/enabled components in the scene.

      • OnDestroy() is called when the component is removed from the gameobject, or when the gameobject itself is removed from the scene.

    • If a GameObject is inactive (or if any of its parents are inactive), any component on that GameObject will not do anything -- methods like Start(), FixedUpdate(), Update(), LateUpdate(), etc will not be called for that component.

    • A scene is rendered each frame using a Camera, which is also a component that can be placed onto any GameObject. You can have multiple cameras, and every frame they will all render something in order of their "depth", from lowest to highest. Cameras can also render directly to a texture which you can then use elsewhere in your scene.

    • Cameras will draw whatever they see, but nothing closer than its "near clip plane" and nothing farther than its "far clip plane". You can change these as needed, but if the near clip is too low and far clip is too high you can run into precision issues.

    • Cameras can be made to only draw certain things within a scene, and this is accomplished by setting up layer(s) and making the camera only draw that layer(s).

    • In order to render a scene, a camera will find all the enabled renderers on active GameObjects. There are several types of renderers but the most common one is MeshRenderer, which just renders a Mesh (a set of vertices and triangles with additional information at each vertex). This mesh must be specified via MeshFilter component on the same GameObject.

    • A MeshRenderer generally will use a Material to determine how a mesh is rendered. A Material is simply a Shader plus a collection of properties that are passed to the Shader. These properties can be edited in Unity and changed at run-time.

    • Usually one of these material properties is a Texture, which is simply an imported image. Unity can directly import a bunch of different image types, and they will all end up as a texture asset. These texture assets can be configured to handle resolution, mip-mapping, pixel format, filtering, clamping, etc.

    • Unity comes with a bunch of built-in shaders, for which the source is readily available on the Unity website, but custom shaders can be created or third-party shaders can be imported and used.

    • The scene can be viewed in 3D at design-time via the Scene window. Hold down the right mouse button on the scene window to look around, and while holding the right mouse button, you can use WASD to move around, and Q and E to move up and down. Also hold Shift to speed up (but it takes time to accelerate if you're trying to move across long distances).

    • Double clicking on a GameObject in the Hierarchy will take you straight to that object in the Scene view.

    • W, E, and R are shortcuts for entering translation/rotation/scale adjustment modes.

    • The position, rotation, and scale values shown in a Transform component are "local space" values, which means they are relative to the parent. "World space" is what you get when all the transform values from the parents are applied in sequence from top-most parent to child.

    • To the right of the four icons in the upper left corner of the Unity editor, you will see a pair of toggle buttons: Pivot/Center and Local/Global. When you adjust positions and rotations of a GameObject via the Scene view, keep in mind that the axes of movement and rotation are aligned according to your Local/Global toggle. Global just means you'll be moving a GameObject around in world space, which may or may not be the same as the values you see in the GameObject's Transform.

    • Unity's units are in meters.

    • You can create lights and basic shapes (primitives) via the GameObject -> Create Other menu. When you create a GameObject this way, it will be created at some distance in front of where you're looking in Scene view -- you may wish to edit its Transform values to something more reasonable.


    Great list, I'll be saving this!!
    Participant
    August 25, 2014
    In regards to the cost of Unity-

    Lifetime pro license is expensive. You can get an educational license if you happen to be a student or educator :D
    Up and Coming
    August 25, 2014
    If you are like me and don't like to read big books too much here's a free video series on unity fundamentals.

    Even with previous industry experience in video game development tools I was kind of lost in Unity the first time I started it. These helped me to get my bearings in Unity quickly.

    http://www.3dbuzz.com/training/view/unity-fundamentals