Ambient NPC Population

Ambient NPC Population, a continuation of an idea ...


A Free CryENGINE SDK for everyone in August 2011? ...

Adventures In Textures

Seeing just how low you can go with the poly count by offsetting a lack of geometry with normal mapping and hand painted textures ...

UDK - Hawken

Indie development at its best ...

Unreal Engine 3 - Environments Features Overview

Gorgeous tech demo trailer showcasing the features of Unreal Engine 3 and its free counterpart, the Unreal Development Kit ...

Monday, 30 August 2010

Attack of the Killer pathfinding butterflies!

Just a little bit of fun with A* pathfinding using Blitzmax and Leadwerks, and some Butterfly/Insect AI I had been working on.

Sunday, 29 August 2010

A* Pathfinding Using Blitzmax And Leadwerks Engine

Following on from:

On The Right Path, A* Pathfinding In Leadwerks.

The Way Forward ... Making Blitzmax Trax ...

I decided to give the testing a few more hours. First off I wanted to create a new NPC Type which would have its own control flags and most importantly its own path storage buffer.

After a little thinking (a little thinking is what I excel at lol) and a few hours of coding and tweaking, I managed to get 32 new NPC Types all pathfinding their individual way around "BlocksVille".

For those interested I will try and get a demo.exe up later onto the showcase thread:

Pathfinding With A*

Demo now added: Hide And Seek Demo 2

Monday, 23 August 2010

The Way Forward ... Making Blitzmax Trax ...

Following on from "On The Right Path, A* Pathfinding In Leadwerks" I thought before I archive the code, I'd have a little "dabble" with a basic function to get an NPC reading the path data and then following it to the "target" I had a couple of ideas on how to do this but as time for playing in leadwerks was running out I opted for a basic idea.

1. Target Position Selected
2. Path from NPC to selection calculated.
3. Path transfered to a temp storage array for that particular NPC
4. An NPC Pilot reads that data.
5. NPC follows the pilot.

Think of the "pilot" as the plastic stick thing on the underside of a scaletrix car .. it follows the groove in the track and the car follows right along. This was the quickest and dirtiest method but solved a variety of issues in one. Plus I just wanted to get the NPC moving and the sands of time were running out.

So an hour later and I have not only the NPC following the generated path but the path is updated with a repositioning of the target and the pilot takes the NPC off onto the new track.

This is all still quick and dirty, when I can remember what the code does and does not need, I will up a small demo.exe to the thread Pathfinding With A*

EDIT: I have uploaded a demo.exe here : Hide And Seek Demo

Friday, 20 August 2010

On The Right Path, A* Pathfinding In Leadwerks.

Well, it has been a while since I made a blog entry, let alone done any work in LE. But I do keep an eye on the forum and Leadwerks in between Daily life and working on my project(s).

I have also been going through my Blitzmax code archive, where I stored all my Blitmax/LE projects and code snippets (finished and not completed). One idea I had been playing with before, was basic NPC AI. I had some small success with some Bugs using autonomous logic.

See Here

In my "treasure trove" of unfinished and messy development code I found what was going to be the next step (for me) with AI functionality. The dreaded "pathfinding". I have read that Naughty Alien said he will be doing a two part tutorial on this and I am looking forward to that, having followed his work with Hidden Dawn I expect the tutorial to be top notch. But I wanted to get to grips with the in's and out's myself. So I started with the basics. I spent some time looking for code snippets and A* lib's in any language that had them to see of I could follow along what was being done ... Not a good place to start, in the end I spent some time reading "A* Pathfinding for Beginners", very helpful.I decided it would be best to start with a "2D" approach and maybe use nodes. Most 2D implementations use a grid based on the X and Y co-ordinates of the screen and tiles to represent an "unwalkable" tile. So I thought I would translate this approach to a 128 x 128 flat terrain with some primitive models to define the "unwalkable tiles". As this was a time limited "side-track" in LE from my other projects, it was all going to have to be quick and dirty. I wrote an app to calculate which "tiles" of the 128 x 128 terrain did not have an obstruction and then squirted this data out to a text file to be read into another app as a 2D array. The map data loads in a few milliseconds so this eliminated having to wait for the same data to be generated by the application I wanted to use to try and get the pathfinding working. One problem I did encounter was that I ended up trying to reconcile three different centre of origins for the co-ordinates. The map data had 0,0 at the top left, the terrain of course has 0,0,0 in the centre and my maths managed to get the A* to read 0,0 at the bottom left, after some profanity meditation I used some quick and dirty and hastily constructed math functions to bring them all into focus, thus as per usual the dev. code was a complete mess, atleast on that score I am consistent lol


This version of pathfinding is very limited, mainly due to the way I created the node info. But for a first attempt I was quite happy.

I have uploaded a demo App to the Leadwerks Forum showcase , the picking can be a little temperamental and sometimes the quickest path is not always found and some "sightseeing" seems to find its way into the route. But on the whole I think it is definitely a platform on which to build.


Twitter Delicious Facebook Digg Stumbleupon Favorites