Saturday, 30 November 2019

The Clip Show Episode Except It Isn't

It's been a hectic month. So hectic I'm going to have to make a filler blog post. But first some actually useful progress ...

I was helping someone out who was having issues getting the exported collision meshes to work whilst using the imported FBX format from Blender 2.8, to the open source Torque3D MIT Version 4; Preview Build 5.

Binaries of which are downloadable here:
http://ghc-games.com/SC/Preview4_0_bld5_win.zip http://ghc-games.com/SC/Preview4_0_bld5_lin.zip http://ghc-games.com/SC/Preview4_0_bld5_mac.zip

Or at least I thought that was what the issue was. It might have been something else. Either way, I successfully resolved this issue, real or imaginery, so I may as well take the time to share it.

 The secret is to use the same node system as you would for DAE (COLLADA).

It appears that when importing FBX format naming is more required than when just using DAE. Anyhow I had a play around with exporting FBX from Blender and here's what I found.

1: It really likes the DAE hierarchy if you want working collision meshes when exporting FBX. :|

Image

2: If you import as SingleSize your object meshes require trailingNumber LOD else the collision meshes will not work. :o Weird right? :?

3: It will import working collision meshes when using DetectDTS or TrailingNumber (even when you have no trailingNumber) without trailing numbers for LOD. :shock: Did I mention trailing number in that sentence at all? :?

4: FBX is HUUUUUUUUUUUUUUUUUGE. :o Importing at scale 0.01 is the same as importing a DAE at 1.0.

So, on to the filler bit.


Headpats ...

In other news I ventured into the 21st Century and got the cheapest fibre optic available, finally allowing me to upload files 9 times faster than attaching them to the leg of a dead pigeon and sticking them in the mail box.

Here is a gameplay video which was 2 gigabytes that uploaded in 30 minutes. You still have to manually select 1080HD on YouTube or else it'll play the 480 pixel version, even if you got full screen and it lies to you about which quality version it's playing ...



So, that was the month the wasn't ...

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.

Wednesday, 31 July 2019

Relearning Everything I Did Not Know About Blender3D

Whilst I wistfully gaze at my still unopened Tax Return, with it's passive-aggressive "PLEASE OPEN IMMEDIATELY" and not so passively aggressive bright red stamp of "31ST OCTOBER IS THE PAPER FILING DEADLINE", my mind turns back to the problems of character modelling, drifting past the bottle of SA Chenin Blanc, into the mysteries of rigging shoulders correctly so they don't deform into some sort of monstrous mockery of Quasimodo, and other general 3D shenanigans.

 Me, trying to get a mesh friendly to weight painting ...

Now I have done all of this before - in very low poly - on the version of Blender3D which I am used to using. That version is 2.44 which came with it's own custom plugin for the DYNAMIX THREE SPACE file format exporter 0.964. You remember Dynamix? They were that video game company founded in 1984. They made Rise Of The Dragon in 1990, a futuristic detective, adventure game which ripped off Bladerunner and I never understood what the hell I was supposed to be doing whilst playing it ...

Anyway, that version of Blender3D dates back to around 2007, which is at least 100 years ago... so there's probably been some improvements and changes since then. And it turns out there has been. In fact I already knew that there had been as I've been tentatively using version 2.78c for a while, ever since they created the normal editing modifier to stop foliage and especially grass, from looking like complete shizen.

Turns out it was February 2016 and still no finished game fml ...

So first up, how do I into character modelling? I can not even into character modelling!

Hello makeHuman! makeHuman is a 3D character/human body generator which I played with years ago and never got back to. However it has one important thing going for it - it exports with a various skeletal armatures and comes pre-weight painted for bones nodes.

After quite a bit of fiddling around, I had previously managed to make a fairly accurate rendition of Toobz in makeHuman (though the fatassed robut needed more ass fattening and the legs slider was never going to be long enough) (and I added extra oppai) and exported it into Blender3D with a rigged skeleton and then slapped some cat ears on it.

makeHuman created a near perfect replica of Nier: Automata's 2B but the butt slider maxed out ...

So next up ... I need said model with cat ears slapping into a harness which would ultimately be attached to some sort of steampunk propeller pack. Cue searching for tutorial videos on all the other changes to Blender3D's modifiers. One of these I have already found out by testing - is that the decimate modifier, which turns your overly high poly mesh into something more video game and Level Of Detail (LOD) distance friendly, now keeps the weight painting data for bones in the armature. Ye olde 2.44 version used to just kill the vertex information, leaving you with an unanimatable (that's not a word is it?) model, so I used to have to do my LODs for Airship Dragoon by hand/eye manually ... which was a real pain in the Shizener. So this improvement was another major reason to finally upgrade to a newer version of Blender3D.

 How character modelling usually turns out without using a proven work flow ...

The model I have been working with is somewhat overly high-poly for in-game. It is also overly rigged, with many bones that I do not require for gameplay. However I am hoping to do a few high poly "cut scenes", so I am currently concentrating on making an intermediate model I can both "poly up and down" later as needs be.

So, this harness then ... I mooched around the internet (as usually but this time trying to be useful) and found a load of video tutorials from 2011 about making a static character model - which is still a lot newer than my 2007 knowledge. And it had this amazing thing called the "shrink wrap modifier"!. Basically I make clothing too big, and then "shrink to fit". And it works pretty good.

Shrink to fit, just like that baggy T-Shirt and a hot bucket of water

So that wasn't too bad, I made horribly baggy mesh around the model for tight fitting clothing, and got it to reduce to the model's topography with an offset with the push of a button (after much experimenting). Next up was building various straps over the new harness mesh manually.

Extra strappiness to stop overly excited catgirls from falling out

And this is when I hit (another problem). I had previously been using the mirror modifier so I only needed to create half the harness, then apply it and shrink wrap. But now I noticed that the buckles/clasps above the waist were not perfectly symmetrical. makeHuman exported the pose with a slight kink in the spine, so everything above the waist is slightly to one side. Straightening the pose manually was easy enough in Blender3D, but it didn't make the mesh perfectly straight, and it was still off. Note to self; check this sort of thing before you start working on it.

Bravely/stubbornly/being past caring* (delete as applicable) I continued, ad libbing (which turns out to be 2 words) as I went and continued. Now the whole idea of the character is that they ski around the level with a propeller driven backpack - hence the strappy harness. The rotors/propellers themselves are going to be flat, animated textures - so that saves some polygons and drawcalls.

Propeller area in dark grey, green is a gauge

 Next up I needed some sort of under clothing, rather like a skin suit or leotard or boobtube (which was a thing in the 1980s). I attempted some sort of vague modelling by hand/eye co-ordination, which is not that great at the best of times, and then went off to find some more video tutorials on Blender3D to see if they would help. This is when I discovered physics. Now I studied physics at school, by which I meant the teacher didn't care if anyone learnt anything or not as he got paid all the same, and thus let me sleep in class (this was the 1980s, the greatest decade in history). I got an E grade which was surprisingly better than I thought I would get for doing nothing.

Anyway, back to the physics inside Blender3D. With a bit of jiggery-pokery it can be used to create clothing that falls into place with gravity (note: T-pose is best for this or it slips down the arms and falls off). I made a whole series of tests, but only screenshotted the final result. This was a bit "flappy" so I ended up tying down the bottom manually. This looked rubbish, so I ended up extending the character mesh out to meet the material which didn't look so great either so I ended up faffing until I had some sort of boobtube, carved a few dints into the middle and called it quits.

Physics in action! Meaning the one physic of gravity

By this time I had decided I did not like the propeller casings being so high and had dropped them into the mainframe of the jetpack - or should that be proppack?

And now to merge the two meshes into one - whilst also deleting all geometry hidden behind the harness in one fell swoop! First up duplicate the original character model, because if everything goes horribly wrong we might need the original again later (wise, wise words). I sealed all the open sections of the harness, thus cutting into the character model and then used the boolean modifier (named after George Boole, tricorn hats off to you, sir) to remove all the unnecessary bits of character mesh that was hiding behind the brown harness mesh.

This created abject chaos.

Firstly, it severs straight through the target mesh, which is exactly what you want ... kind of. It creates F-Gons (a plane with more than 4 vertices)- which are nasty planes surrounded in loose vertexes everywhere. Hunting all of these down to manually fix them to the edge of the source mesh is a nightmare. And it will have to be manually, because the automated remove doubles is distance based and will just eat up random geometry. Secondly the target mesh seals itself where it's cut, creating lots more elongated planes which have to be deleted. After much faffing around with the first problem I decided to try a different tack.

I selected all the visible planes of the source model around the harness and deleted the rest. Merging both objects I manually merged vertices when close enough and built new planes so elsewhere so the source mesh and harness mesh became one. Whilst this was somewhat labour intensive, it was easier and faster than dealing with over nine thousand F-Gons.

So, finally I have a single mesh, at least of the character body and the harness. Next up, data transfer to get the original makeHuman bone weights into my new Frankenmodel. Playing around with the system I found that using "Nearest Face Interpolated" filled out the weight painting to the entire model, whilst some of the others left the buckles of the straps unfilled with weight data.

Great success! Glad I didn't have to do that manually!

So, that's about it for this month. We had a heatwave and I got a great tan. Next up, hair, because what I have been using in all of these pictures is a placeholder, and then to start on UV mapping and textures. I also need to rig that backpack.

There is a new version of Blender3D out, it's 2.80! As it's taken me ~15 years to upgrade to 2.78c ... I might wait a bit ...

Sunday, 30 June 2019

Assimp Does Magic Stuff And I Get Distracted

This was a bit of a surprise.

 That says Blend file that does

Whilst playing around and looking for bugs in the latest beta of open sourced Torque3D game engine, I accidentally imported a BLEND file from free open source(ish) Blender3D modelling program. Obviously this by accident, because I would never have thought that it would work.

I had found some ripped game models and other sculpts (see Tifa above) and was looking at them in Blender3D for modelling reference. I had experimented with various export options and was loading them into the engine when I accidentally double clicked the Blend file rather than the exported DAE file. Et voila, it actually loaded with all materials correctly mapped.

This is due to the new Assimp importer which appears to be able to read pretty much anything and import it because magic.

Literally my understand of how Assimp works ...

Assimp also comes with a metric ton of options - none of which I really understand so I just kept using the defaults except for maybe rotating the up axis to Z when needed - and it kept importing models fine as long as I had multiple mesh objects set to be read as a single sized LOD.

When the Beat-Em Up waifus are extra thicc

I had tried various other model formats and found FBX and BLEND to be the easiest at automagically loading the corrects textures into the material slots. Amusingly - or not as the case may be - the original DAE importer was the worst and created the most hassle. Not all the models I had found on the internets had their textures setup for a standard PBR material, hence the rather off colour Chunners.

DAE->OBJ->FBX->BLEND

I had also seen someone using the normals editing tool in Blender in a way that I had not thought of before. For foliage and tree leaves they had placed the mesh inside of a huge sphere object and then targeted it. This made the leaf faces orient outwards to the nearest sphere point. For my current project all leaf and foliage mesh faces are orientated nearly vertically upwards, targeting a node high above, because that's pretty much where the player's camera is for a top-down perspective.

No normal editing target->Vertical target->Spherical target

Did I mention distraction? Yes I did. I had been harassed by "The Idea Fairy" and suddenly had the urge to make a Dieselpunk Ace Combat style game. I ended up writing up a design document and fairly in depth statistics of how the whole thing would play, utilising real world 1930s and 1940s aircraft. I imagined it would play rather like the old Freespace space combat simulator, only in high altitude clouds rather than space. Aircraft would ... well, aircraft, and airships would make up an equivalent of a real world navy. I also ended up playing through Freespace 2 and the original Freespace mod for it. For the first time ever, I have a state of the art gaming PC and use it for playing 20 year old games.

This thing needs keeping on a short leash ...

So that was the distraction that stymied this month's progress. I did however get some work done on the current project, the one that I am supposed to be working on, by transferring some heavily used scripts for targeting to C++ code to take a bit of weight off the processor when they are called so often. I also added went mad for statistics and added rankings for player performance on to the already percentaged data. I went for the Japanese obsession with S which may or may not mean SPECIAL, so the highest rank is SSS, SS, S before getting into a more standard alphabetical descent, and it goes down all the way to F for FAILED MISERABLY.

Yo Dawg I heard you like Statistics ...

Of course the real reason I did all of this stuff was simply to avoid having to model 3D hair because it's boring. Yep, that was it. An entire month of obfuscation to not doing something that is time consuming and dull. I also got poisoned with a chemical gas leak for two weeks having had an engineer out to investigate a gas leak, then getting a methane detector thinking that it was a gas buildup in the drains before eventually finding the source leaking out of a vat, and I was also immobilised with a back injury for another week, which was caused by just bending over the sink. So not a great month in general.

Next month, getting back to what I should have been doing this month ... allegedly ...