Monday, 2 January 2012

Skeletons loaded!

So, I worked on skeletal animation and audio with varying degrees of success. Below is my second attempt (the intended model is shown somewhere below - it's a Hellknight from Doom):

Not as beefy as the designers intended...?

Which, whilst bad, isn't as awful as my first attempt:

Aforementioned first attempt. Don't laugh...

Whilst it was looking almost humanoid, clearly something wasn't quite right. Since an unfortunate number of points were getting crushed towards the centre, and the head was the worst-affected, I thought it might be due to my rotation code. After disabling that and changing the direction in which the model is "wound" (clockwise vs anti-clockwise winding of points on the faces), I had the following:

Ugly but better...

Finally realising a couple of pathetically silly mistakes (the transformed points being in the order w,x,y,z but instead using w, x,y and throwing away the z component, explaining the x-crushing, and doing the multiplications in reverse order), I was able to get the following:

Success...
The edges of each skeleton are fuzzed because, like nearly everything, my anti-aliasing is now in a buggy, ghostly half-finished state (which is good - bug-hunting is much more fun and satisfying than writing from scratch, and jaggies are worse than the ghosting). The balls in the scenes (around the feet) are some more testing code I couldn't be bothered to switch off - they're sound emitters, moving around the scene emitting sound, as you might expect a sound emitter to do. I'm not going to spend any more time on skeletons until time management is done better, so that it'll know what frame and sub-frame of animation to play.

I've also changed how lighting attenuation functions - now, an artist can define how lights fall off with distance. The next thing on the list is physics - I've had some basic motion working in the engine but it's still very, very broken at the moment.

Progress list: 

Still not started ,or architected terribly and completely broken
  • Physics/game logic/scene management/trees
  • Shadowing
  • Skybox and Water shaders.
  • HUD
  • Environment mapping
Partially broken or significant work needed:
  • Audio, particularly spatial and streaming
  • Speed of lighting, especially stencilling ops - avoid them using FragCoord, minimise calculations wherever possible.
  • Skeleton interpolation
  • Intersection
  • Resource/update/download/network management
To improve:
  • Antialiasing
  • Time manager
  • Light equation/materials/BDRF used 
  • Input and key binding (ties in with game logic)
To touch up:
  • Model Format/Optimisation
Of those, gameplay, physics, skeleton and sound are all that still need work before the game is playable for development purposes. If people are willing to play audio-less with a ball for a character, it's almost playable right now - as soon as I sort the physics problems I've been having, I'll have a controllable ball interacting with the world.

Charlie

Monday, 26 December 2011

Not Skeletal Animation

The set of points from last week were the raw data of the "skeleton" of a Hellknight from Doom 3 - I'd intended to have skeletal animation at least somewhat working by today. No such luck, though I did fix the final issues of native library loading - it can now manage its own native code entirely, after adapting to some updates to JOGL, with a patch to skip over the part that my code already handles.

On the 3D printer, I added the Y-endstops (both home and end), and calibrated and tidied the wiring almost completely. All that remains before actually printing parts now is the X-axis belt and endstop setup (and using a spirit level to re-level the machine). A heated bed might be necessary to get the best-quality prints, though I'll see how it performs without first.

The motor for my moped arrived, too...
Finally, if you haven't already got it, there's possibly still time to pick up a copy of the Humble Indie Bundle (4) - pay what you want for some pretty awesome games (probably most notably, Super Meat Boy and Shank, both of which are gore-intense but brilliant games).

Charlie

Monday, 19 December 2011

Big steps

So, I've made some pretty big leaps forward in the game programming: 

First half of edge detection
For the anti-aliasing, I decided to use a method pretty much exactly as used in STALKER - so far, it's only detecting edges via the surface normals, but soon it'll also use the depth buffer, to ensure that all the edges are "caught" (look at the pot on the left - its edge hasn't been detected because the change in surface direction between the two surfaces isn't great enough. Once all the edges have been detected, it's a simple and quick step to blur them and so cheaply "fix" aliasing.

This step is a post-processing step, as is SSAO. I've also started to implement SSAO, though it needs configuring for the scene, and the blurring step is still not yet complete - it has to take into account depth, or the shadows will "bleed" onto bits they shouldn't. The final steps are exposure and colour correction - colour correction I've already done, but in lower-quality versions, and exposure is still in the works (fixed exposure only works at the moment).

I also wrote most of the intersection tests, which are going to form a fairly important part of the physics system, level layout and rendering optimisations. The overall plan is that every object in the world will be given a "bounding box", and quickly checked against the feature in question (for example, for checking if an object is visible, it's checked against the viewing frustrum, or for physics, a ray representing the motion of an object can be checked against anything it's likely to collide with). This can be optimised by including all objects in a "tree" of bounding boxes, where each bounding box node completely contains all of its children, so if the parent is outside the area in question,all of its children can be quickly eliminated.

The framework for a download and resource manager have been started - allowing files to be queued and made to download or update, and for resources no longer visible to be unloaded completely to save graphics memory.

I also tidied up the controller code somewhat for Windows - it can now get the proper analog values, and detect the type of controller and battery level (and interestingly, also the type of battery in the controller) of Xbox controllers. Almost completely pointless but cool nonetheless.

Finally, a teaser, most likely for next time:
No clues as to what this is for yet, but it should be interesting...

14500+ lines of code now, 333 TODOs listed.
Charlie

Monday, 12 December 2011

XInput

 So, I spent far too long working on getting the Xbox controller working - instead of using their standard input libraries, Microsoft in their infinite wisdom chose to make a separate API for the sole purpose of interfacing with their controllers. As a result, I ended up downloading a C++ IDE, and using Java's native code to work with those APIs. On the plus side, it means that the vibrate and separate polling of the triggers can be done (using the previous method, only Trigger (R-L) can be read not R and L separately) , but under Windows only.

Other than that, I tidied up the native code loading further - it now "cleanly" loads nearly all of the dlls or modules needed to run independent of platform and architecture (I still have to fix nativewindow though). Lights are now configurable in the engine rather than hard-coded into the shader (simple change but an important step), and I've started to write the basic game code/world itself.

Stuff I still need to do:

  • Intersection tests/resolver for physics, area scripting for levels
  • Scene optimisation
  • Decent gameplay code
  • Improve the importer (bring lighting, more material properties in)
  • Finish lighting optimisation - actually do the stencilling - additionally, light clip volumes
  • Antialiasing
  • Shadowing
  • Audio


Charlie


Monday, 5 December 2011

Small Steps

So, I finally sat down and spent a couple of hours coding the engine. I've started to tidy up my code layout and sort out decent input and gameplay - and in part of that, I bought a USB Xbox gamepad and played around with using it as an input. Unfortunately, the rumble feature is broken in the library I was using but otherwise, the controller works nicely and gives a nicer feel to motion - it's much smoother than a keyboard, and seems a fairly natural way of controlling a platformer-style game. I also added some very basic mechanics - nothing more than the basic laws of motion at the moment, and nothing visual either. 

Still planning to have something "playable" (i.e. vaguely resembling a game or game engine) by the end of the year if all goes well...

Charlie

Monday, 28 November 2011

Super-Secret Project

Another terribly-short-and-limited blog post to follow, so I don't blame you if you skip this one. Work, parents' evening, and the super-secret-project have been taking up most of my time. In no particular order, I have managed to:


  • Sort the 3D printer bed out - glass cut and bored successfully (or nearly finished, need to tidy and finish the holes)
  • Nearly-finish the lighting optimisations - stencils are now working, and now just need to fiddle around with how the information about lighting is stored (radius, colour, position, shadow-casting)
  • Finish most of the programming on the super-secret project for the time being. Hint: it involves multiple virtual servers, a simple database, plenty of permissions, various types of buckets, and voxels. 
  • Buy far too many games - RAGE, Amnesia, L4D2, FEAR series, and a couple of indie titles. I might do a mini-review when I get around to playing them.

I leave you with an incredible video - worth watching in HD.


Charlie

Monday, 21 November 2011

Bugfixes

This weekend, I got to see a legitimate Robot Wars battle at the NEC - two flipper-armed robots throwing each other (and themselves) around. I also saw and spoke to a couple of engineers on the Bloodhound SSC project and saw the vehicle itself.

On the game, instead of coding anything new, I went through some of the very worst bits of my code and carefully removed a few of the worst-offending bugs.

  • The first one was that resizing the window would not resize the stencil buffer, resulting in some fairly unusual artifacts appearing. It took me a fair while to notice that I was actually allocating the buffer twice, and corrected it. Now I have stencils, which makes culling pixels for lighting very easy now.
  • The second one was a silly mistake in how I handled texture path names. I'd been doing it in a silly way (hard-coded slashes, which is death for cross-platform compatibility) - I went through and replaced most of them with the appropriate platform-independent solution. 
  • The final one was a complete pain to find and kill - I found that when changing camera angle with bright lights in the scene, the lights would flicker in a fairly irritating manner. I checked and double-checked my entire lighting code several times, as well as the matrix transformation, before realising that everything was (surprisingly) perfect. The actual issue was that my normal buffer was at too low a precision to make the lights adjust properly over a wide range of viewing angles. Unfortunately, a side effect of increasing the precision is that the lights now take longer to process - now, 800MP would seem to take (very approximately) half a second to run, giving me 16MP to use for lights, not 32MP (which is fair, given that I doubled the bits). It remains to be seen whether changing some of the other calculations (inverse of the matrices, reprojection, etc), lowering precision (8-bit floating not 16-bit floating buffers) and/or constraining the areas will be enough - though there's no reason it shouldn't. 

I also managed to fix George's PS3 for the second time and started work on a super-secret project, which is going to be revealed fairly soon (on or before next week).