Thursday 28 February 2019

Lurgy, Ninja Type Dudes, Parallax, Fat Assed Robots and Cat Ears

Last month was all about tentacles. A swarm of tentacles is a fairly big thing, that acts as a movable barrier which can corner an unwary player and slap the hell out of them. One thing that I noticed was that they can turn on a dime, effortless switching direction, which for a big unit looks rather odd. See video below:

Testing Terrifying Tentacles!

So I went off hunting through the movement and aiming code to make the AI use a system similar to the player for rotations. Initially I spent all my time looking in completely the wrong place ... something which seems to happen a lot ... before finding the correct file class and adding a delay that could be set via the objects datablock. This way, small, nimble enemies can turn faster, and hulking great things like tentacles a lot slower.

 Turn Speed; fast, medium and slow

Of course things couldn't just be simple and I quickly realized that my entire AI attack routine was designed around the length of each enemies attack animation - and very few enemies share that data. So an enemy would turn to face the player head on, then start their attack animation and then ... well the player was miles away and out of range. To prevent this obvious pause in starting their attacks I had to write a little snippet of code that took each AI types turn speed, angle required to turn and time to swing at the player into account to make sure that when they landed their blow, it would be at the optimum moment to actually hit their target.

All whilst I was attempting all of this fancy maths malarkey, I was riddled with the vile pox of the lurgy, with puss and ooze coming out of all corners because it's winter and stuff.

Being ill really hampers your ability to into 3D vector math ...

This brings me on to modelling the last standard enemy for the game. I still have all the bosses to do (cries into hanky), but the game's rank and file enemies are not complete. Having come up with a rather interesting shader of floaty goo a bit like a lava lamp, I settled on a spear wielding opponent that looked a bit Ninja-ish and called, for want of a better description, the Shadow Sprite. I added that triple eye motif that I see in a lot of Japanese stuff as a signifier of Buddhist mysticism - like that guy with the flour bag on his head with the triple eye motif on it for ... I don't know ... reasons I guess. Having a spear gives a longer than usual range melee attack but also has a narrower angle. Cue me having to go back create new code dealing with attack radius ... radiuses? radius's? radii?

Shadow Sprite surprise!
With the final mob enemy for level 10 completed I set about testing "extended play" aka "endless mode" and found that the difficulty level ramp up quite nicely so didn't really have to tweak my challenge code. I also added a visual effect for deceased radioactive enemies to make it more obvious to the player that there is danger. Some of the enemies spawn as "elites" of various kinds and radiation is one of these. Now when I radioactive enemy is killed they leave a warning sign that that area will cause damage if the player enters it. This only lasts for three seconds.

"Ra-di-a-tion. Yes, indeed. You hear the most outrageous lies about it. Half-baked goggle-box do-gooders telling everybody it's bad for you. Pernicious nonsense! Everybody could stand a hundred chest X-rays a year! They oughta have 'em, too." - Repo Man, dir. Alex Cox, 1984

Having a break from modelling I had a look at how the PBR branch on github was doing. Rendering really isn't my thing and material systems probably even less, so I just nodded a lot ...

No idea what's going on but debugging does look pretty

Having spent rather a long time on animation and characters and the like, I went back to trying to remember the work-flow for materials and in particular parallax. I found that a rather enormous 12.7mb 2K normal map texture with a heightmap in the alpha channel didn't seem to have much better quality over half the size which only weighed in at 2.4mb, which is quite the saving for VRAM.

2048px 12.7mb top, 1024px 2.4mb bottom. I can live with that.

Finally I got round to thinking about the yellow placeholder cube, who has represented the player for nth years of development. Filled with horror at the thought of actually having to paint armature weights and rig a character from scratch I booted up the medically resourced makeHuman with the intention of exporting a basic mesh character to work on in Blender. I quickly found that COLLADA export is not that friendly to bone angles with everything defaulting to just one direction rather than following the skeleton, but FBX preserved the bones correctly.

As a test, I had a play about with the sliders to see if I could make a physical match for the 2B model from Nier Automata. Surprisingly only the pinched waist being beyond the standard sliders from the model silhouette I was working from, and the only maxed out sliders were the butt ... which is kinda understandable, considering this is the robot with the highest polygon count arse in gaming.

 All the polys ...

 When you spend all the VRAM on polygons for the robots butt, and can't afford HD textures on the scenery ...

Anyhow, I gave the proportions I wanted to my base mesh, learnt a bit about exporting and then started customising it in Blender. I've started off with a fairly high poly mesh until I decide on what I actually want so that the high and low poly versions will (hopefully) look the same.

I seem to have spent an inordinate amount of time tweaking cat ears into just the right angle even though I am fairly sure it doesn't matter, but hey OCD and all that ...

So, that's a start on a base model for the player. The idea is to have a high poly model for intro and cut scenes, as well as an animated "Doom" style bust view in the GUI where placeholder banana currently is. However I do kind of think that it might be a bit small for an animated character to be pulling faces from. Once I finalise what the character needs to look like from the rather hazy description I have in my head and multiple character types required, I'll start on the low poly version that will actually be in the centre of the screen, under the player's control.

February has ended and it is officially Meteorological Spring.