Monday, 12 August 2013

Monday A.I Time

The Week Of Artificial Ineptness

My schedule demands that my work begins on Reloaded AI, and it is this module I consider the most important part of the engine. I know it's a controversial statement but we're allowed our favorites!  We must take a rather basic blob and create logic around it so that a human player can be outwitted and beaten by said blob. No easy task I assure you!

We shall start with a rather inept creature, and work more cleverness into the clay to create a monster of hideous intellect and cunning. This is our mission.

However Lee

Alas before I can start my AI work with due diligence I have a final task to complete which pressed my attention into the universe of Asset LOD. I had almost forgot that I asked Mark to 'provide LOD with everything' and in order to make this manifest in the engine code is needed to make the models use the right level of LOD. 

Rather than code this in DBP (as the Character prototype used), I have decided to code it inside DBP itself so we get a faster form of LOD selection. A new command called SET OBJECT LOD will assign LOD levels and distances on a per object basis, but the selection of which model mesh to use will be done internally and automatically.

As I write this, I am mid-compile, half way through this work and once it is working with characters and the library assets I have so far, I will start my AI prototype.

The AI Prototype

I am strongly tempted to tack the AI work onto the physics demo as I already have the terrain and character capsules in place, but that might be a little vain of me. It is probably best I list out all the AI behaviors I am looking to recreate and get them working in a soul-less programmer art based demo that only shows the debug graphics I need to know the numbers are adding up.  Of course this means no Rick friendly screen shots or videos again, but I think it's probably the best course of action.

Developer Art Stopped Again

I've also been informed that my developer-art screenshots with the large red text makes Reloaded art looking even worse!  Rick has therefore imposed another ban on all artwork until we have a professionally produced 'developer-art-banner' to mask the in-progress shots.  

Down the road it seems likely that we will be taking this blog underground and deliberately separate it from any publicly discoverable PR material for Reloaded.  This way everyone gets what they want :)

The good news is that I got a new animation from Mark, so feast on the small amount of art I am officially allowed to show you.


This animation was added to the character set where the enemy can quickly kick open doors and start firing if they are in 'AI aggressive' mode.  It should make for some quick combat for the player me thinks :)

If anyone can tell me how to upload HD videos to YouTube, the comments section is your friend. There is no mention of HD in the basic or advanced settings, and no settings that I can see in the Upload page.

Signing Off

Plenty of work ahead of me in the next two weeks, which is my budget to completing the main parts of the AI system.  Granted other developers have a team of programmers and artists, and probably 6 months to perfect their AI entities, but a solo coder is able to make a few short-cuts in the decision making process and there is far less red tape.  It also helps that I have the infinitely powerful DarkAI and a top artist to help me!

Friday, 9 August 2013

Friday Video Time

While The Cat's Away

Another good day and pretty much wrapping up physics now, apart from the ragdoll of course, and to celebrate I have prepared a quick video showing the latest prototype and a screen shot for the fragile amongst you who dare not look upon pre-release content:


The preview video shows a few things, starting with the further tweaked water buoyancy physics and eventually the weapon being shadowed by the veg shadow map (not the cascade shadow map this time).


As you might also see I have removed the refraction in the water and kept only the reflection. The reason for this is that when many bodies enter the water, there is no performance friendly way of making the refraction intersection look good, and you end up with 'ghosts' of the object swimming about just below the surface.  This removal will also 'drastically' improve performance and give me other advantages as the water can be transparent again.  I think it looks just as good as a 'hero shot', and up close you will hardly notice the absence of refraction once I add some water depth effects and a few bits of wildlife.

Other Features Added

I tweaked the vegetation scales to match the new Reloaded asset objects, but until I get my buildings in with doors and windows, the final scale juggling will have to wait.  I added the basic weapon system in the latest prototype as this will eventually be improved to include the full range of weapon functions when the AI work begins. I will likely cut and paste from the classic engine as the gun system is quite evolved already (you only have to play some of Errant AI's weapons to see this).

Adding the shadow effect from the vegshadowmap on the weapon was also a very effective and relatively cheap thing to do, and I am considering dropping the cascade shadow map from 4 texture stages to 3, allowing a full-time slot available for the vegshadowmap.  Using this map I can do extra cool things like detect when a character or player is in shadow (very quickly) and maybe make some game play choices based on that (i.e. sneak-em-up games, enemies that avoid non-shadow areas) :)

I tweaked the overall physics speed and settings so small or thin objects no longer penetrate (or tunnel) the terrain mesh, but of course we won't have final settings until EVERYTHING is in.  Still, pretty happy with the behavior of all objects now at 60 fps.

Early AI Work

I also got a glimpse of one of the key features of Reloaded which is enemies that can 'hide around a corner'.  Here is a screenshot you should not take too seriously:


A great first prototype from Paul as it showed right away the red cone enemy getting behind a corner and staying there just out of firing range :)

As you can see, in the above shot, the white sphere which was 'me' forced the red cone to hide around the corner, but my two green allies sneaked around him and blasted the guy in his hiding spot.  A little bug or feature exists where the red guy will just sit there in his hiding spot being blasted by the greens, but I am hoping Paul reads this blog and puts something in the 'self preservation' column so the red guy just runs away once truly and sufficiently pummeled!

Signing Off

Will spend some time chilling this weekend, but should find time to add the character model to the physics prototype and get the weapons functional. I can then start the process of incorporating the new AI system into a relatively good looking prototype.  A kind-pin feature of the AI system will be the 'super building' concept, which is something I hope to reveal to you in the next three weeks.  

Hopefully my Friday video will make up for the media black-out from the last two weeks, and providing I can get away with adding silly red disclaimers on my work in progress shots, you can continue to get some uber-early developer eye candy.

Thursday, 8 August 2013

Thursday Tea Party

And Then They Came

For today's progress report I invite a few friends to the development tea party in the form of some new assets from the department of Mark.  I added them to ensure they comply with my physics universe, but aside from some physics object centering, all went well.


As you can see, they live happily in the scene and represent the dynamic and static entities of our little drama.  They will require some unique shader to oblige them with pixel perfection, but they sit nicely on the floor and the player responds to them properly by pushing the dynamic ones and stopping at the static ones, and climbing over the small static and dynamic ones thanks to the kinematic character controller.

I knew some of you might not like this one, so I brought in a few visual friends, and added a bush too. This one might be more to your liking:


You may notice the blue barrel in the water, in the distance, bobbing about having accidently rolled down the hill when I started the prototype :) Such is the nature of live experiments, and the source of great fun when it's your turn!


Also, this scene is being rendered without any sort of shadow or shader cleverness which would bring out the materials available to me. This shot is from the physics prototype which attempts to assess object sizes, physical behavior and to some degree game speed.

Signing Off

Unfortunately, I went for a walk today to get some fitness back in my frame and came across a hedgehog caught in some fish netting. So entangled the little creature was that I lacerated myself attempting to pull apart the plastic cord that constituted the material of the offending object. Eventually, a pair of scissors materialized that made the whole rescue much simpler, but not before I was bleeding all over the place.  Hedgehog 1 Lee's Hands 0.

The Hedgehog Made A Full Recovery - Lee's Hands Didn't!

Still have the dilemma of ragdoll to think about, but thanks for the comments so far!  Understand I will always be adding ragdoll, it's just a question of when. I believe a complete game engine that runs fast precedes the ragdoll feature, but that probably goes without saying and expected. The issue is whether I should get the 'game engine' but running first, or the 'ragdoll' bit first :)  As you can imagine, I am anxious to see what the in-game play-ability looks like before I fiddle with the specific details of each module.

I had hoped to get the weapon system incorporated to the physics in-game proto, which I am warming to the idea will become the main in-game loop for everything, but my pre-occupation with importing the various entity objects and 'playing with the physics world' side tracked my ceaseless march forward.  
Hopefully I can make up some ground on Friday now I am pretty certain any entity, whether static or dynamic can sit happily in the universe without misbehaving.  Whether that can be said for the player controller or ragdoll enemies remains to be seen :)

Wednesday, 7 August 2013

Wednesday Water Physics

Lots Done Today

My plan for today was to add jumping, enemy capsule entity, speed up the physics terrain preparation, speed up the general engine and if time, add water buoyancy.  The great news is that I have added all of the above.

Figure 1. A few pallets dropped along the shore. Some floated away!

In fact, most of the list was done relatively quickly thanks to a great Bullet SDK, but the water buoyancy was something else. It transpires there is no native support for this, and so I had to write it myself and what fun it was too.

True Buoyancy

This is not the basic 'if it's below the water line bring it up' physics, but the 'float my pallet across the river so I can jump on it' style. For this, I needed to create a small system which detected the key 'flotation points' for an object, then apply various upward impulses to the object when in the water so it would rotate and respond correctly, just like a real object would.

The time consuming part was tweaking the various velocity, dampening and water line curves to make the whole thing seam natural, and also to ensure all my objects bob evenly between above and below the water line (not easy). Still, the hard stuff is done now and I am running out of physics components to prototype now.

Ragdoll Physics

I am sure there will be a big demand for ragdoll falling, even though I don't regard it as an 'essential feature'. We have some really excellent death/fall animations now, and no ragdoll can beat them in my opinion.  I will study the remainder of my schedule for this week and make a decision whether to prototype the ragdoll into the character (which could take days) or wrap up the physics prototype with a full first person player control system including weapon, sounds, firing, health, falling, e.t.c.  This also will be the precursor to creating what will become the main 'game loop' module, which controls pretty much the entire in-game experience and the first of the final 'mega' modules that when connected with other 'mega' modules will become the final product.

I will leave my brain and your comments section open for inspiration whether it makes sense to add ragdoll now, or get more of the main game elements connected and come back to ragdoll when the time presents itself.

AI News

Some brief news from Paul and AI work, in that we have a small 'theoretical' victory on the 'hide behind a corner' behavior of the new AI entity system. This single ability will really test you as a player in a Reloaded game, as now the enemy can sneak about and peek at you from behind walls and door frames, neither of which you can shoot through!  Your sniping and blatant shooting days are over if this feature is as good as I imagine it to be.  More news on this and other AI goodies next week!

Signing Off

Probably coded a little too long today, so waking up Thursday might be a challenge but one can but try.  Remaining tasks, not including ragdoll, would be to add static and dynamic entity tests, static geometry segment geometry and the 'very small object' test to ensure our grenades, mines and small keys don't fall through the floor as they affectionately did with FPSC Classic :)

Tuesday, 6 August 2013

Tuesday Roamer

Roam and Roll

Today was spent adding the proper player controls to the physics sand-box prototype I am working on, which means proper strafe, acceleration, smoothing, speed for walk and run, pretty much everything except jump. I threw out the terrain ground height check, and replaced it with the final Bullet Physics character controller, minus the mouse look camera rotation stuff which was kindly provided from my early 'decent demo' prototype.

The result was pretty good, and I was able to run around as before, but critically not be able to run up the steep hills as the step value was sufficient to block my player character doing that (as intended). I then dropped lots of physics objects which I have also enabled through my new DBP bullet physics command set and all was good.

Troubles

Two things plagued me during these tasks. The first was that the performance was not 'great' once I added the 16 million triangles needed to accurately simulate the terrain floor for the physics system, and the general speed of moving physical objects did not seem right.

It was though I existed in slow motion and that to get any decent speed I had to be travelling at quite a high velocity to get moving. The basic problem is that Bullet expects the ratio of 1 unit = 1 meter, whereas the FPSC universe up to this point has been 1 unit = 1 centimeter give or take.  Given this, my objects are considerably larger than Bullet expects them to be, and create these slow-motion artifacts which spoil the fun. I can increase gravity, and decrease mass but it's not going to work flawlessly if I start guessing.

What I need is some real special math and lots of new Bullet settings to create a world that makes my 1 unit = 1 centimeter universe perform as though the real world has hold of my physics objects.  I suspect this means some deep Google search research come Wednesday.  Sure, quick hacks are available and I can move on to some degree, but the physics will be with us a LONG time and I want it to be mathematically sound before moving too far.

Cheeky Visual

My blog readership has dropped away somewhat since Rick's decision to post anything other than near-finished visuals, and I am a bit miffed about that. Nothing egotistical, just that you guys and gals will vote with your visits, and it tells me you tune in to more Reloaded news when there are visuals to look at.  To that end, I have posted a sneaky one below and added some disclaimers all over it so there can be NO confusion that this is work in progress art and should not be considered finished material we are going to send to the printers on Monday.



As you can see, looking past the disclaimers, I am using a sandbox test prototype with the terrain visuals stripped out so I can focus on the physics shapes and simulation.  You are looking at the aftermath of a stack of crates that fell over because they are placed on a slightly sloping terrain, and then a sphere barreled down from a high hill and smashed into them.

Signing Off

I have deliberately ignored my emails today so I could focus on getting physics to where I wanted them to be.  As good as this excuse is, the real reason is that playing with physics is SO absorbing, I spent a good deal of my hours re-running the prototype and following barrels down steep hills and watching them make subtle course corrections each time they hit a bump. 

I would not be surprised if many users will be making obstacle courses rather than games with Reloaded when we release this puppy :)  I have a few more days on physics, and then straight into A.I, so Wednesday will be about getting the 'enemy character' physics object in place and doing all the things that entity needs to do (i.e. push crates out the way, walk on the floor, e.t.c). I will also add jump so I can walk around on those screen shot crates and see what happens. Will I fall through them, will they fly away, will I jiggle up and down, tune in tomorrow!

Monday, 5 August 2013

Monday Mobile Hell

Work Side

A good day today, though spectacularly un-visual in nature. Spent most of the time preparing a new module for the main engine under the title of Physics, which will be used to plug into the main engine but also allow me to prototype just the physics elements of the system.

I used the terrain prototype as a starting point, and stripped it back but retained the terrain basics. This way my physics tests can be based on the actual terrain surface, and as elements are introduced they can interact with the universe 'from the ground up' so to speak.

Right now I am just about to finish the character controller so that it does the most basic function, which is to move a physics capsule around based on the move direction. I need to strip out all the view point related stuff from the example I am using to cut and paste from as this has already been taken care of from the 'It Came From The Desert' decent prototype from a few weeks ago. Hopefully in the next 24 hours I can combine the fluid control system of that demo with the physics underpinnings of the current one, then I can have fun with dynamic entities, dynamic enemy characters and 'maybe' buoyancy (not to mention all that boring static geometry stuff) :)

Play Side

A few precious hours of my day have also been gobbled up by the seemingly callous treatment of Vodafone that seemed to have started at the weekend. The bottom line is that I have no mobile phone coverage, and the information from Vodafone is sketchy at best, with many forum goers complaining that the 'telesales' customer support service are fobbing them off along the lines that 'there is no problem and it must be the phone', even though there own website for coverage states "There is a temporary fault which may be affecting the coverage in parts of this area.".  I rarely phone those guys anyway as it's not fair asking them questions that aren't printed in their script ;)

As a 'little person', all I can do is wait for this massive corporation to (a) acknowledge officially that there is a specific issue, and (b) to fix it. In the meantime, anyone thinking of renewing their contract with Vodafone, you might want to check your coverage before deciding ;)  These days, the 'little guy' can be powerless, but in this case having a moan about it to a few thousand of my closest friends might be enough to tap them on the shoulder, and maybe, some Vodafone representative might read this and make something happen. I highly doubt it of course, but that's no reason not to try!

For myself, I hardly use the mobile and have alternative methods of connectivity, but there are a few businesses around here and they're all suffering from this clear policy of plausible deniability, and at the hands of a company who should be on the forefront of 'connected' customer services, and a simple post on the Network Update forum to describe the problem and the expected repair time would be a thousand times better than what we have now.  And now, I will step from my soapbox.

Signing Off

I am sure my rant will come back to bite me if TGC should make the same transgression and not listen to the concerns of it's community. If it does, I would be very happy for someone to send me a link to today's post, to remind me of just how personal the situation can become when something impedes your day, and how simple the solution can be to resolve it.

I am not sure what visuals I can present this week as physics is all about maths and the movement of values, but perhaps when I have a barrel rolling down the terrain and the player chasing it, it might be video worthy!  That said, I don't have a Reloaded barrel yet ;)

Friday, 2 August 2013

Friday With Visuals

At Long Last - Terrain Visuals

If you are a subscriber of the TGC newsletter, or subscribed to our YouTube channel, you will no doubt be aware that the rest of the team have beaten me to the punch and released shots and a video of the terrain module.  Allow me to supplement this material with some of my own.


Thanks largely to a lot of help from the Blitzwerks Terrain plug-in for Dark Basic Pro, I was able to complete the editing and playback parts of the terrain module in less than two weeks, and I am pretty happy with the result.  I am getting good performance, and thanks to Mark we have some gorgeous textures and shader insight to lavish on you.

We've decided to focus on a desert theme, which will compliment the other assets we are doing in the desert third world style. It also allows us to come back in the future with a green, forestry make-over to knock your socks off. It is also an honest genre to use, as the terrain is often bleak and lifeless, and if we can get THAT to look good, then we'll be laughing.  Please don't ask me why there is lots of water in our desert, we just thought it looked cool :)

Terrain In The Game

The next two videos are from the in-game prototype component, which shows a few key features we added to create a believable landscape. Obviously the water shader, which uses reflection and refraction effects, plus a rather nifty idea by Evolved which uses a water mask to soften the interaction with the shore.  


You will also see a patch of shadow coming from the high rocks, which is a technique I intend to optimize and internalize as a C++ routine, partly as this would then afford me the opportunity to thread it and get some serious speed up when generating this pre-baked data.


The vegetation takes the shadow from the terrain itself, and also moves the plants around and oscillates their color slightly to give them more life, and they can be rendered at different sizes to mix it up a little. I have more plants, and might create a system where several grass types will occupy the same clump area, but we'll come back to that when more essential matters are taken care of.


One of the last things Mark did was enhance the vegetation shader, as shown in the above shot with more detailed grasses and a reflective term applied to the grass directly under the sun.  It's subtle, but that's because I went in and modified the shader to tone it down a bit (I am expecting an angry email from Mark any day now) ;)

Terrain Editing

The editor is really my pride and joy because it is here where you will be spending most, if not all, your time when creating games in Reloaded. I only intended it to be a basic slope editor, so you can run some ground up to the side of buildings and have a nice curve or steeple effect. What I ended up with is a sculpture and paint system so cool, you could almost create buildings out of the very terrain!

I am the first to admit the 8 modes currently in the editor are opening shots across the bow of this terrain module, but they are pretty useful and probably represent 80% of the tools you would most need.  Once they are in the main engine, I will probably add a few more such as smoothing tools and perhaps more painting modes (i.e. paint highlights and dark patches, basic colors, e.t.c).  I won't be adding texture stamps at this stage as the performance hit was getting in the way of adding that one quickly, but I have a few ideas to mull over and more on this when we take the terrain module back out of the box and shake it up.

The system can save and load terrains, complete with what you painted, it can automatically spawn rocks, shadows, water masks, vegetation and even generates a realistic random terrain using a diamond-square technique.  The final bits will come in the form of improved textures, shader tweaks, small editor and in-game performance improvements and testing.  I have decided to post-pone full engine integration until I have the physics complete, as they pretty much go hand in hand, and when you press the big green test game button in the Reloaded IDE, you really want to stay on the ground when you walk out of a building.

Here is a video Rick produced when he got his hands on the prototype earlier today.  I think he needs more practice  but it did not take him long to find and use all the features, a good sign:


So with terrain pretty much boxed in, I move swiftly onto physics and a little AI work too.  The good news is that despite the meeting and a few other distractions, I am on track with the physics work and have a character controller wandering over the terrain height data, and dynamic objects raining form the sky. I also send off a very early prototype of the DarkAI system to Paul, to resolve a little issue with line of sight through mountains.  Even this early prototype has found a way to generate obstacle data from the terrain heights so that when an AI entity navigates to a high vantage point, they figure out that they cannot just take a direct line up a steep slope, but have to walk around until they find a slope that is acceptable. A very nice idea from Paul and implemented in less than 30 minutes ;)

Signing Off

Again, I have more 'crappy' visuals from my physics and AI work that I would like to show you, but I fear the almighty glass eye in the sky will frown upon my transgressions.  I did have the idea though that as we move forward to a beta release, we start an 'official' blog which Rick can author, featuring all the lovely final art and choice eye candy for the masses.  This would then allow me to move my own blog underground, and provide the link only to pledgers who are beta testing and following the internal development. Properly plastered with warnings and conditions, I think we should be able to get away with a more open policy on screen shots if there was something official to distract the buying public.

I honestly believe something was lost when we did our black out trick, for now you do not have the visual log of how that horrible green blotch of a screenshot you saw two weeks ago turned into the terrain module you see today.  You also did not see all the dead-end versions of the prototype, which might have triggered some stimulating conversation in the comments section and give rise to a new terrain idea. Ah well :)

I hope you enjoyed the terrain videos and if you are lucky, I will make one more which features the editor itself and give you a whistle stop tour of the features and the thinking behind them.