Showing posts with label maths. Show all posts
Showing posts with label maths. Show all posts

Tuesday, 31 March 2026

Cute Warbands Doing Cute Warband Things

 

Smoke Signals, telling Yogi Bear the picnic table is occupied

So after much huffing and rather a lot puffing, and even more debugging ... warbands are running about doing warband things, in both day and night!

Warbands now move around from loot point to loot point, doing the lootening, as loot points suggest may happen, and light the bonfires on said loot points to signal to all nearby that the lootening is occurrening - and that this would also be a great time to raid that said specific loot point and try and slaughter all within to loot their loot.

Did I mention loot? 


 Well the player can now loot corpses, which was a main aim of the gameplay, and not only can he swipe the swag that the fallen is clad in, stripping them down to their underpants, he also buries said unfortunate recently deceased, leaving a small gravemarker to mark their passing. Failure to loot and bury said dearly departed, results in their equipment being lost to eternity, and their corpses rotting away to leave a skull, marking their departure from this earthly plane.


The Freshly Slain
 
The Not So Fresh After Remaining Unburied

I had a play around with the ScatterSky and TimeOfDay objects, and after some faffing in the code, decided the easiest way - at least in network overhead - to get really red dusks and dawns, was to use the built in TimeOfDay callback with a little custom C++ to change to change the rayleigh scattering and ambient colour. This callback also allows for the campfires to light up on sunset and extinguish at dawn, giving more markers as to places the warbands are likely to head. View distance for the warbands changes according to the time of day, and leads to some rather nasty surprise battles during the hours of darkness, when bands or burley warriors bump into each other in the pitch black.


 Archery now works rather nicely, though required considerable faffing due to the blending of animations for aiming, which threw off the IK animations which I had created for use with two-handed pole weapons (hello Dane Axe). After many huntings through C++ to try and find out WTF was going on (I still think it's all down to the laterally animation movement which the engine isn't expecting) it turned out easier to define a specific look/head arm animation for pole weapons and then manually alter the animation to get it to align to the IK by around -4 degrees on the XZ axis. Not the cleanest way of getting a working result but game development, and inface coding in general seems to be very much to be a matter of workarounds and use more duct tape. And duct tape fixes everything! (as long as you use enough)

Here's a test of leading aim with longbows at just short of 300m, which works a lot better on a flat surface than undulating terrain for obvious reasons of consistent direction and velocity.


 Currently all bows look like crossbows, due to this being the only model and animations I have currently made, whilst I decide on how best to animate traditional bows, with their hold in left and draw with right animations. As my current warband timeline only goes up the 11th Century at the moment, the English warbow/longbow has yet to appear, but researching some historical composite bows for the Magyars, it was interesting to  note that they used very light arrows on very strong composite bows to out-range their enemies at the expense of projectiles which were weaker in the strike, and would break when they hit the ground (which of course stops the guy you just missed from picking it up and shooting it back). To this result, the Magyar have by far the longest range (to be honest 400m is kinda pushing it but hey vidya gaemz), but with stopping power only marginly better than a 100m short bow.

Remember kids, when you see the horse archers run away, do not follow. 

 So, here's some edited highlights of archery, melee, point blank night battles, corpses rotting to skulls, and general AI powered gameplay in action.


 So all that leaves us with our not so heroic player, still running about in his underpants armed only with a Bollock Dagger.

Nice lack of kit you have there oh level 1 noob

 But, as shown in the first video far above, the player can actually loot corpses of their equipment, armour and weapons. So the next major job is to come up with a Game User Interface (GUI) so that the player can actually decide what stolen swag they want to equip, to boost their avatar's chances of survival in a good old fashioned scrap. Alongside that, I need to create interfaces for the leveling system and career progression, all of which is already coded, but currently inaccessible due to lack of tailor made input screens.

Behold, The Wonder Of Clothing! Coming Soon™
 

Speaking of input screens, I modified the visual performance settings, so things liek groundCover (that's grass to most people) not only increases and decreases in number, but also expands and ... er ... despans(?)  in range from the camera. I found that there was already a variable for this, originally created in mind to reduce the range, but with a little tweaking of code I could get the radius to which grass is drawn on screen to increase/decrease in line with element numbers.

In other news some dastardly swine stole an hour of my sleep in return for British Summer Time, so I sat out in the sun with a bottle of wine, and it was freezing cold and cloudy and I probably now have hyper/hypo-thermia ... which ever one involves a brass monkey dropping it's balls all over the place.
 

Thursday, 31 October 2024

Many Many Things

Homegrown Pumpkins vs Big Pumpkin Corporation

Many things have happened this month, many, many things ... however I cannot remember most of them. Not the most auspicious start to the monthly devblog is it?

Monsters Loot Swag got another update on Steam.

Many of those many things are maths, and I'm certain non of them were helped by my filter coffee machine going the way of the dodo. Naturally it waited until it was a year out of warranty befoer it decided to pine for the fjords, but pine it did. The light was came on but nothing useful happened, a feeling which I can relate to.

The Median Between 2 Vectors
 I had spent a good week fighting maths, wondering why I was seemingly receiving a torrent of gibberish - when I realized that I had forgotten to normalize the first returning vector. Rookie mistake, but with that out of the way I suddenly found more of them, and some of those had been lying in my older code for some time ... like the one were the formula was clearly missing half of the maths that the code comment was describing. Needless to say, everything that ended up being based off this function was gibberish but I just hadn't noticed ...

Eventually I managed to get the AI to try and surround the player and attack from the sides. This still led to a lot of wild swinging of swords which meant rather a lot of whacking their own team mates. They do not fully envelop the player, but at least make a decent attempt at out numbering for multiple attack directions. I might end up making the combat a little like Sleeping Dogs, where the player is attacked in a quick but orderly manner rather than the current free for all. I speeded up the thought process of the AI after I made the test video below.


I've also hammered a good 200 hours of play in Kingdom Come Deliverance, which I bought some time ago. The graphics are nice, the forests really well made, the dialog is witty and the first person melee combat autistic and janky - but I have had a lot of fun as a Cuman bowman riding around on a horse and nailing arrows into folks.

It's that time of the year again!

I bought 2 supermarket pumpkins, as the homegrown variety didn't quite get big enough to scoop out. I got a kilo of vegetable flesh from each one, so 2 kilos for 3 quids worth of pumpkin, now bagged up and in the freezer ... where I found some bags of last year's pumpkin ...

Anyhow, here's the WORLD DEBT CLOCK - don't have nightmares!

Wednesday, 31 May 2023

Boxes In Boxes

 

According to the weather forecast, she will need a jumper ...

After getting mild sun burn sat out by the veg patch with a bottle of wine, we are now back to standard British weather of needing a jumper for late Spring and early Summer ... Flaming June looks like it means that the fireplace will need to be lit ...

Steam brought out an update to the Steamworks SDK, sneaking it out again as they did in the previous month without any fanfair. Once again they had made changes to the authentication system, and once again I had to wade through code comments to find out what it all meant - except this time I also had to wade through the online documentation, complete with it's links to various 404 dead pages. To quote the docs at https://partner.steamgames.com/doc/webapi/ISteamUserAuth:

 NOTE: This call requires a publisher API key to use this method. As such this API MUST be called from a secure server, and can never be used directly by clients!

So, yeah I'm good, this was just splitting up web-based games from the standard Steam Client authentication. Also feel free to click the api.steamworks link at the bottom of that page for more helpful advice. 😉

In April I had attempted to create a melee combat system of checking through a defending player object's hitBoxes for intersection with an attacking object's hitBox - to see if this would be faster than using a raycast system of quad edges projected from the attacker's weapon - all whilst suffering from the Dreaded Lurgy.

What I found, during illness enduced brain fog, was that there was no current system to determine whether rotated worldSpace boxes intersected (OOB) only AABB. Now without the brain fog I had another attempt at coding a solution to this, with a nice easy early out if half longest box sides added together were beyond central distance, though ended up using raycasts after all for the actual connection checks, which were oriented in worldSpace with the attacker's box and then a perpendicular test if no initial result was found.

The end result was that I found checking through the defender's 12 hitBoxes (but potentially up to 20) could easily take more than the standard 4 raycasts which I had been previously using. On top of that, box intersection would take more the boxes behind the initial hit into account, nearly doubling the struck areas, so a big melee swing would 98 damage rather than 40 something. To order these results in worldSpace would require another raycast or more maths based on location and orientation.

tl;dr - I've kept my original melee system, it works fine for what I want, but I might use the OOB intersection for weapon on weapon parrying.

So, that was the month that was. Flaming June awaits, with a promise of thick jumpers and hot cocoa ... 😒

Monday, 31 October 2022

Halloween Horror Space Year 2022

Behold The True Horror This Halloween!

 More terrifying than any cosmic horror dredged from the neurosis of HP Lovecraft ... it's the global debt clock

Okay ... have you recovered from this ghastly Halloween fright? Then we shall continue with October's dev blog.

Finally I discovered the true source of a long running bug. I have spent months slowly chipping away at this bug, narrowing down the source and timing, even fixing the crash and suppressing the Out Of Bounds Array messages. Should have known that it would be an audio emitter issue.😫


 So it turned out that a lot of events happen when a player buy's Swag in Monsters Loot Swag, effects sparkle, audio plays, icons appear, objects spawn, marker objects hide and if there's a lot of other stuff happening at the same time ... and it's a game where there's always a lot of stuff happening at the same time ... the audio emitter can get out of synch when it wants to disable.

The solution was to stop everything from happening in the same engine tick with a simple schedule to make it all happen in order, giving the audio emitter a good half second to turn itself off and make sure it's ghost update of the network doesn't go tits up. Hurray, fixed and understood the cause. 😓

And speaking of audio bugs ... years ago I  noticed that sometimes the audio went ... iffy. It would start going off-key and warble intermittently. Not long before shipping the start of the Early Access game on Steam, I realized that this was caused by the camera being offset from the player location and thus camera and player could end up fighting for who got the audio source, with the sound cutting out if the camera was further away from the audio. At the time I threw in an emergency workaround by making the radius of all audio emitters large enough to swallow the camera.

Eventually I got around to coding a proper solution, use the camera rotation and the player object's location. This took a fair bit of maths as I could not remember which column of the matrix transforms I required to get to mix together ... until help on the Torque Game Engine Discord Server pointed out that there were already helper functions for matrixes and I could just use matrix.getPosition(); in cpp - boy did I feel dumb. 😅

The Takiyasha Ornamental Water Garden - early image

So, I have spent this month working on Level 6 for the next big update ... which I was hoping to have released this week but will probably take longer as I have redesigned the boss monster twice aleady. It's the Takiyasha Ornamental Water Garden and it builds on the environmental hazards which I introduced previously in Level 5. Behold water! Water is an environmental hazard as it slows down both the player and enemy monsters. I have designed the level so that if the player wants to get somewhere fast they're wanting to go through the water, but slow movement and enemy missiles are bad, so the player could decide to stay out of the water and go around it, thus preserving speed and the ability to dodge better.

I've also coded a lava type of liquid which only damages the player - more on that in Level 7.

Level 6 early testing gameplay

Level 6 is the home of the Stone Golems, high DPS, low HP, but very strong, range-based player characters have much lower strength than melee ones and so have a hard time barging them aside, and can easily get surrounded and trapped.

Once I finish up the level boss, Lady  Kaeru The Horticulturist, who is not going to fight you, and her giant champion who is going to fight you, I will be uploading the third big update to Steam, and the Early Access game of Monsters Loot Swag will be around 60% complete.

In the meantime, don't have nightmares! https://worlddebtclocks.com

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 ...