2015-12-25

Aether3D Status Report

I've been busy at work this fall so I don't have time to work on my own engine as often I'd like to. Anyways, I'm happy to share that I now have a working Metal renderer (both iOS and OS X). Using MetalKit I can do the view setup identically on both operating systems and there are very few different code paths. D3D12 renderer is progressing well. I'll also implement Vulkan renderer as soon as public implementation becomes available.

VR rendering needs more love. I'm naively rendering the scene twice. For example culling and shadow rendering can be done only once. I don't have my own HMD yet but borrow my employer's DK2 sometimes. I'll also add Vive support as soon as possible. I started making a VR game on Unreal Engine to get to know VR and Unreal better. It's a System Shock inspired space ship exploration game. The plan is to utilize Vive's controllers or Oculus Touch to interact with computers, drawers etc.

When implementing new APIs I'm focusing first on getting things working and later making the implementation as efficient as possible. For example, I'm using only one command list in my D3D12 renderer but will add more soon.

Visual Studio's and Xcode's frame capture has been very useful in debugging these new renderers and to make things easier I've added debug names to every API object.

Next year I plan to hit Aether3D 1.0 (0.5 is now under development).

2015-07-03

Software Quality

When developing software, here's a partial list of things I value:

Build using multiple compilers

Sometimes you forget to #include something from a standard library that works on one compiler but doesn't on another or use constructs that don't compile on all compilers.

Static Analysis and high warning levels

I regularly run PVS-Studio, CppCheck and Clang static analyzers and use very high warning levels on my compilers.
My GCC warnings: -Wall -pedantic -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization \
 -Wdouble-promotion -Wformat=2 -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-include-dirs \
 -Wshadow -Wredundant-decls -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wtrampolines \
 -Wunsafe-loop-optimizations -Wvector-operation-performance -Wzero-as-null-pointer-constant

Unit Tests

I have found many bugs using them. Excellent for math stuff, serialization testing, error handling testing etc.
 

Test graphics code on multiple GPUs

Some drivers accept bad syntax in shaders or have bugs. I test my graphics code on NVIDIA, AMD and Intel GPUs on Windows, OS X and on Linux.

Minimize variable scope

Declare variables as close as possible to their use site and try to make them const. Ternary operator and lambdas can help here.
 

Avoid Boolean arguments

They make the code hard to read and often break the Single Responsibility Principle.

Avoid magic numbers

Same as above.

Collect metrics

Use tools like Metrix++ to get metrics like line count, cyclomatic complexity etc.

Extract complex conditionals into descriptive variables and methods.


Look out for Code Smells


Comment things that can't be expressed in code

First try to name your variables/methods so the comments are unnecessary. Only after that write comments.

2015-05-16

What I've been doing recently

I've been adding graphics features into my new engine slowly because I don't want to write a lot of code that will be replaced by newer APIs. Regarding that, I made an iOS branch into GitHub and I'm learning Metal and already got a textured quad to render. So far the best resource for learning has been http://metalbyexample.com. I also installed Windows 10 preview and VS 2015 RC into my secondary laptop and are learning D3D12. When I have more experience on D3D12 and Metal, I'll merge my renderers into the master branch. I'm also waiting for Vulkan and reading Mantle documentation until it's out.

Writing only engine code would not be so productive, so I'm working on two small games at the moment. The first one is a desktop FPS made using Unity 5.

Some of the assets are downloaded from sites like https://freesound.org, pamargames.com and cgtextures.com but some are done by myself. While the level design/art design/balancing is amateurish, I'm paying special attention to polishing feedback like dealing/receiving damage, transitions, sounds, bullet holes etc. When the game is ready, I'll put the player into my website along with the project folder. I also ditched the built-in MonoDevelop in favour of Xamarin Studio which is faster, but Unity overrides my formatting options.

My other game under construction is a roguelike using my own engine.

I haven't decided on the final design or platform. If my iOS/Metal renderer advances quickly, it would be nice to test the game on my iPhone 5S. Using my own engine for a game development has been productive since it has uncovered some bugs that would have bitten me later on otherwise. Also the new engine's component-based game object system has been nice to use in this game. Some of the used components are TextRendererComponent, SpriteRendererComponent, TransformComponent and AudioSourceComponent.

Next steps in my engine will be a virtual filesystem which enables faster load times by packing multiple files into one. While making the iOS port I'll also be writing NEON SIMD matrix operations. I'm also making a multi-platform scene editor using Qt and its first version will be included in the next engine release.

2015-03-08

GDC 2015, Vulkan etc.

Game Developers Conference was held on March 2-6 at San Francisco.

Unity 5 was finally released. I have used it since beta 1 and I'm happy about the licensing change that allows all engine features to be used on the personal edition. Epic also dropped the subscription fee for Unreal Engine lowering the entry barrier for casual developers, as those who are serious have already subscribed. With the Valve announcement of Source 2 being free there's now good competition on indie-friendly engines.

John Carmack talked about mobile VR, noting that it has potential to reach far more customers than desktop VR. I have always liked Carmack's talks, he just sits there without any materials and talks as long as allowed.

Khronos revealed Vulkan, the successor to OpenGL and OpenGL ES. It's evolved from Mantle and the abstractions are similar to D3D12, making the driver more simple. It also allows more control than OpenGL in that you have to allocate memory yourself, avoid hazards and handle threading. More control means more potential for performance but also more responsibility. There will, however, be an optional debug layer that should help the developer to find problems. Shaders will finally be supported in an IR, making them load faster and, more importantly, alleviating compatibility problems caused by subtle differences in parsers ie. different drivers accepting broken syntax or not accepting correct syntax.

All these new APIs (Metal, Mantle, D3D12, Vulkan) provide abstractions that are different from earlier APIs. Personally, for me that means that when I begin writing my new engine's renderer, I'll follow those abstractions. I cannot use D3D12 or Vulkan today and probably will begin writing a new renderer before they are out (I'll be starting my new engine development next week), but I will try to design the renderer to allow for the sane usage of those new APIs when they are released and will be implementing D3D12 and Vulkan renderers as soon as they are released.