Showing posts with label pathfinding. Show all posts
Showing posts with label pathfinding. Show all posts

Saturday, 31 January 2026

The Great Debugging

Initial attempts at Inverse Kinemetics proved imperfect

 So THE GREAT DEBUGGING of actually trying to get our warbands to operate in a terrain environment has begun. And the good news is that it has almost™ ended.

Mistakes were made, and the good news is that it wasn't all be me, but also the data libraries which I use >>> I AM LOOKING AT YOU RECAST PATHFINDING. And I'm not even using AI (lol!), imagine how much worse it could have been!


So just pathfind across the RIVER OF DEATH and into the CLIFF OF IMPASSABILITY
 

Recast Pathfinding is a great resource, so great that I wrote my own pathfinding plan function that actually bothers to check if the pathfinding plan gets anywhere near the pathfinding objective ... not that I want to completely write my own pathfinding system you understand because I am not batshit insane.

But I did come up with a system of fallbacks, now that my own function actually bothered to tell me that the pathfinding library had, what we would call in layman's terms; FAILED, but for some reason it thought was fine to deposit everyone wearing heavy armour into a deadly deep river with unclimbable cliffs was some sort of mathematical success.

I want to get into the middle of the castle

Thankfully my own functions used something called basic reasoning that when the path ends hundreds of yards away from the goal position that it might actually have failed and we should try other things. Other things however still relied on Recast's "meh close enough" being ANYWHERE in the map rather than at the literal destination, so I came up with a level specific functioning system where I could direct the pathfinding to actual traversable waypoint paths to overcome the RIVER OF EVERYONE IS SINKING.

I want to get into the middle of the castle and I will use the waypoint on the bridge because I am forcing it to

And then there was the whitespace ... admittedly this was all down to me in the script files but "whoa laddy!" hunting down all those "objID" != " objID" has been a right royal pain in the Prince Andrew. So my apologies for a lack of interest but low fps debug build video of my multitude of warband troopers running about undulating, river obstacled terrains, knocking seven shades of the brown stuff out of each other. You will just have to "trust me bro™" that it really does work.

I also attempted some IK shenanigans to get the player's feet to actual transform to uneven surfaces, and as you can see from the first image is worked great ... but only if you want to stand like a sugar plum fairy ... and movement wasn't much better either.

 

Speaking of SHENANIGANS!

It had been brought to my attention, via SteamDB that Airship Dragoon had spiked in player count, a good 12 years after release.

 Bizarre.

 I had ignored this and thought that it must have been a bug, yet ... Steamworks verified the player count. 

 And the nations were somewhat surprising ...

I hope no-one is using this actual military tactics ...

 So ... there you go, highest consecutive play count ever, in 12 years ... so I'm thinking ... bots going for trading cards? Not sure anyone is buying those trading cards though ... so ... it's a mystery.

 Anyhow, just like Skeletor memes, until we meet again! When I will (hopefully) have some video of my warband game in full action over a real playable landscape! Not that there is anything for the player to do yet, but hopefully human fleshoids aren't as prone to fubaring everything up as a machine.

Hopeful, ever hofepul ... 

Wednesday, 31 December 2025

Space Year 2025 Comes To An End

There Is Gold In Them There Hills!

 Space Year 2025 comes to an end, and this month I have mostly been fleshing out the world of warbands. This has required some low poly rocks scattering at various intervals and a some ruins, bridges and castles. Gotta have a castle in a medieval hack and slasher.

Colourful Heather To Break Up The Monotony Of Green

 Whilst adding all these extra things help make the landscape more interesting, it also creates the more "stuff" means the more stuff for the Ai to walk into and get stuck. Behold navMesh for pathfinding!

Now it has been a good 10 years since I used recast, for Airship Dragoon, so I did need a bit of trial and error to get it to build reasonably sized grids. After a bit of pathfinding testing I determined it had a nasty tendency to fail to get to the target point on particularly long or complicated paths (bridge? What bridge?), and so ended up adding some waypoint markers which will (hopefully) act as a guide for the wonky path. However it looks like I will be having to check this manually as "we made a path but it doesn't actually go to the end point" does appear to happen some times, especially when a bridge is involved. 

Fun With Pathfinding
 

Apart from that it has been Christmas, which has required a certain amount of eat, drink and be merry ... all of which has been somewhat fatiguing and I will be glad to get back to normal service has been resumed and don't have to hear overly jolly Christmas music everytime I stop outdoors.
 

One Ruin, One Bridge, One Castle

Steam is having another NextFest at the end of February but I reckon that the time frame for getting a working demo out is too tight, never mind clearing the store and app review hurdles. I am not particularly concerned as I don't think that NextFest adds anything to discoverability and if you aren't already bringing your pre-collected audience over it's all potluck if you get a new following.

Bonfire Lit, Grace Touched, Do You Have A Permit For That Campfire, Etc

 Space Year 2025 comes to an end, and during it I made the final release of twin-stick catgirl carnage shooter Monsters Loot Swag and added NG+ ... neither of which garnered any attention and all visibility rounds expired long before they were used up. However that is just the nature of the beast now. 

So the plan from now on is smaller, faster development cycles leading to shipping every 18-24 months or so, rather than labouriously iterating on something on and off for a decade only to release and hope I make my 100 bucks steam app cost back. Knight Errant/Warband World/Whatever I am going to end up calling it, is the first test of this. Whilst Early Access did not garner any enthusiasm or bug reporting help, I am probably going to go down the Open Beta route and see if that helps gather any players, before perhaps another attempt at Early Access in the same vein as Vampire Survivors, sell it for a few bucks and then finish it off 6 months later.

Hello Space year 2026. 

Wednesday, 19 June 2013

Virtualizing The Virtual

Virtualizing The Virtual!? Is that a double negative? And if it is, does that mean that the virtual is now physical? If so, I for one welcome our new Steampunk Turn Based Tactical Artificial Intelligence Overlords ...

So, there I was, playing away, testing my game. It was night, poor visibility ... also probably in real life too ...
I was defending a flag from pirate assault ... back in the game now, not in real life ... when I realized that sometimes it takes a while for the Ai to get into the attack, especially when visible distance on the battlefield is very low. I had got my troops into my chosen defensive positions early on, and now kept clicking for the Ai to take it's turn and advance against my forces. And it was taking a while ...

Which is when I hit upon the idea of virtualizing the Ai's move. First check that they can't be seen, then make simulate how far along their path their current tactic can take them distance-wise, make sure that they'er not going to be spotted by the player's forces, and dump them at the end of their phase, decreasing their Action Points as if their turn had been taken normally. For the player, no more interminable waiting whilst the Ai to complete something that they can't see. 3+ minutes for the Ai turn could become 45 seconds.

And if the Ai could be spotted during their virtual movement, then play their turn as normal, have the player's trooper spot them, and let all hell break loose as normal.

Needless to say ... it turned out to be considerably more of a pain in the backside to get it to work correctly. First up my test function - 5 whole lines - worked lovely ... then when I rolled it into the full Ai thinking process - 10000 lines - I had to invert the values.

Then they kept falling through the terrain and other objects - make a check for that - then they all try and jump on each other - check for that - then they fall off the end of their path somehow - check for that - then they have the falling through terrain issue again - recheck post virtualized move for that. But finally it all works. The key of course was to slap the camera on the Ai so I could see what was happening when it all went wrong.

And so here's a little video of something that will never be shown in general gameplay - the Ai moving in dev mode.





Also I finally finished off the last of my character art - so here's a video of all of the different factions in various conditions.

Character types:
Unarmoured - with hat
Light Armour - helmet
Stealth Armour - helmet and camouflage
Heavy Armour - tin man with Regime flag facings (not all flags finished at time of video)

In order:
Regime/Faction - Environment - Weather

British Royalists - Temperate - Clear
Austro-Hungarian Empire - Jungle - Stormy
Chinese Dynasty - Mountainous - Clear
US Republic - Arid - Cloudy
People's Collective - Urban - Clear
Zulu Nation - Mountainous - Stormy

Followed by repeats of the various regimes in various environments with various weathers.

You might want to up the quality level - no idea why it's defaulted to 360p when it's in 720HD ...




I finally also finished the flags for all of the regimes - though admittedly after that video had been taken. I didn't want the flags to be particularly historical, as that kind of takes the fun out of it being Steampunk.

This is what the Single Battle Mode options screen looks like now:



From the left:
That's a stylized Imperial Engle on the Austro-Hungarian Empire

Union jack ensign and crown for the British Royalists

Traditional Chinese (Cantonese) word for Dragon for Chinese Dynasty - I came up with this after many failed attempts to make a stylized dragon design that I liked ... then thought that using the script for the word might be nice. Colours taken from the Qing Dynasty of the Steampunk peroid. They did have a dragon picture on their flag but I didn't like it.

Soviet Constructivist Colour Scheme for the People's Collective. Always knew that degree in art history would come in useful eventually ...

Slight change on the 1877 version of the Stars and Stripes by making the twin circles of stars into solid hoops for the US Replubic faction.

And finally, because of alphebetical order the Zulu Nation.

I sorted some really annoying issue with the Ai not always updating their aim aniation - probably self inflicted due to the manner in which I've changed spawning and mounting - and also made a rather spiffing icon for my game.




This being a MUCH larger version of said icon ... obviously.

Thursday, 31 May 2012

I Break Everything And Then Fix It! Oh The Exciting Life Of Indie Deving!

I had a liver detox diet, lost the strange bicycle tire which had appeared around my torso, eat more fruit than anyone had ever eaten before, took up skipping - which is knackerising - bought a few crates of ale and a bottle of baffling expensive rum under the guide of death metal celloist (it was a very pretty bottle),
sat about in the garden because it had finally stopped raining in the Shire of York after the wettest Spring since 1907. And even found time to break everything that I'd done dev-wise whilst trying to fix it.

So I ended up changing my art style again ... immediately after I'd decided on what it was going to be ...

So it is now more "painterly" and less "abstract".


I'd done a bit of refractoring my working level, shrinking the size of the hedges a little and opening more gaps between them. I'd also noticed that I'd been getting a fair few failures on pathfinding with the Recast resource. My terrain is very bumpy and I'd set >1500 custom class CoverNodes about and done pathfinding between them with an automated script to test around 7 million paths. Initially I'd a rather worrying 2.5 million failures, and after a bit of saving throws in my pathfinding scripts, I'd got that down to <200k, and then thrown in a simple "move to nearest node where you can actually get a path" incase that 3.7% failure rate occured in game.

I'd improved my Ai, getting them to make decisions about when they should try and hide from the player. Previously they'd either stopped at distance if they were "support" or advanced if they were "assault". I've always been a fan of turn based strategy/tactics games ... which is why I'm making one obviously ... but sometimes their Ai has been a bit ... daft. Steel Panthers I'm looking at you. I added in a whole load of new thinking to make the computer act more in the way a player would, but still using it's randomized battle plan.

Suddenly my Ai were filled with awesome and powered by buttkicking, so it was time to remove all the little helpers I'd given them previously to make them more competitive, like maxing out their stats, they now get the same chances for decent stats as the player.

Which all goes to make battles more competitive, varied and fair.

Somewhere amongst all of this I'd noticed a few bugs so I'd fixed them, and thus managed to break "many things", again mostly pertaining to the Ai. After a fair bit more hitting IDE with a mallet I got things working again as they should do.


I'd also made a start on creating some player characters - or at least a "base character". I'd looked at some of the meshes that I'd got from Evolver for use in Blender some time ago, and studied one of these as a base for rigging and animating a custom character. I'm doing a SteamPunk vibe, so everyone "struts imperiously". I'm still using Ye Olde Blender 1.44 with DTS exporter 0.964, though I export with collada for the foliage/trees/bushes so I can use vertex painting.

I'd also made a whole load of improvements to my GUIs, such as adding a new button for reserving a shot at half maximum range if you don't want your little chap to be wasting shots on things miles away that he's unlikely to hit. In "loadout" I'd also added the ability to equip one chap and then have his equipment cloned to all unequipped troops - money and individual strength/encumberance permitting - which is incredibly useful when you have a bag of Conscript Militia who can only use basic equipment until they get promoted ... should any of them survive the battle.

Still to do is a bit more Ai thinking tweaking, a bit more environment tweaking, creating some finalized models for troops and weapons, testing the assault and defend gametypes, doing the art for GUIs, and errr ... general stuff. My bug fixing list gets smaller, my todo list doesn't seem to. Oh the exciting life of Indie Deving!

tl;dr good things happened, bad things got fixed, I'm eating a lot of fruit.

Thursday, 12 April 2012

Stylized Art Style is ... er ... Stylized, Plus Other Stuff

So after much "umming" and "ahhing" and even a bit of "harrmuphing", I settled on an art style I settled on an art style and booted up Ye Olde Blender and Le Gimp deux point six.




Harrumph.

A long time ago in a galaxy far, far away ... well, a long time ago anyhow, in a previous project, I'd long since dispensed with the idea of using "all the pixels". To be honest, I'd never entertained the concept of using "all the pixels" and had always favoured the stylized approach eschewing grey and brown.

But stylized is kind of a broad brush ... initially I'd attempted much more cartoonish, slapping a cartoon outline shader on it, but visually, it ended up looking really busy. Eventually I ended up drawing things out hand roughly, and then applying various filters in gimp until I got something stylized and simplified which I liked. Same process for the modeling in Blender, keeping things fairly simple, and then slapping stylized, manipulated textures on them, and doing some final tonal tweaking using the "diffuseColor" in material in T3D's material editor.




Behold! Stylized terrain! Behold! Colour! ... spelt with a "u"!

Now I also have a randomized weather system which I have whined on about before. Each weather type changes the viewable/spotable distance of targets on the battlefield. If you can't see it, you can't attack it (regardless of whether you've got a weapon with the neccessary range). So we have the same scene in the pic below in all 4 weather types.

Clear - 300m spotting
Cloudy - 200m spotting
Stormy - 100m spotting
Night - 50m spotting






Apart from the ground cover (grass) which was part of an art pack and may or may not be replaced eventually and the rain texture which will be replaced soon, everything else is custom, minus the player model obviously ... but that will be on the list to sort out pretty soonish, as I'm in the process of defining an alpha/beta demo. And then ... ????, because I am working on the classic plan of:

1. Make Computer Game
2. ????
3. Profit!

It's the middle bit which is going to take some thinking about ... and of course I'm still working on 1 in the meantime. And it is 1 which has been expanded, with two new battle modes for the squad tactics battle part of the game. Technically it's one battle mode with two sides, as it's attack and defend a HQ, symbolized as the regime's flag. In the main campaign mode (big thing, lot's of dirigibles and hexes) attacking a territory (or your territory being attacked) will result in either a clearance mission or an assault/defend mission, depending on whether or not the territory is under garrison protection.

In assault/defend gametype, the attacker attempts to storm the enemy HQ by moving into contact with the defender's flag within 30 turns (more than enough to accomplish the task or be routed trying). I've got the Ai to use booby traps if they are on the defensive (can be spotted by recce and sapper classes and defused/captureed by sappers and prematurely detonated by any other explosion) and have some available, and created tactics for their defence when protecting their HQ flag.




Amusingly, whilst doing all 6 factions flags (plus pirates), I had to check which way up a British flag goes ... apparently the wrong way is an international distress symbol - but you'd need keen eyes to spot that ...

I'd also decided to tidy up the last few loose ends of my Ai scripts, mainly to do with choosing what weapon is best under certain circumstances and how best to rearm from deceased troopers, ... and promptly found some of them to be a right old mess when reading back through them. So the old flow-chart was dusted off again for a major refit of Ai decision making. Still pending.

I've also changed the pathfinding solution that I was using and have now integrated recast - which I had previously used in a few resources enabling Ai in deathmatch in Torque3D's stock Chinatown showoff map. Read the instructions carefully for integrating recast if you've got Torque and fancy ago.

No video of it all in action yet.

So, still to do ... things ... many things ... create initial custom player types with all the animations, sort out the artwork for the GUIs, bang up a playable demo, wonder about aplha/beta funding and whether to do it ... or indeed how to do it.

Harrumph, harrumph, harrumph ...

Friday, 27 January 2012

Something That Vaguely Resembles A Game ...

 Does exactly what it says on the tin! I've got a full blown ... if rather rough ... battle with the Ai on the go - and it all works! Well, apart form the bits when it crashes - but I'll see about fixing that later.

Well, it took 8 months but it's something that vaguely resembles a game. At least the single battle part is, which will eventually be squeezed into work with the larger Strategy-Flying-Around-Conquering-Stuff part.

But anyhoo, it works "just as planned" ... only rougher 'cos there's various parts which need tweaking, changing or just downright fixing.

I'd struggled for some time ... and pontificated considerably longer ... about how to get the Ai opponent to choose a team of troopers from the available resources of cash, veterans, 6x classes, and class-level based equipment. Initially it seemed easiest to make pre-defined teams with minor variations ... right up to the point when it became clear that this was obviously a rubbish way of doing things.

After a few morale boosting sessions where I charitably lined the Chancellor of the Exchequer's pockets in a country pub ... and trying to kill a seagull that oblitered the procedurally generated algorithm I was dreaming about, it all became quite clear.

I created a simple yet awesome system which procedurally generated an opposing force within the constraints of available cash, veterans and class levels based on weather, strategy, objectives and multiple squad tactics. No, I don't remember how ... it was all a dislocated haze, but then for Stevie, Real Life ™ gets fainter and fainter everyday ... (I find it helps if you say that in a strained and high pitched voice)

So there it is, an Ai team playing to the strengths afforded to them, using one of 8 different tactical approaches. These are fairly regular sort of tactics and are as follows:

1. Extended Line - sweep down across the battlefield, advancing on the enemy ... it worked in the Great War! Oh wait ... no ... no it didn't ...
2. Frontal Assault - group everyone together and go straight for the enemy ... and hope they don't have to many MGs, mortars or anything else that makes a mess out of a large group in open terrain ...
3. Hook and Line Left - central support group with flanking assault group to the left.
4. Hook and Line Right - guess what this is the mirror image of?
5. Horns of the Buffalo - Zulutastic. Dual assault groups flanking on either side with a central support team.
6. Pincer Movement - twin flanking assault groups.
7. Flank Support - twin flanking support groups engaging at range.
8. Skirmish Line - like extended line but made up of long range support gunners, keeping their distance as much as possible.

Needless to say, weather and terrain conditions are taken into account when the Ai are choosing tactics and classes. So if it's pitch black and everyone is tripping over each other in the dark, there's a lot more chance of their being assault groups than support groups, and likewise, if it's a barren, featureless desert with visibility stretching for miles/kilometers/leagues/cubics they're not going to create vast numbers of assault squads armed with pistols. This doesn't mean that they won't occassionally pick a less suitable tactic - just that they are a lot less likely. History is filled with plans which "seemed like a good idea at the time".

Anyhow, as I mentioned, it plays like a game ... except when it doesn't and crashes. Upgrading to the newest version of the engine might help - still using a customized previous version ...

I've still got 4 post-it notes full of bugs to sort out. And the player really does require a lot more feedback on what is happening during the enemy turn. At the moment reactive fire works fine, the camera mvoes to the player's trooper being targeted and positions itself so you can see who is shooting at him. Ideally this also needs to track visible enemies whilst they move. Talking of visible enemies, spotting works fine, showing and hiding opponents as they move in and out of sight, so no rotating the camera around an obstacle to try and spot an opponent that your team members cannot see.

Reactive fire works both ways, requiring the passive team to successfully spot and have enough initiative (based on distance, stance, angle) to either fire first or fire as the opponent moves.

The Tactical-PlayGUI (as opossed to the StrategicOverview-PlayGui) is the only one which still requires to be overhauled, and there's a definite need to highlight the start of the player's next turn as I've spent a while staring at the screen before realising that I had control of my buttons back.

I also need some sort of victory/loser screen detailing what your troops did and what sort of performance you had.

I'd been concerned over a few things and had halved the weight of ammo for fear it was too easy for playesr/Ai to run low. Turns out they don't actually use that much (either human or Ai) in any of my test battles. Also, battles are over a lot quicker than I had expected. Initially I was a bit disturbed at the ease I won my first battle 10-3, but then lost both my next battles 5-10 and 7-10 respectively when the Ai used different tactics and the terrain was less open. With both forces equal it's a fairly nice challenge.

Gah ... enough typing ... video of a battle, with the boring bits edited out. Features plenty of spotting, reactive fire, some healing and some panicking in both teams over the deaths of team-mates.


Easier to see what the hell is going on in HD but you knew that ...



Next to do is improve how the Ai decides how to start each turn, which weapon to go with when they have multiples. They already do pretty well when deciding on grenades or bullets. Currently I have the "Meeting Engagement" gametype working pretty well, but also need Assault and Defence. Also tanks/armoured cavalry needed or the Sapper class isn't going to have too much to do with it's specialized explosives. Finish up my save/load solution and eventually cram it all into the strategy part of the game so that the campaign mode works fully. And of course art ... which all comes last after the damn thing works properly.

Thursday, 25 August 2011

Strategy Gameplay CivLite Hexagon Hell also Dirigibles

Does exactly what it says in the title ... I think ... Behold the wonder of hexagons! Behold not very good mathematics for procedural placement. Also behold Dirigibles. Have you beheld? Then good.


The idea is StrategyLite-TacticalHeavy ... to be honest I just made that up right at this moment - which is probably exactly how marketing departments work in huge, lumbering, faceless multinational corporations ... maybe I'll patent it ... and then sue everyone who ever used a hyphen ...

I'd ummed and ahhed about how to make a world map for the strategy campaign section of my squad tactics game idea - and after about 30 seconds decided on hexagon models, mostly due to them having less sides than octogon models. I proceeded to quickly make said models because I had nothing hexagonal to use as a placeholder. Then a slapped a load of them together to see how it looked.





Each area is supposed to give a random amount of resources (agriculture, population, natural resources) based on geographical type of Temperate, Urban, Mountainous, Arid and Jungle. It works in a simple rock/paper/scissors (don't run with the last one!), so agriculture feeds population, population gathers natural resources, natural resources = spending money from your chosen Regime.

Obviously having a manually placed campaign world isn't terribly interesting for replayability, so I came up with a half-arsed procedural generation scheme, which after much bafflement of mathematics and only one cup of tea since stumbling out of bed, gave me a fully randomized giant hexagon of hexagons. With it being a giant hexagon I thus had 6 corners to place the starting garrisons of each of the 6 factions/regimes I'd decided on.



Majestic ... and that's just the Ambient Occlusion map! Textures to come ...

I knocked out the basic idea of gameplay for this section, with the player's vehicle moving around in a Pac-Manesque manner, eating up unoccupied groups of hexagons, and slapping his sponsor's flag on it. The idea is that when the avatar hits a blank hex, it lays claim to all free hexes that are touching. Eventually they'll come across a hex which is occupied by a rival faction or get raided by dastardly zeppelin pirates, and then it's combat in the squad tactial gameplay bit. Troop numbers for defenders will depend on the population of the hex under attack, and bonus troops if it's in protective range of a dirigible or garrison. The attacking troop numbers will depend on what type of dirigible is attacking the area. Rinse and repeat until each Regime has had all of it's garrisons blown-to-buggeration and only one Faction is left.





Still a fair bit to finalize, I've got to sort out various Ai strategies for this gametype, the whole cash flow thing, creating new garrisons (game over if you lose them all!), and obviously some save system is rather neccessary. Also I need to work out the ins-and-outs of moving from the strategy zone to the tactical zone and back again, with the score, character losses, promotions, etc.

And of course all of the finalized art for this ...

In other news, back to the tactical zone for a moment as I decided it would be fun to have secondary explosions. So if any cache of weapons/ammo that's been dropped has an explosive (eg: grenade) in it, and then it gets caught in a blast - it'll go bang too.





In the end, I'm sure it'll all be ...

Thursday, 18 November 2010

Splosh Screens, Selection Screens, Demo Screens

With construction of a vaguely working alpha demo in progress, I was hammering away at the splash screen license obligations ... a glance to irc and wtf everybody's just got sacked that worked on the engine tech I use ...

So, it's been user interface work recently, and additional gametype ... err ... types.

I'd been quite chuffed with my implementation of a randomized gametype, and had expanded on the initial idea. There were 5 open areas of a 2km level, the player was randomly equipped and initially randomly spawned at one area and each area had to be cleared in any order the player fancied. Random numbers of Enemy Ai were randomly spread through each area, and randomly armed with either short or long range weapons depending on what sort of view they had. Hiding inside a house = short range, view from a window or rooftop = long range.

I figured I could throw in a few more random ideas to increase gameplay, and so came up with strongpoints and counterattacks on top of clearance ... which happen ... randomly. Thus each area could be a standard clearance operation where the player had to hunt down each Enemy spread throughout the area, but now it could also be an assault against a randomly chosen building crowded with hostile Ai, or the enemy Ai would come looking for trouble when they heard allies shooting ... but only halfway from their defensive position to player spawn area to prevent spawnkills. Regardless of random tactic type, all short-range weaponed Ai always counterattacked over a very short distance to prevent themselves being picked off at range, that way long-ranged Ai would stay put to provide supporting fire whilst short-ranged would be mobile around the goal node.


First attempt at Ai pathfinding in level

And I'd managed to fit in my "anti last man standing" idea, where the allied Ai swarm over the location of the last remaining enemy, thus preventing those frustrating "can't find the last bad guy to finish the level" type issues which can occur with such things.

I gave the player 3 respawns per area, and had dead Ai drop either ammunition, grenades or a small health pack. Each area took me around 20 minutes to play through, and taking down all 5 areas of the map could take 2 hours. So I made a "fast gametype".


Level Selection and Fast Game Mode

Fast gametype was a random strongpoint attack in a single area, with a slightly more beefed up number of random enemies to guarentee plenty of action. This made me think of a few variations for additional gametypes ... but ... y'know ... one thing at a time.

As ever, I found a gazzilion issues with everything I did, great swathes of script wrote at 5am that were never going to function properly in the cold light of day, and various other bugs that got stomped on and features that got relentlessly tweaked.

All this new stuff needed a user interface. Not just for mission selection, but also the type of instructions and info that you'd expect, such as what the controls are and what the differences between the various weapons are.

First Attempt at user interface that vaguely makes sense

I also thought that it might be a good idea to explain what the hell the whole thing is ... plus I then had to look through all of my stuff to see what I'd used. Now, I have attempted to do as much as I can almost all of the audio is my own - but I couldn't get a good fire/burning loop, but everything else is self done. All of the models are hamfistedly made, rigged, textured, animated by myself. I used various self shot photos for base texture templates and tiled them myself ... and then got the rest of the templates from on-line. Fonts and music weren't even worth my attempting and so were straight off licensed from the start. I haven't even looked at Fmod Ex yet, having just thrown in the audio dll. And that's all this stuff takes so much time.


Credit Page attempt 2

And then there were some annoying issues. My pathfinding is based on a waypoint resource, though it hasn't scaled well to such a large and open environment. I've got a level with a lot of changes in height and direction and the sheer number of waypoint style objects for the Ai to navigate around the whole thing has eaten 25 percent of my performance - which is annoying ...

But currently ... that's how my alpha demo will be going out. Afterwards I'll have to take a look at nodegrids and maybe other solutions as a replacement.

Also I need to do a bit of 2D artwork to "tart" it up a bit, and 2 of my buildings are still placeholders. And there's some functions hacking I think I might try as a performance test ...

But all in all, we're well on our way ... and ... allegedly ... I should be able to crank out a rough but playable demo full of issues by the end of November. Which is 12 days away ... awww hell ...

Wednesday, 30 June 2010

The Big Ai Test -> Post Debug Hell - Corporate Devs Free Beer!?

BBBBBBZZZZZZZZZZZZZzzzzzzzzzzzzzzzzzzzzzzzzzZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
Anyone else got a funny buzzing in their ears ... ?


Whoa - almost missed a monthly update ... so ignoring the sudden outbreak of tinitus ...

So ... Ai is ... about sorted ... there's a few rough edges here and there ... but it's about sorted.



It's got Dijkstra pathfinding ported over from my original ancient demo and it's got basic dynamic avoidance for when they run into each other ... something more high tech than my previous "bounce off each other" that dated from way back when.

And it's really 3 Ai routines in one. There's my originally conceived Call of Lawyers style trigger based, squad Ai movement goals ->. It's a scripted design to get Ai exactly where they are wanted.


It was supposed to be "gratuitous bunny slippers" but turned into "gratuitous bum shots" ...

And then there's two fully dynamic routines.

First up, is a simple "move towards nearest enemy", think of it like rubber banding. The Ai selects the nearest target and moves towards it regardless of whether it could actually be detected or not. It's supposed to be a little trick to force action to happen, and can be used against a specific target - eg: the player.

The second method is purely dynamic, with the Ai deciding it's goals visually and then with an audible fallback if it cannot see anything. Failing to detect any targets at all means that it will patrol randomly.

Visual targeting, whether for dynamic goal decisions or just plain shooting is decided across a number of visual factors from how alert the Ai is, the angle at which the would be target is, the distance, the target's pose - lying in a bush being a lot harder to see than jumping up and down, whether the target is firing itself (aim for muzzle flash at long range), and so on and so forth.

Hearing is done by a mixture of Ai alertness, target noise - if it's shooting, or close range movement - creeping around just behind. There is also a state of "global alertness" so if an Ai is far away but can still hear gunfire they'll stop chilling and start to investigate. All of this enables the most basic use of stealth possible.



Each of these 3 methods come off the main Ai routine and allows for instant changing between them if required --- it also helps to keep the Ai integrated, and avoids many different datablock/functions from being created for seperate types of Ai --- though it also might have just been me wanting to try and keep things tidy and integrated together as one. After so much going back and forth between things as I teach myself development - I didn't fancy doing that with my Ai, so it's pretty much everything that I can think of, which I would need.

In testing this integration works fine for both ranged-based and melee-based Ai.


Zulus! ... I mean, PathNodes! ... thousands of 'em

Ai have stress and threat levels (one used to check the other) so depending on how much threat they are facing depends on how they act, from running around normally -> to ducking and being cautious -> to being pinned down -> falling back -------> to full blown rout with accompanying cover head and flee animation.

All of these states can also be scripted/triggered rather than engage organically, and of course they can also be ignored.

Needless to say all this took a fair bit hammering away at the old keyboard - and then even more time debugging all of my errors - especially as it seems far too easy to get one thing working, go on to another, and then break the first. Mr Fairfax has my sympathies ...

After much happily hunting around a maze working all the issues out -

... like isObject really means doesExist which technically isn't the same thing ...

- it was time for some large scale testing and a chance to try out a community script snippet for automated pathnode grid creation, which works quite nicely out of the bag.



First up is something I seem to have recorded at entirely the wrong size - cos that ain't 720p. It's an initial outdoor test with a fairly widely spaced nodegrid.

There are 32 Ai, split into 2 teams, all of whom are using the Dynamic audio/visual Hunting routines. It's a bit laggy with the forward rendering of the shadows, and the paths were not precompiled but getting built from the node grid when requested. Without the extra overhead of the video it was giving around 40fps in-game. It does give quite a nice "organic feel to a battle".


1080p test - but you'll have to click the YouTube sidn to get the HiDef source ... though YT insists on chewing on my quality

Second up is the same battle but with shadows disabled to lessen the stress on the GPU and 50 dynamically hunting Ai to heighten the stress test for the CPU. Paths are precompiled this time. Even in the midst of one helluva firefight, fps keeps between 60-90, depending on how many Ai have to render LOD_0 up close to the camera.

So all in all, I'm pretty chuffed, --- or maybe that should just be relieved ... and talking about blowing your own trump-vuvazela... stuff!

Also stuff - BBBBZZZZZZZZZZzzzzzzzzzzZZZZZZZZZZZZ and a big ball of fire in the sky the likes of which this part of cloudy Auld England doesn't get terribly much of, have been vying for my attention this month. As had a weekend break --- No use of a contomiter for three days! Possibly a new personal record though I did get to go to some Corporate Dev's own bar (instead of a sign advertizing the company building, they just have a normal brass name/number plate with the face buttons of their controller in the corner) ... and the booze is subsidized! 6 bottles of imported Euro lager and free popcorn for 7 quid (10bucks). It is still just a glorified canteen with coloured chairs though.

I was the only person wearing a tie and suit jacket. ... goddamn hippies ...

Tuesday, 8 April 2008

Integrated AI Routines Test

A(nother) test of pathfinding (from previous post) which is now using Astar, my new targeting and combat routines, and a basic "Teflon" script to stop the AI bumping into each other and getting stuck. They do try to check for a clean shot but I've still had to use a friendly-fire suppression script for blue-on-blue projectile collisions, especially with the spread of shotguns.

I had followed a tutorial on how to make decent quality videos for posting on YouTube, but it's still not great quality once uploaded. The audio files are placeholder sounds scrounged from games I own. Sorting my own audio out is currently a low priority. Getting a working-but-dubious-demo is the priority.



Not a commentary on China and Tibet. It's just riot coppers fighting armed civilians (who need their LODs fixing).

Wednesday, 26 March 2008

Pre-Compiled Node Graph Pathfinding

After much "jiggery-pokery" I've managed to get a code based pre-compiled node graph working for my AI's pathfinding. Much better than my previously scripted solution. It's hugely faster to implement, mostly automated (so less errors/typos/general-cockups available on my part) and the paths are pre-compiled so the AI don't have to work out their routes on the fly.

It took a bit of integrating into my AI system, but we got their in the end. Thanks go to Gabriel Notman of Bolton Uni for making the original resource on design doc available.

This test video uses the stock TGE CTF map and assets (hence the slightly bizarre fantasy buildings), with my first gen AI model and animations. Blue lines are the Node Graph, green lines are the set path.

Friday, 21 March 2008

Pathfinding Maze

More pathfinding testing with a script written Dijkstra. All node adjacencies are inputed manually which is a bit time consuming and open to typos - and typos cause crashes.

Wednesday, 12 March 2008

Video of first attempt at pathfinding in action



Obviously ignore the basic models, textures, animations, etc - it's the AI not walking into walls which is the important thing here.

Tuesday, 11 March 2008

Do AI Dream of Electric Llamas?

Subtitle: The Joys of not walking into walls.

I've had a basic -but working- pathfinding routine going which my AI have been slavishly wandering around, happily not walking into things. It's a Dijkstra based script with manually predefined node connections (that C grade in Maths I scraped at school has finally come in handy) where the AI builds a path from it's position to it's goal. It all works fair enough but looks terribly wooden as the AI pull many 90 degree turns in the open, so I've added functionality.

AI Pathfinding Routine:
1: Check that we have a goal - if not chill. Goals are set to named AI at spawn and altered via triggers.
2: Get a vector distance to the goal - if it's under 2 metres we're there. Clear the goal. Thread 1.
3: Check LOS to goal - if it's clear run to it directly (No need to waste precious processor power on it.) Thread2, if not we're gonna have to run Dijkstra to find a path around the obstacles.
4: Build the node list and get moving along it.
5: At every node make an LOS check to the goal
If it's clear make the current node the last in the path and just run to the goal. Thread 2.
If LOS is still blocked by something, move to the next node in the list. Repeat until path complete and Thread 2.

This all makes things look much better, cutting down on the slavish adherence to the path when the goal is clear, and gives a more naturalistic route. I still want to enlarge the AI goal radius (currently 10cm/4 inches which is just daft - when I made my SP campaigns for Call of Duty I never went under 32 inches if I needed them right in a certain places - like a window - and quite often felt 64 was fine) and I need to come up with a team-member-avoidance/onstuck function to stop the AI bumping into each other (a larger goal radius should also help to reduce contacts).

And sorting out some demo-reel footage might be good.