Thursday, March 7, 2013

Changelog 07/Mar/2013

Another change-log post, and the drill is the same: bullet points detailing the changes and in bold what is still to be done on that feature.

Let me start by apologizing for the mistake I did in the last change-log post: I showed an untextured screenshot with ambient and diffuse claiming that it was only ambient. Here is how the engine looks with ambient only:

And ambient plus diffuse:

  • Cleanup terrain editing functions. This feature was present for quite a while, but now it is more bug-free and robust, with better UI support  A new API is also in place to facilitate editing. Let me show you what it takes to make keys '1' though '4' change terrain texturing under cursor and keys '5' and '6' change terrain height:

Texturing changes are fully real time and take next to no CPU to finish. Height editing is not so robust because both normals and tangents must be recomputed. Editing height lowers your FPS and mouse becomes sluggish.  It will be a real programming challenge to optimize this in such a way that only the affected vertices are recomputed and thus it can run in real time without impacting game performance.
  • Moved the camera and physics based character controller to the library. There is still a lot of to work on these, improving robustness and feel, but they will have to do for now. Library source size is 361 KiB and going up.

  • Implemented skybox. There are still some problems with it, like being able to see the borders:

I won't bother fixing this for now because I'm sure it is an easy fix. Famous last words yet again. What is not that easy to fix is the view distance. Without a skybox, just an uniform color and strong fog, you can get away with a very irregular distant landscape having a chunked look and strong pop in. The non-uniform nature of a skybox makes this pop-in and chunked look very disturbing. To illustrate this take a look at this screenshot with a black sky for contrast:

A chunked distant look. Take one step and massive pop-in:

I improved this by lowering the view distance and adjusting fog parameters, making it that distant chunks that pop in near the border of the visible area do so before they reach the far plane. View distance is worse, but pop-in is less noticeable. A far better solution for view distance is needed.

  • The bloom component is no longer a XNA Component and it has been moved to the library. It is now a plain class that implements the functionality without complying to any interface dictated by a framework  When some day in a distant future the engine will move away from XNA, its replacement won't have to emulate the XNA Component class in order for bloom to work. Or any other effect.

  • Terrain uses a world matrix. In the past the terrain vertices used absolute coordinates and the world matrix was set to identity. Now they all are local coordinates and the world matrix is used both for rendering and physics. It is a central point of terrain now and if I want to do something with it there is just one entity to change. I did some tests and made the world centered around zero, but I am not sold yet on this solution. It might double the range of shadows because smaller numbers have less rounding errors, but it makes the conversion form logical to physical coordinates and vice-versa more complicated and less intuitive. So for now I'm leaving the world corner at zero. This can also allow me to speed up chunk creation since local coordinates are the same for each chunk. The first creation takes exactly the same time, but further creations will be faster. Not implemented yet.

  • Implemented point lighting as seen in previous post. Currently only one point light is used for the character light source. I will detail the exact powers and abilities your character will have in a future post, but for now let's say that abilities will be physical and magical, and for the magical some will be selectable, like choosing that the hotkey '1' will trigger some spell you selected for that slot, and some will have a predefined key and behave more like an ability you have acquired. You will still have to invest skill points into these, but once you do the special hotkey will become active. 'F' is personal light, Shift is you skiing ability, 'B' you blink spell and so on. The number of intrinsic hotkeys won't be that large and are used to portray the special nature of your character that allows him to naturally do out of the ordinary stuff and have superhuman mobility. The light spell actually causes you body to emit light. It will be upgrade-able with different abilities, like threat highlighting and "stealth light", allowing you to sneak with the light on at the cost of mana. If you don't want this power, you will have to carry a torch with you. Torches will expire and their use takes up one free hand.

  • Created new entity hierarchy to represent mesh instances. I am still not happy with the design. It is very hard to come up with a general solution that has near perfect batching at the same time. A few more redesigns will probably come, but the Draw method of the engine is a lot cleaner now.

  • Cleaned up render target support in the engine. Things are still not perfect because with 3 different AA options, bloom and post processing effects, the number of permutations is very high and some combinations still don't work. This being and engine you can turn on any of the effects and their associated render targets on the fly and if you not wish to have 50 render targets and isntead reuse them cleverly, this becomes quite complicated.

  • You can now change the level of MSAA on the fly. There is a debug key that goes though 0, 2, 4, 8 or 16 MSAA. The debug text displays the intended level of MSAA and the actual one if the GPU can't handle it. It also displays the type of post-processing AA used. You can have both one at the same time for ultimate visual quality, but I don't recommend MSAA + FXAA. Or FXAA. Period. Keyboard handling has been split in two parts, one handling the debug functionality of the engine and one for gameplay. In the final game you probably won't want a hotkey for tuning on bloom or wireframe, so you just turn off/fine tune debug keys. Debug keys have been restructured to use Ctrl-Fn keys so they don't interfere with normal game keys. Some exceptions are present, like Alt-Enter to toggle fullscreen. The text is also less verbose, showing information only if it relevant. There still needs to be added a mode to choose FXAA/SMAA quality. I'm still pretty sure that you can't have CSAA with XNA, but I need to confirm it. And see about TXAA.
Here are two random screens with MSAA + SMAA:

No comments:

Post a Comment