Forum Discussion
FunkMonkey33
11 years agoHonored Guest
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
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
- drashHeroic ExplorerIf you can afford the Pro license, Unity might be right up your alley and you will have a ton of fun with using your fluency in C# and .NET in brand new ways. It still does require some familiarity with some gamedev and 3D graphics concepts but that's what tutorials and Unity's scripting reference are for. :)
- WadeWattsHonored GuestAlthough you are not a beginner to C# this book will be useful to see how it works with Unity.
http://www.amazon.com/Learning-Developing-Games-Unity-Beginners/dp/1849696586
;) - cyberealityGrand Champion
"WadeWatts" wrote:
Although you are not a beginner to C# this book will be useful to see how it works with Unity.
http://www.amazon.com/Learning-Developing-Games-Unity-Beginners/dp/1849696586
;)
I read that one. It's very basic and only explains stuff like what a function is. Good if you have never programmed before, but otherwise not that useful. - brantlewAdventurerStarting with an existing engine platform like Unity or Unreal will be the best way to drop in quickly and get started with content. Otherwise you will be spending a lot of time learning esoteric minutia about rendering, DirectX, shaders, and distortion - alongside C++ before you ever even get a rotating cube working.
- cyberealityGrand ChampionIf you already know C#, Unity would be a great fit. Although, you can probably use Unreal Engine 4 as well, C++ is similar and not a huge jump.
- drashHeroic ExplorerHere'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.
- FunkMonkey33Honored GuestNice. Thanks for all the replies, guys. It sounds like Unity is the way to go for game development. I love that it uses C#, because I'm a really big fan.
I also want to develop business apps for VR. Is Unity good for that, or do I need something more like DirectX or OpenGL?
Thanks!
Aaron - cyberealityGrand ChampionUnity should support most any type of game or game-like real-time application. What do you mean by "business apps"?
- guygodinProtegeIf you are familiar with XNA or DirectX you can check out SharpOVR:
https://developer.oculusvr.com/forums/viewtopic.php?f=20&t=8464
It's a .NET wrapper for the Oculus SDK. This will allow you to do lower level stuff compared to a full game engine like unity. It really depends on the kind of experience you want to create. - FunkMonkey33Honored Guest
"guygodin" wrote:
If you are familiar with XNA or DirectX you can check out SharpOVR:
https://developer.oculusvr.com/forums/viewtopic.php?f=20&t=8464
It's a .NET wrapper for the Oculus SDK. This will allow you to do lower level stuff compared to a full game engine like unity. It really depends on the kind of experience you want to create.
I'm not currently familiar with DirectX, but I've started learning it using online books. Of course it's all C++ based, and aside from 2 semesters in college, my C++ experience is nil.
SharpOVR is quite intriguing, given the potential to keep things in C#. Do you think performance would be a problem? I don't want the display freezing or jerking when the CLR decides to do garbage collection.
Also, is learning DirectX directly a prerequisite for using SharpOVR?
Thanks so much!
Aaron
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 6 hours ago
- 3 years ago