Thursday, 31 January 2019

Terrible Tentacle Terror!

So, I managed about 3/4 of Dry January before falling off the wagon. Not a record by any stretch of the imagination but there was a solid few weeks without any booze in there.

Back to gamedev ...

In the last month of the last year I left on the nail-biting cliffhanger of ... modeling yet another enemy. So yeah, 3 years in, and the player is still a placeholder cube ... anyhow, back to that enemy character.

 Tentacles, in gloriously awkward to animate 3D

Tentacles. The scourge of cartoon schoolgirls everywhere (okay, only in Japan - literally nowhere else in the world, it's just Japan).

Cthulhu moves to Japan ...

It turn out that one thing a big bundle of psuedopods has trouble with is avoiding clipping into and colliding with each other when you use the minimum amount of keyframes in an animation. Tentacles turned out to be not that difficult to animate, pose into a nice, organic tentacle shape one way, then n frames later and another keyframe the other way. Let Blender 3D do the "tweening" (which is an animation term apparently for automated process of animating between keyframes) and then tweak the middle frame if it looks funny. Unfortunately there was a lot more frames which ended up needing "tweaking" to stop the writhing mass of extremities becoming a jumble of clashing appendages.

Did I ever mention that everything in game dev takes way longer than it would first appear to? Oh, every blog post? Yep, right ...

Placeholder cube getting snug cuddles from tentacles

Anyhoo, eventually said tentacles where animated, calibrated, datablocked into actually enemy AI and unleashed into a game level for tweaking - and boy did they need some tweaking. Player ended up squished rather quickly, then it was a case of tweaking data from too easy to too hard until it met in the middle somewhere.

Big tentacle, little tentacle

During testing I noticed an issue. Every so often a tentacle would fall from the sky past the camera to where it was supposed to be in the XYZ of the game world. I've seen this happen with other models  before and each time I fixed it and then forgotten what the cause was. The last time I fixed it I remember thinking that next time I will know the cause adn solution ... except for I have forgotten it again ...

I went back and checked through my written notes on exporting animations and then through all my "how to" forum posts ... and it looks like I didn't record the reasons anywhere. It's got something to do with animation or COLLADA format export - but that's as good as my memory is helping right now ... so a bit more testing and tweaking of the model and exporter is required,

Tentacle surprise!

I also made a whole load of really cool effects, like spawning and fleeing and attacking - but in actual playtesting there was so much going on that a lot of it is easily missed and the constant rattle of tentacles bursting through the ground gets rather annoying, so I plan on simplifying the audio and also some of the particle effects.

So, that's pretty much January covered. There was some other maths related stuff concerning getting player evasion to trigger the way the player is moving when it's different from the way they are facing - which ended up being more difficult than expected because I forgot to take randomized camera rotation into account on spawning and also forgot about normalizing vectors in 3D space - but it was mostly tentacle animating.

To be continued ... possibly indefinately at this rate ... naw I'm just kidding, I'll ship before Half Life 3.

Monday, 31 December 2018

Space Year 2018 Where You Go?

2018 be like ...

RIP 2018

And so all good things come to an end ... and so do all bad and indifferent things too.

For December I spent most of my time starting early on that festive gorging ...

Me, one week into December
Me, December 31st

However it's not all been shoveling cheese, pate, chocolates, nuts, unidentifiable high fat stuff and booze down my cakehole as fast as possible. It's just that it's been mostly that ...

I've spent the dev time this month mainly on balancing my still untitled top-down, twin-stick, mecha-musume, nekomimi, Swag 'Em Up. This has led to a fair bit of tweaking and minor/major adjustments as I test full playthroughs to make sure things don't become overly difficult - if the creator cannot escape a level how on earth will a player?

I've only 2 more levels of enemies to model and animate. One of these enemy types are tentacles which I had been dreading from the animation point of view. However I managed to find a good monster model with plenty of tentacles and animations which could serve as a basis for my own work. This model had a whopping 170+ animated bones which exceeds the engine capacity for a single armature. Happily I only wanted the tentacle bones and so could delete the rest, but this still came in at a rather whopping 18 bones per tentacle for 6 tentacles. Now whilst only the level boss monster will have all the tentacles with the standard level enemies ranging from 1 to 3, I felt that this number of bones could still be halved with a bit of merging weight painting and manually repositioning animation keys to make up for the reduced transforms.

Tentacles, the scourge of cat-eared, cartoon schoolgirls everywhere ...

I also found another boss style monster that had some great animations for special attacks and the sort, so added that to my ever growing library of commercially licensed animations.

The cunning plan for 2019 ...

Finish off the last 2 level monsters, something I had hoped to have completed by now but meh ...

Create the boss models and animations. Each level has a cat/fox/etc eared defender, often accompanyed by a larger monster to do all the dirty work whilst said fluffy eared guardian shout abuse at the player from an animated GUI box.

Sort out the remaining special item models and animations.

Both of the above points feature around the player models. (Hopefully) 2019 will be the year when the yellow placeholder cube is retired in favour of (multiple) player characters. I am planning on having around 8 playable characters with differing abilities and special attacks, and so far have 2 of them fully coded.

Anyhow, roll on January so this festive excess can finally end ...

Sunday, 25 November 2018

Dimensional Knight Animation Anarchy

Remember this guy?

He is one of two Knight models which I customized into my Unstable Dimensional Knight enemies all the way back in summer (summer now a distant memory as I hundle under a blankie whilst freezing rain peppers the external windows). Dimensional Knights suffer from "instability", something most RPG and fantasy wargamers know affects inter-dimensional beings, and that's why parts of them kinda of warp in and out of existence. Whilst the models were good quality and rather (too) detailed - way more polygons than I need - I found that their animations were a bit lacklustre having not been based from motion capture footage. Not particularly seeing any mocap which I liked for a reasonable price commercially, to get some decent custom animations I decided to amalgamate their stock animations with some free mocap and rotoscoping - the latter being a horrbily time consuming animation but more exact than "best guess manual animation", at least for positioning large items like limbs.

And this is where total chaos ensued.

It didn't help that was now using three seperate armature rigs (skeletons and bones), what with the bvh format mocap files being different structure from the models' source files which were different from my generic animation rig. Now it's not too difficult to rename bones, animations and mesh vertex groups, except at some point quite early on, I changed the basic non-animated root pose - thus throwing all the rotations for animations off. Annoyingly I only realised my mistake towards the end, and with four variants of two models, ended up having to manually repose all eight enemy models individually by a mixture of copying coordinates and using the judgement of the old fashioned Mark 1 Eyeball. Between this and manually merging different animations together along with rotoscoping over other animated meshes and video stills created a huge gravity well which sucked in vast amounts of time and effort.

Eventually I had a two spawning animations were our Demonic Knight salutes or issues a challenge to the player, two idle animations with some weapon flexing, three attack animations, one leaping overhead special attack animation and various jump, fall, land and other animations.

 2 models, 2 idle animation poses, 4 colours

Then there was the slight issue of how to get this enemy type to move. If you are an "Inter-Dimensional Being" then walking seems like a rather mundane method of traversing the game world. Having them just ski along in their root animation made it look like I couldn't be bothered doing a movement animation so instead I created a floating animation. This also looked a bit unexciting at first, initially because the animation resembled the "T-Pose" that many models revert to when they are not animated. I changed this to create two seperate movement animations, one were the enemy holds their weapon in front of them a little like the holy pose that sculptures on the stone coffins of dead knights have, and the other were they are reaching out towards their target with one hand and raising their sword as a sort of challenge in the other.

To the models I added some extra effects to give them more of an other-worldly feel and an intimidating presence of power. One of these is a simple translucent cloud which looks like a particle effect but is actually just three rotating textures of differing intensity and colour. The other is an aura of power on the ground which is connected to the enemy's animations. This gently pulses when they are not moving, spreads and rises during their attacks, and shoots up to envelop the model when they move, making for a much more interesting floating animation. They model also elongates slightly when they move which makes them more intimidating. To the Knight's textures I added a bright animated outline to help with a shimmering glow around the edges and dropped the actual glow shader I had been using on the materials. This reduced drawcalls by a couple whilst reducing the need to draw an extra 27K mesh triangles. As one of the models was a 16K triangles, I decimated it automatically down to a more manageable 12K with no visual impact.

I created a new special attack for this enemy type which involves them teleporting close to a clear area near the player. They start their special attack animation of a jumping overhead axe swing and particle effects surround them and the position that they will teleport into to complete their attack. This gives the player 1 second of warning to get out of the way. Initially I also created an invisble collision shape into the area to block the player and other enemies from occupying that space but realized that it would interfere with how decals are positioned, so I swapped the collision mesh for a physics zone which keeps other enemies out of the area but can slow the player down if they enter it. This seemed to work rather nicely. Originally all of the Dimensional Knights had this special attack but as I based it off the movement phase rather than just the attack phase I realized that would cancel out directly hunting the player as an option to the enemy AI's thought cycle. Now only half the Knights have this teleportation attack whilst the others move as normal, either heading for the player's last position or following directly as a hunter.

Here's an early look at the Dimensional Knights in action before I had finalized their animations.

So that was the Unstable Dimensional Knights of level 7 completed. A tough slog which took far more time than I wanted ... but I say that every month when I write these blogs ...

So, what left? There are a few more enemy types I want to make. Going back to the old Monstrous Morris Men Wendigo style enemies, I want to add a nymph-liek character with a special attack that includes a dash through the player, however as they will share various animation characteristics with player characters, that is something to leave until the more monstrous monsters are done (rather than constantly going back and forth between things). So next up on the list of over nine thousand things to tick off are those of a more Cosmic Horror motif. Cue tentacles and Lovecraftian madness ... and Lovecraftian madness seems to be a good description of indie game development ...