Saturday 31 October 2020

A Change Is As Good As A Rest

 Happy Halloween, how is perpetual house arrest working out for you?

So we've got a little saying "in them there these here parts": A change is as good as a rest, so here is DIY Ace Combat 1930s style. This whole thing came from an idea I had for a steam/dieselpunk story many, many moons ago for Victoriana sci-fi with cloud cities, battleship dirigibles and '30-40s aircraft. Over the years I have amassed data on the aspects and real world values of various aircraft from 1930-1940s and condensed them into something that might be useable gamewise.

Needing a break from super head-pattable fluffy eared waifus character modeling which I really don't like, I embarked on creating an action based Ace Combat 7 style aeroplane game. First up I checked out all the previous flying vehicle resources which ... were not particularly great, but did give me some pointers on how vehicles are supposed to work ... and the answer to that is that they are entirely physics based. Now considering that some of this stuff dates all the way back to the early 2000s, I expect that was very revolutionary at the time (see Dead Red Redemption 2 for physics based locomotion and a budget of 160 million USD).

So it was time to boot up Visual Studio and hard code it in good old C++. Now there was a time, not very long ago, that I trembled in fear at the thought of doing anything in C++ that didn't involve me copy and pasting some half broken crap off the stackoverflow site.

You tell 'em Aragorn, son of Arathorn

The stock flight model was frankly appalling, so I set about rewriting it from scratch. Gravity turned out to be a weird and thorny problem, as anyone hit by a falling apple can testify to, so I simplified that with a "going down fast, going up slow" methodology and if you were going straight and fast ignore it. Of course that meant that going straight and slow would be a problem so I introduced a vaguely realistic - but always siding on fun to get away from simulation - stalling system.

Gradually over the course of the month I built up a new physics based flight model based upon the concept of fun trumps boring simulation. I was aiming for something in an action style concept that mixed Ace Combat 7 and  Freespace 1/2 (so spaceships with gravity if you will).

Cue, lots of physics as me having to look up the "maths is fun!" (narrator: it isn't) and "improve your GCSE maths!" websites to get a refresher on Cosine ... and it turned out that I mostly wanted Tangents anyway ... Now I vaguely remember all this stuff from the '80s but because of large class sizes I got stuck down in Set 5 and needed a +90% score to pass the final exam - which I did - in your face education system :P

With a working and fun, physics based flight model I proceeded to create the HUD system, with all feedback and warnings. I created a primary and secondary guns system with heat buildup, stoppages due to overheat and cooldown system. The last really awkward thing to do was make a unique area damage system, so if the wings started to get shot up, maneuvering would become harder, engine damage decreased thrust and speed, etc, etc. In the end this didn't end up being as difficult as I thought it would.

Speaking fo the HUD, I came up with system that can change the entire scheme for whatever the player prefers. Even if it's bloody awful.

 I rewrote bullet fall so projectiles only begin to fail to gravity halfway through their lifetime, and then lose momentum quickly. Stock code has them losing height immediately which just seems weird having used high velocity rifles in a former existance.

In deferrence to the previously mentioned Freespace games of the '90s I added an afterburner/jet/turbo boost which I guess back in WW2 was called "War Emergency Power (WEP)" though it acts more like a Freespace turbo jet for a limited time whilst consuming energy and has to be recharged. I have 3 distinct classes of aircraft, their names based on old cavalry types for fighters, interceptors and strike aircraft, and they all handle their WEP differently, as they do with their maneuvering at speed.

There was some ancient code resource from 2004 which nearly worked out of the box 16 years later. From this I coded a few new functions to make life easier, and lo and behold, not only could I get a callback for damagable areas but I could shoot through the main collision box it it wasn't part of the mesh model. Why is this a big thing? Because  the engine uses a singular collision system for speed - eg internet packets, which obviously you want to keep as small possible and nothing really gets smaller than a 6 sided cube because you only have to send the data of 3 lengths (in your face Ramesses! Don't @ me about pyramids also being 3 lengths, you still only get half the area). This meant that all collisions were based on this surrounding boundary box. But with extra hitboxes I can keep the overall simple and fast collision system for things like movement and disassociate it for more complex things like bullets flying through it but not hitting the actual model - which looks weird.

So, next up for dieselpunk aircraft action is to refine the damage modeling and make it actually playable. I did have a quick dogfight with an empty vehicle last night and "zoom and boom" was quite fun - but I really need to sort out a moveable camera system to look around and radar because once they go off screen it took ages to find them again.

Anyhow, ladies and gentlefolks, for your delications, some video, featuring an airplane model I swiped from some modders site for a long defunct flight simulator I have never heard of, so that isn't my work.

So, what's all this for? It's for a secondary project that I can flit between the two without vegetating once one gets overwhelming or just a plain pain in the old arserinho. Cute catgirl swag 'em up will return, it's pretty much fully coded and only needs some user friendly stuff for a limited playable release but it also needs a huge amount of character modeling on top the huge amount of modeling it has already had - so here is my extra project to break up the monotomy, and as I said at the top of the page; a change is as good as a rest, and it's a lot more productive.

That was the month that was. Hope you enjoy lockdown 2 covid bugaloo.