Creatures Community Chat

Friday, January 28, 2011

Pathfinding

Hey peoples. Hope you've all had good Christmases...I mean holiday celebrations :P

My new year has started off pretty good. I've found a new place to move into which is closer to the city and will give me better access to nightlife and work commitments.

Although I haven't produced anything new for 'The Island' in quite a while, I have been doing a good chunk of reading and learning. First off I've ordered myself a copy of Steve Grand's book 'Creation: Life and how to make it' which will hopefully arrive in a week or two. Very much looking forward to getting my nose deep into that one.

On the side I've been reading a book by Richard Dawkins entitled 'The greatest show on earth', which for those of you who don't know is all about the science of evolution. It is predominantly meant to be a book about education as well as reducing creationist claims to rubble, but I'm also finding it quite inspiring in terms of getting back into creating this game. Having a basic understanding of evolution, natural selection and mutations should prove useful somewhere along the line.

As well as getting into some good books I've been trawling the internet to get a better understanding of pathfinding AI, which was where I started to get stuck before the new year. I found an excellent page for gaining an understanding of A* pathfinding which has given me a good grounding.

A* Pathfinding for Beginners

I've realised that trying to make my own pathfinding system for 'The Island' is going to be beyond my reach (assuming I want to do a decent job) so I've been searching through some of the Unity3D pluggins available and the one I think I'm settling on is simply called 'A* pathfinding' by Aron Granberg. A download, as well as instructions, tutorials etc can be found here:

http://www.arongranberg.com/

After some fiddling around I've finally figured out which parts of his code I need to play with to make things move about. Below is a quick video showing the pathfinding in action. You'll have to take my word for it that this is now working with code I wrote myself :P

video

Basically at my end all that's needed is to tell the code where I want the start and end points to be, set up the ground plane with some obsticles and send the data through to Aron's code. The character (in this case the cylinder) will then move to the set destination, avoiding specified obsticles in it's path.

The next stage will be trying to plug this code into Tiggy and seeing if I can get him to run after a piece of cheese.

Although it all sounds very simple (and with Aron's code laying beneath my own it really is) this is probably one of the most challenging parts of the project. Hopefully with this out of the way I'll be able to get back to creating interactions with the Norns and making a fun game again.

The new year is already looking promissing ;)

EDIT: Wow, just realised how bad the quality of that video. Appologies for that, but hopefully you can still just make out what's going on there.

6 comments:

  1. Pirate-Rob:I'm Glad to see you have found some help and are still interested in the project.

    ReplyDelete
  2. Cheers Bob. Time is always against us, especially so as a freelancing 3D generalist, but I intend to push this project as far as I can.

    Keep your eyes on this stop. My hope is that the next post will have Tiggy walking around a world. I just need to wrap my head around some array stuff...

    ReplyDelete
  3. Pirate-rob: Arrays my fav bit of code... why doesn't caos have it? Anyway thanks for updating.

    ReplyDelete
  4. Haven't really played with arrays until now (couldn't quite wrap my head around coding fast enough at uni to get to them), but at least in theory they're damn powerful.

    I'm managed to get the bit of code I was struggling with working and...well, I intend to do an update soon with a good length movie (hopefully better quality) to show you all how it's progressing. Which I have to say is very nicely :D

    ReplyDelete
  5. I was wondering the other day, Will you make it so that the game is all hardcoded or will the game be changeable like the current creature games.

    ReplyDelete
  6. @ Pirate-Rob:

    I assume you mean the creatures themselves? At present I've been working on just making things work, which means currently yes, they are hardcoded.

    However I've just finished reading Steve Grand's book 'Creation: Life and how to make it' and I think I've finally wrapped my head around how the Norns learn, and at least in theory it isn't too hard.

    Once I've got this video I promissed up, my next major task will be trying to make it so the Norns aren't hardcoded, but can 'think' for themselves.

    ReplyDelete