Showing posts with label dogfight. Show all posts
Showing posts with label dogfight. Show all posts

Sunday, 31 January 2021

Space Year 2021: Stage 1 of 12 Complete! Dogfight!

It's the futuristic space year of 2021 AD, stage 1 (January) of 12 (the Annum) has been completed ... though you might be forgiven for not noticing ... 


Having previously worked out my issues with Ai pilots taking a leading aim on a moving target I have spent all of January getting them to actually dogfight one another. Choose target, go fast to get into shooting range, slow down to follow it and blow it out of the sky. Took a bit of doing but worked nicely. 

Next up was creating a system of evading when an AI came under attack rather than just sit there and get shot at. Reading through vast tomes of air combat and aerobatics, I managed to come away with ten meaningful emergency maneuvers to try and shake an enemy fighter, and added a barrel roll if none of the others seemed to be an oppropriate match for the defenders circumstances.

 That's not a barrel roll (ノಠ益ಠ)ノ彡┻━┻

This brought some problems itself, that in high-G maneuvers such as a Stall Turn, the Ai had a nasty habit of losing all energy and ... well, stalling ... a lot.

He's written his Artificial Intelligence Pilot Engine Management System? Stall it.

So then I embarked on a complete rewrite of how my Ai would use engine management. Previously it had been a simple case of setting engine percentage with a nose attitude modifier, now it was all about maintaining the desired speed. This massively reduced stalling in tight turns but not completely eradicated. So I added an anti-stall system that would force the Ai to move to a desired rate of knots should their airspeed drop at a rate that would bring them within the losing height at level flight, with a nose attitude modifier. I reused the anti-stall method which I had written for spawning aircraft and getting them up to their starting speed immediately. The maths required a bit of evening out for an object that already had velocity in 3 dimensions and initial attempts had some supersonic thrust propelling the vehicle across the sky like Warp Factor 9 but I ironed these out eventually.

Unedited video of an 8x8 dogfight

Coupled with all of this was the the obvious need for collision avoidance, both from other aircraft and the ground and max ceiling which each aircraft type can go up to before the engine is starved of oxygen and stalls. Dynamic collision avoidance of other moving objects was somewhat of a pain in the maths but I got there eventually with very little happening in the way of head-on collisions during mass heda-on attacks at each other team's formations.

32 aircraft head on attack - no collisions just 2 shot down
64 aircraft battle moments after the first pass, and why it's called a dogfight I guess

In other news I decided to update the banners on my youtube account, and give them some new artwork. Here I discovered that it doesn't actually let you reposition your artwork and keep scale after upload, so had to edit the image to fit into their stock measurements and orientation.

I also spent quite a bit of time viewing train stations webcams on a spare monitor whilst I worked for maximum comfy.



Everywhere seemed to be getting snow ... except me, it just rained here. (๑′°︿°๑)

So, that was January, Year of The Koof Part Deux, pubs are still shut then ... Join me again in next months exciting episode of "why is maths hard?"


Thursday, 31 December 2020

That Was The Year That Was: Space Year 2020

 Space year 2020: Expectation Versus Reality ...


I had been having considerable trouble getting my AI aircraft to intersect with the correct aiming point for landing rounds on a moving target. This is once again ... maths ... having to take into account shooter velocity in 3D, target velocity, projectile velocity, projectile inherited velocity from shooter and unth being stuff of a general persuasion. What appeared to happen was that the AI was happy to blaze away and surround the target without particularly trying to hit the bit in the middle ... you know, the actual target area ...

It was only after three attempts and scrounging some code that I noticed my dot product of the forward vector (which is a thing honest) was giving lot's of decimal nines whilst my theoretical aiming reticle had considerably less decimal places. Paying more attention to forVecDot seems to be a better idea, though I still feel the aimpoint is being over inherited with velocity in some manner ...

Cue a test dogfight, the first 2 minutes of which are letting the Ai shoot me down, and the rest are me blasting their wings up to depreciate their turning ability and make them easier to catch. The Ai has no particular tactics right now, just to try and turn on to the target and get up close and try not to overshoot if possible. 

 Machine guns go brrrrrr

In other news I fixed the issue of the AI wandering off due to realizing that positive pitch and yaw dot products required negative maneuvering inputs ...

I've also been thinking about adding Ace Combat 7 style hi-G turns, but as a Stall Turn, hit decelerate when turning and maneuverability increases in exchange for massive air resistance and speed loss. Anyway, that would be something for later.

Over Xmas I did a cheap single malt taste test, and here are the results:

Asda Extra Special Speyside *the only one not aged 12 years so not actually that special really* had a big flavour up front with a fairly high alcohol hit but not much on the back end (ooh err missus). 20 quid.

Tesco 12 Year Old Speyside was very smooth, low alcohol hit but warming all the way down. Kind of an easy drinking "session" whisky if ever there was one, but a thin in body compared to more expensive named malts. 23 quid.

Co-Op 12 Year Old was big on flavours coming from oak bourbon casks and had a fairly strong alcohol hit with a lingering finish. 26 quid.

 

So, that was the year that was. The Tokyo Olympics never did happen but it was more due to a sniffle than a bang ...

As soon as the UK announced lockdown and everyone must stay indoors my usually peaceful hiking track on a wet Wednesday was full of bastards that would not normally be there, ruining my usually quiet half-marathon oxygen intake.

So, yeah, Merry Christmas and a Happy New Year you Lurgy Poxxed Koofers.

over 9000 hours in MS Paint for extra festivitinesses ...