Thursday, 31 October 2019

Spooky Day: Space Year 2019


It's All Hallows Eve ... want to see something truly terrifying?

http://www.nationaldebtclock.co.uk/

Are you OK? Have you recovered? Take a few deep breaths, I know it was a terrible sight ...

In other news I have mostly been injured ... from doing nothing as usual ...


My neck went, then my shoulder went ... and now my neck has gone again ...



Okidoki, that's enough sniverling - back to the blog ...



I was testing a new binary of the PBRtastic Torque 4.0 version 5.0 build when I noticed many things were amiss. After much wailing and nashing of teeth and complaining to other people at the otherside of the planet that it was everybody elses fault ... I concluded that I was using the wrong branch ...

 Ahem ...

After this I managed to get some PBR catgirl with working transparency on show.

 Ears go up, ears go down ...
 

I also managed to break everything horribly by mistake ... but that just tends to be one of those things I do ... at least this time I knew how I did it so I can avoid doing that again ...


I tried to delete all of the shaders and ended up wiping out the ones which controlled the GUIs in the editor so none of the text would show up. Next time, delete the internal shaders manually ...

I had been planning on doing more on creating a new level featuring an abandoned and overgrown industrial site, but only got as far as stripping high density models down to a more workable poly number.


Pipes, need lots of pipes for industry ...

So, that was the month that was ... which ended up as a bit of a wash-out ... normal service shall hopefully resume November ... which incidentally, is the date in which Blade Runner happens ...


Monday, 30 September 2019

Big Boss Battles


The Big Lad

So after the joy/struggle/despair/awkwardness* (*delete as applicable) of learning how the new Blender3D works and then creating an actual character to replace the player's Small Yellow Placeholder Cube, it was time to go after the remaining Big Red Placeholder Cube which had been standing in for the level boss character.

As ever things went horribly wrong for seemingly know apparent reason other than the entire universe having it in for me.


I had split up animations from the actual mesh - that way it keeps loading times down whilst changing things on the fly during development, and means that multiple models with the same armature skeleton can share animation data and thus reduce file sizes - when suddenly everything stopped playing nicely and went back to mutating into a horrendous mess of twisted limbs and multiplied rotations.

The reason this time turned out to be because I was exporting the mesh model in the first frame of the root animation - which is what you would want for blended animations - but I should have exported it out in a copy of the rest pose ... regardless of the fact that this had previously been fine with another model ... which meant that the solution was far down my list of things to test to see if it worked ...

Exporting COLLADA/DAE format from Blender to Torque has become even more specific in Blender 2.8, mostly due to there being a huge number more options available and thus a huge number more things to possibly go wrong ...

https://pbs.twimg.com/media/EDtDhZyXoAApzaI?format=jpg&name=large
I before E except after C ... Also Hierarchy which breaks the rule, and hierarchy is very important ...

I ended writing a little explanation of Blender3D to Torque3D Collada exporting and the importance of hierarchy over on the forums.

Eventually I managed to get "The Big Lad" - as he is currently known unless I can think up a name later - into the game and working. Here's a quick look at him in action. I say "quick" because he squashed me in not too much time. Select quality 720x60fps manually or youtube's autoHD says it's selected it but it's telling fibs.

I fearsome foe! Especially as I end up as pate ...

Apart from that, I modified my laser-beam-wielding veclociraptors by adding helmets and power-packs to them so that they now look different from the other dinosaurs which just bite.

Sharks Dinosaurs, with frikken laser beams on their heads!

I also spent some time modelling industrial scenery, lots of pipes and stuff for a forthcoming level. This will be the fifth level in the game, out of a total of ten - though they will loop for long play. No actual pictures of that yet as it is still all in bits.

So, that was the month that was. It got really warm and now Autumn has truly arrived and I've put socks on. Lot's of other things happened game development-wise but I can't really remember them. Next up is the Overgrown Industrial Level which has been reclaimed by nature, and more boss monsters.

Saturday, 31 August 2019

Placeholder Yellow Cube Has Been Retired

Don't mind me, I'm just retiring a yellow cube.


If you want to be pedantic, it's actually a rectangle.


And here's it's replacement going all John Woo/Chow Yung Fat/Revy with dual wielding pistols.

Ooooh looks gamey!

But first to Blender3D 2.8. It's the newest version of Blender3D with a whole host of changes - like inverting mouse buttons for selection ... which is gonna take some getting used to after 15 years of it being the other way ...

However it did have a new addon I wanted to test out, an addon for generating LODs (level of detail) for my high poly mesh by creating retopology of the mesh automatically. What I wasn't expecting was for the new Blender 2.8 to hunt down and retire my older version of 2.78c which was in a totally different directory location.


So it turned out to be time to learn the new Blender whether I really wanted to or not ...

This was going to happen anyway due to the new Blender being all PBR and stuff ... it's just that I wanted to worry about that later, but now I had to worry about that now. The first problem was ... well ... PBR, and the fact that no materials or textures would render without creating some sort of spaghetti of virtual nodes - and this was just to get textures to show up on the model. And of course PBR textures won't render without both roughness and metal values.

Spagbol junction in the left pane, just to make textures visible in the right ...

After a bit of work, et voila!


 And how it looks in the latest, PBR friendly version of the open source game engine.

Catchick hanging with the TripleA Thicc Squad in PBR land

Which is when I found out that transparency was broken and filed an issue report on the code repository, github ... by which I mean I whined in the discord server to the power's that be, because github is my mortal enemy for reasons of never having been able to successfully create a working pull request that didn't get rejected ...

So, back to that auto-retopology LOD generator I wanted to test. It's called Game Asset Generator and is looks like a pretty nice piece of kit. I had a model with around 27K triangles and beefed it up to a completely ridiculous 440K using some catfish-bob subsurfing (or whatever the hell it's called).

From "USE ALL THE TRIANGLES!!!!" to "use a more reasonable number of triangles in one simple click ...

The real down side to it was that it completely mangles the original UV maps into one horrible mess, and these were something which I wanted to try and preserve.

Whisky Tango Foxtrot on the left, as opposed to the original on the right

Now this is why people go about the arduous and rather boring process of manually retopology on high resolution meshes. But I want some sort of quick fix and my cake and eating that cake and still having cake, so I set about a cunning plan and broke the model up into separate sections based on the UV island layout, before automagically creating a lower topology. I then checked that the seams were still intact and adding new ones if they were not and recreated an approximation of the UV map, stitched all the parts together again and finally baked the textures from the original high poly mesh. Whew ...


And that all worked quite nicely. It wasn't "quite" as automated as I would have liked, and wasn't "quite" as good at retaining mesh loops as I had hoped for, but it did work. Having said that perhaps taking the extra time to manually retopology the high poly mesh into a lower poly mesh may be worth it ...

Next up was to rig the whole model with an armature for animation, and export as we would normally via the COLLADA exporter. Except the new Blender3D 2.8's COLLADA exporter has a whole range of new and completely undocumented options. So, in usual fashion I just went and dived in testing what worked and what didn't.

 Nope

Nah

Eventually I got a rigged armature exported. It turned out it didn't like being parented to the actual skeleton directly and could pick it all up via the armature modifier. Now for animations!

Dancing on ice? Close but no banana as far as a nice clean export goes ...
To successfully export an animated model required making disabling exporting of all actions and relying on keyframes only, whilst keeping bind info and sorting objects by name to prevent a duplicate armature from arriving for no particular reason ...

I wrote a more detailed thread up on the forums here.

And eventually I got a working, and fully animated character out of Blender3D 2.8 and into the game.

Those Taoist charms say no and they mean no

Whilst trying to get the more hardcoded movement-to-attack animations working I came across numerous issues (which is just kinda part of life as an indie dev to be honest, especially when you're a One Man Army). The first was an unexpected naming convention for attack/recoil animation which took a day and a half to solve. This would have been a lot quicker if I had just gone and looked through the source code instead of thinking that something else was wrong.

The second was that the weapon finite state machine (FSM) kept overriding my second fire state with the first. The character has two handguns and I wanted them to fire each in turn for the standard light attack, and then both together in a heavy attack, except only the first light attack would work and occasionally half the animation for the second would attempt to play. It turned out that because I was using a hardcoded "stateFire=true;" setting, on loading it would store the animation, audio and particles for the fire state into memory and reuse it in any other state that had stateFire. However, stateFire does not actually launch any attacks or projectiles as that is all done via each states script, so by disabling stateFire on the second light attack I could prevent it from overriding the state and have the left handgun shoot.

And here is the game in all of it's post-yellow cube glory. This is the old DirectX9 version and not the new PBR one, recorded at a slightly janky 30fps because my upstream internet is bad.



So, that was the month that was ... I learned the new Blender and PBR by accident, pummelled exporting and animation until it worked, and finally replaced placeholder cube with an actual working character. And tomorrow is the first day of meteorological autumn.