Friday, 19 July 2013

Friday Early Knock

Painting and Textures

I got up early today to get back into the terrain stuff, which today was experiments into terrain painting.  Here is a quick and dirty video of where we are right now:


Be aware this video is scratch graphics only and does not contain any final artwork or editing controls. It is a technology demo to quickly test the editing capabilities of the terrain system and gain a performance metric.

I added a new parameter to Blitzwerks Terrain to cap the height of newly created land mass based on the layer/zoom height of the camera. This allows floors and outcrops to be created easily.

As an experiment I also added some basic grass colouring to the terrain affected to see what I might be needing when it comes to applying real textures. It turns out that even a basic colour can look good when multiplied by a detail map. That said, one of my objectives is to produce a high quality up close texture result on the terrain and I don't think blob colours are going to cut it for Reloaded. The good news is that both height and texture can be edited in real-time and it's a great starting point for the shader I will need to write for the next phase of this component.

Signing Off

As you might guess from my early rise and my early blog, it's an early knock for me today as jump in the car for a nice long drive. Join me again on Monday's blog when we test out the terrains ability to accept a shader and some real textures for up-close editing.

Thursday, 18 July 2013

Thursday Terrain Video Day

After The Rain, Sunshine

Another good day of development and a decision of sorts.  My day started by reading a recent paper on a technique called CDLOD terrain (Continuous Distance Level Of Detail Terrain) which basically uses the GPU with Shader Model 3.0 to blend the vertex geometry so that successively lower polygon meshes can be substituted seamlessly in the scene. As this technique uses texture lookups in the vertex shader, it is quite hungry on cards prior to SM3.0 and perfect for the newer generation of cards which is why I liked it so much.

The technique produces almost perfect and undetectable LOD transitions, is very fast with almost no CPU hit and quite memory efficient with the possibility of streaming the terrain data in and upgrading it to DX11 tessellation in the future.  All sounds good don't it?

The downside is that to learn the technique, modify the same code to fit in as a DBP module, work out the kinks to make it stable and usable for the Reloaded project then run it through a battery of usage scenarios would take much more than the time I have left for terrain work.

Step Forward Our Hero

Once I had accepted the fact that my plan A was too ambitious and risky, I once again looked at the solution that was sitting right in front of me screaming to be heard.  After only a few minutes of tinkering, I started to realise just how powerful and complete the Blitzwerks Terrain module for Dark Basic Pro actually was.


Not only can you create extremely large terrain in memory, the automated LOD system works seamlessly, the whole system runs very fast and as a massive bonus I discovered half way through the day that it also contains a huge array of real-time terrain modifier commands. The same commands I was going to write myself until I found them in the documentation, which again was top draw and a hidden gem of this module.

The author very kindly loaned me the entire source code to the entire project, and with it I was able to quickly step through and get comfortable with the various components. This now gives me confidence that should I need to add or fix anything, it's there waiting for me. It all compiled first time and turned out to be a very well written set of projects despite a warning that it was a bit 'bloated'.

If this code is bloated, I dare not imagine what it would look like streamlined! My universe was back on solid ground and the power of terrain was bristling off my trembling fingers!

And Then There Was A Big Hole

With no time to lose I started re-shaping one of the BT2 examples along the lines Reloaded would require. A terrain that stretches 50,000 units north and east. A top down camera perspective and of course, a set of basic terrain editing features such as adding and subtracting terrain heights using a brush size based on zoom distance from the terrain to the camera viewer.  I also added a cheap and quick water table plane so I could define the land masses from that part of the terrain underwater.


At the moment all the editing controls are super crude but the objective at this stage is to get all my ducks in a row, which means get each functionality in place. We have height modification, but we also need tighter terrain height controls so I can create flat (yet blended) areas, specific shape stamps, layer level control and who knows what else. I also need to make massive strides into the texture side of things. I want a highlighter actually part of the terrain texture, texture splatting, some sort of dynamic texture renderer based on the player position so I can do LOD for the texture to compliment the geometry LOD system.

Things like the water shader and other such eye candy might also be worth doing just to please those certain mentioning no names people who get giddy at the sight of gorgeous pixels.  I have some terrain textures being brewed up a week from now so hopefully the whole thing should jump in quality as we move forwards. There is also things like geometry vegetation, terrain shadows, maybe some depth normal editing and more ideas to try out.


I also added a first person perspective to the terrain prototype so I could run around my finished creation and see what it looks like from the players point of view. It's here you realise that I will need some sophisticated terrain height editing brushes to get the kind of results most users would expect from their landscapes. Huge smooth spherical gouges ain't one of them :)

Signing Off

The next step will be to create some kind of dynamic texture system so that I can paint multiple levels of detail onto the terrain for things like grass, rock and underwater surfaces, but also normal/depth painting so I can slice very subtle details into the very texture (rather than trying to use the geometry). I can then use this functionality to automatically texture the terrain based on height so flattish areas get some grass and steep slopes get some rock. Hopefully the effect will be that painting a high grass layer above a lower grass layer will look like a raised escarpment.  See the above video of ice and rock to see the effect of a series of escarpment layers.  I am sure users will be taking control of this painting eventually, but for the user who just wants to paint the terrain quickly and start playing their game, an automated terrain painting system is vital.


For those Dark Basic Pro users following my blog, you can check out the most excellent Blitzwerks Terrain plug-in from the TGC site:

http://www.thegamecreators.com/?m=view_product&id=2286


AGK V2 Kickstarter

Rather than feed you another incorrect AGK V2 pledge total, I will simply leave you the link so you can check it out yourself. Maybe Rick will step in and provide the 'real' pledge level:

http://www.kickstarter.com/projects/tgc/app-game-kit-v2

Wednesday, 17 July 2013

Wednesday Performance

And Then Came The Rain

As much as Tuesday was fun and productive, Wednesday was muddy and slow in the world of terrain coding.  I had a few missions today, mainly to improve the shape of the lower LODs so they don't change shape too much on the horizon line, add multi texture support and improve the distant LOD level as it was too low polygon.

I started the day well and completed the first task, which increased my polygon count from 8800 to 13500 for the terrain geometry and dropped my frame rate from 850 to more like 450 fps.

At this point I decided to apply the brakes as there is no point continuing with texturing if I'm already loosing a significant amount of performance at the first hurdle. The third task was entirely academic as the solution 'was' to add more polygons but this clearly was not the direction I needed to go in.

Calling In The Blitz

As a point of comparison, I decided to bring in one of the newer DBP modules from the massive library of extra-features of the Dark Basic language has at it's disposal. This one was called Blitzwerks Terrain and with it, I created a terrain 500x500 with two levels of LOD.  When run, the geometry shapes where very well retained across all LOD levels, it already has basic texturing support and the best news of all, it was weighing in at over 3500 fps.

Clearly, my own initial effort was not even holding a torch to the terrain system already available via Blitzwerks Terrain. Perhaps this is not surprising given my one day effort was being compared to a highly optimised module that took months to create.

I have thus fired off an email to the author of Blitzwerks Terrain in the hope that the source code survived. If possible, I would like to add some extra features to it including a more sophisticated texturing system which will allow me to shade grasses, apply shader effects and other nice touches.

Character Meets Code

Another task I added to my daily list was the creation of a quick character prototype for Reloaded. The final character model and animation came through last night and I was itching to get it in code to see what it could do.


As I expected, the character performed really great in code and each time I wanted an animation it was documented and ready for to call up. I added some nice touches to the prototype while I was in there such as automatic smoothing from different animation loops, two modes so I could switch seamlessly between patrol and combat stance, eight directional walking in both modes and a few other subtle tricks to make it all feel natural.

I also had a quick play with transitioning the background music sound based on the character mode, so when patrolling the sound is calm and when the character is in combat mode, the sound gets more racy.  Proper sounds will be sourced and used for the final product, but the video should give you an idea what it might feel like.  I especially like now the combat sound fades out slowly as the heart rate falls after the high octane adrenaline rush.

Signing Off

It's about half eleven now which gives me a few more hours before I have to turn in. Even though my terrain geometry stuff is a little 'off' there is no reason why I cannot code up the real-time texture transition stuff for the terrain as this is quite separate from the polygons that shape the ground.  I can also experiment with some other ideas I had too once my terrain texture prototype is up and running.

AGK V2 Kickstarter

Taking a look at the latest score, we have pushed past £21K, hurray! It's great to see people pledging on this project, and my new goal is to see the 570 climb up to 600 pledger's :)  If you have any coder friends who don't know about the AGK kickstarter, send them this link if you think they might be interested: http://www.kickstarter.com/projects/tgc/app-game-kit-v2

570
backers
£21,205
pledged of £5,000 goal

22
days to go

Tuesday, 16 July 2013

Tuesday Terrain Tastic

Let There Be Ground

Apart from a bit of distraction from some legacy support work (I still get dragged back when I cannot avoid it) the whole day was a Reloaded terrain day and it was great fun.


What you see above is the current state of my terrain prototype, which attempts to do three things. First represent some terrain height reference data 500x500 in size which is the maximum size of a Reloaded level. The second thing is that the terrain employs LOD for polygon creation so that distant terrain features are not given hundreds of thousands of polygons. The third is the whole thing is super fast and using as few polygons as possible and we'll add a forth feature which is that the terrain is completely dynamic, centered on the player and can be scrolled in all directions.

The only thing I have not done yet, and planning to do it after writing the blog is to stitch the LOD polygons together so they create a perfectly seamless wireframe from highest LOD to lowest LOD in the far far distance.  I've already done this successfully with the first two LOD levels, and it works nicely, so I just need to crack on and add more code.

A nice benefit of this technique is that once you reach the end of the defined terrain reference data, the terrain renderer just uses a height of zero for non-reference areas but continues to render the terrain to the distance. Effectively, the terrain does not end from the players perspective, you just run out of meaningful 'designed' terrain heights.

A Higher Perspective

I noticed when I finished the initial prototype coding that the terrain layout looks remarkably like the shadow cascade approach to LOD levels. The player stands in the centre, just above the terrain, and looking outwards. Given this perspective, the detail in the subsequent LOD levels does not have to be that pretty and in fact the stitching only really needs to happen on the edges you can see from the players perspective. Not sure if that observation converts to an optimisation yet.

I did a few quick optimisations already, including only updating the terrain segments when an actual scroll-event takes place. This rescued huge amounts of processing and made things very slick. Currently the prototype takes only 8000 polygons and runs at 2300 fps when idle and 850 fps when scrolling super fast. The vast majority of this is the writing of the terrain to the dynamic vertex buffer so in terms of CPU performance it's pretty good.

Legacy Fixes and Groundwork

As tempting it was to start terrain coding right away, I had to finish off the bits I left to create the 'Decent Demo' for the meeting a few weeks ago. This involved solving the shadow artefact in the map editor and also solving the issue of shadow Z clash when the light was perpendicular to a surface. I solved it by ensuring the regular lighting calculation modulated the shadow strength so that when the light is behind or 'at dot zero' I don't add any illumination so the shadow Z clash could be seen. The result is a shadow that looks 'just normal' which is exactly what I wanted to see.


As you can see above, by adding the latest shadow work to the instance stamp engine and map editor, as you add segment walls the lighting is applied instantly. Given the satisfaction of editing in this way, I am strongly considering leaving the 'real time light map baker' on standby and go for 100% real-time dynamic everything :)

Anyhoo, with those fixes dealt with, when the time comes to integrate the terrain stuff into the map editor, we should be able to see instance stamps and shadows as well without too much fuss. I also need to re-enable things like entities and other markers to the map editor, but that will come soon enough. Right now terrains are the only thing my brain is allowed to imagine.

Signing Off

A great day all told. A little more coding to stitch up the terrain mesh segments and then I think it's early enough for a nice supper and watch a Netflix movie.  That's my developer tip for the day, and probably a good life tip too, always treat yourself from time to time for a job well done, it will encourage a productive life and re-enforce positive action!

AGK V2 Kickstarter

I'm on the edge of my seat waiting for the total to push past £21K.  It's great logging on every day and seeing it creep up :)  Here are the stats at midnight:

564
backers
£20,927
pledged of £5,000 goal

23
days to go


Monday, 15 July 2013

Monday And The Return

Back In The Driving Seat

Freshly returned from the baking sun and rolling waves, I find my computer desk exactly where I left it, and the Reloaded project crying out for attention. Hopefully I can make up some time in the next few weeks, produce lots of cool things and restore the balance of Reloaded news in the universe.

Naturally the weekend was spent dealing with no less than 260 emails, half of which I could not delete. I then had a small mountain of paper mail, lots of personal life to catch up on and of course the final task this morning was to go through the progress of the last two weeks from our Reloaded team.

While I was sunning myself, our esteemed artists Mark and Peter have been producing juicy little nibbles for the Reloaded banquette and I can reveal some of the eye candy right for your delectation.


In the above video, you can see the final elements of the character animation being crafted to give a more realistic reaction to getting shot from multiple directions and from multiple stances. Arguably better than ragdoll, it will really help improve the dynamic feeling when in the midst of a Reloaded combat situation.

It seems Google Blogger cannot find Google YouTube videos, even when you give it the full exact title of the video so I had to resort to the above.  This video is hosted on our parent YouTube Channel in case you wondered.


Here is a shot from our new Quest system which will allow you to place images and text on screen when you chat with a character. It should be some helpful advice or a map to lost treasure ideal for a wondering hero.


The explosions also got a LOT bigger in my absence, with dark cloud flumes punctuated by orange blasts of heat. It's still work in progress, but I can't wait to blow something up when it finally integrates with the main engine!

The Two Weeks Ahead

My schedule for the next two weeks are pretty gruelling, in that I have to write a complete terrain engine and editing system which integrates with the main map editor system we have so far.

My short list is to be able to dynamically create terrain in real-time, with real-time vegetation, edit for terrain height, texture and foliage plus add the ability to walk on the terrain either through physics or a simple ray cast. All this needs to culminate in a demo at the end of the month which demonstrates the ability to select a terrain genre, randomise said terrain, edit it and then run around it. In addition, as the water table system is key to the terrain texturing system, a basic shaded water plane will also be introduced so bodies of water can be simulated too.

It's a tall order, but with some careful planning and single minded focus, I should get plenty done by the time I have to show anyone.

Signing Off

Naturally all I have to report so far is that my backlog is cleared, all Reloaded emails have been sent out and side tasks delegated. I have a few emails to send out after writing this blog, and then I dive deep into the world of generating real-time terrain.  Thanks for your patience and allowing me to swan off for two weeks, but I am back now and ready to report the rip roaring rodeo that is Reloaded.

AGK V2 Kickstarter

Another amazing bit of news that greeted me on my return was the huge success of the AGK kickstarter which we ran before I left for my holiday.


Fear not sports fans, my focus will remain on FPSC Reloaded entirely. This project is in the safe and skilled hands of Paul who has already spearheaded the V108 update and brings amazing new features to this product daily. The kickstarter has already passed three stretch goals and is set to hit a forth with over 3 weeks still to go.  The next stretch goal is the inclusion of Bullet Physics in the main command set, which will compliment the augmented 3D commands perfectly.  I am personally hoping we hit that one as the combination of 3D and Physics in a cross platform easy to use language would be an almighty boon!

Wednesday, 26 June 2013

Wednesday's Child

A Quick Wave

Today I am packing, printing out boarding passes and making sure I have everything for my vacation. I think I have delegated all my interests over the next two weeks so this will be my final blog post for a while. I had planned to blog every work day of 2013 but I did not think about holidays :)  I will make up for it on my return with more cool videos and perhaps a few betas for you lovely pledger's!

Signing Off

As a farewell for the moment, I have linked a video that made me smile and was also informative to existing FPSC users:

http://www.youtube.com/watch?v=-3ChyudNMLI

Until my return, good luck with your projects and see you soon!

Great News! AGK V2 Funded!

To our delight and surprise, the AGK V2 Kickstarter project was entirely funded in less than 24 hours!  It looks like Kickstarter users are now aiming for one or more of the stretch goals, and looks like Paul will have his work cut out :) Here is the link to the Kickstarter page:

http://www.kickstarter.com/projects/tgc/app-game-kit-v2

I will be sure to check on this from time to time when I'm in WiFi range, as I am morbidly curious as to just how far this project will be 'stretched' ;)  If you pledged as a direct result of my plea, my extra special thanks to thee!

Tuesday, 25 June 2013

Tuesday's Child

Cleaning Up My Brain

I am finding my run up to the holidays a time for backing up, sorting out my desk and generally getting all those loose ends tied off.  Part of that is to assign some jobs to my team mates before I swan off to hotter climbs in a few days.  I wanted to let you in on some internal inspiration material I have passed about which should give you an idea of the quality bar we are setting ourselves:



Just to be clear, this is not another preview of Reloaded :)  It is a game currently in development and set to be released for the XBOX ONE. Having created our tracer and explosion prototypes, we confidently moved onto pastures new. Having seen the above video, we promptly decided to backtrack and see if we could not make our tracer, explosions and fire modules a little bit better.

Bearing in mind the above production took hundreds of talented dudsters and probably tens of thousands of person-hours, you might think it quite insane to even dream of getting near this level of quality. I believe that having a mentor is a good thing, and if you're going to be mentored, it may as well be the best you can find.

Reloaded Work

Apart from cleaning, packing, thinking and delegating, I will be cramming in some Reloaded work this evening when I attempt to build up the ODE replacement to the physics engine. Using the all powerful Bullet Physics, I am hopeful to add enough commands to the 'Bullet Physics Plugin for DBP' to be able to add terrain physics and character controller physics to the prototype you saw in the video yesterday.  I think it makes sense to do this as my return in 2 weeks will see me start the terrain module of the engine which will add deformable terrain geometry and variable vegetation to the level system. In order to be able to test the result of this, having a physics system in place to allow my player to walk around the terrain would be a great benefit and also tick off one of those grey area boxes that asks 'can I generate terrain on the fly, and also generate the physics element of the terrain as well'.

A Head Full Of Oculus

I finally found time last night to unbox and set-up my Oculus VR headset, mainly to tick it off my list and see what the fuss was about. Now I know what the fuss was about and it deserves to be fussed about. I have tried VR headsets before and even have a product out right now that uses what I considered the best consumer device for VR. Well the script has been permanently rewritten with the Oculus Rift.  I will not wax lyrical over it as you can find plenty of that elsewhere on the Inter-web, and I will be putting it back in it's box now to prevent myself from being too distracted from my mission to complete Reloaded.  

What I can say is that combining this hardware with Reloaded would be momentous!  As I sat there, wearing the device, now standing on a balcony overlooking a Mediterranean sea with the soft wind blowing sugar stealer's around my head, calling up an on-screen HUD which magically floated there in front of my eyes, I started to imagine a product that allowed you to create worlds with a wave of your hand, the sound of your voice and a gentle nod of the head. For the first time I saw how a real holo-deck could be built and it was good.

Alas, I must put aside these flights of fancy and get my head back in the game. We have a killer product to produce and it won't write itself (yet)!

Signing Off

As an aside to my regular blog and sign off, you will find over the next 44 days an extra section which you will find below.  As you may know, the Reloaded project owes a lot to the Kickstarter concept, which indirectly breathed life into the idea by finding us a champion investor and we are now knee deep in development goodness. My colleague who now runs the AGK Development effort needs a similar boost, and we have chosen Kickstarter to fund that acceleration. If you can help him get those early pledges, even if it's just £3, it should put us on the Kickstarter radar and get some good exposure during the campaign.

Our Kickstarter Campaign

Rather than a banner and a link, I thought it better if I actually say something about what this evolved AGK product is about.  But first, here is a banner and a link:



As you can see, thanks to a strong AGK community, we've already pushed past the half way point and we only launched it this morning :)  I think what makes AGK so special is that it has all the ease and friendliness of Dark Basic, combining some of the best cross platform technology and made accessible by it's relatively low price and awesome community. 

It ain't no toy either! The last thing I made in AGK is now charting across multiple platforms, is battling healthily in the Educational paid top ten on iOS and is raking in a truck of money every week (admittedly for the publisher, not us poor impoverished developers) :) We've already had number one positions in the free charts, and that was before V108 added over a hundred new commands.  I am looking forward to seeing what Paul does with this accelerator funding, and especially keen to see what the AGK community creates with this awesome development tool, especially on the new platforms such as Ouya!