Results 1 to 12 of 12

Thread: Pathfinding Advice (resolved)

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    34

    Pathfinding Advice (resolved)

    I am trying to find the best solution to overcome a problem i have encountered. In the attached picture, you can see on the right side of the screen that all the AI's are starting to bunch up (the red things with bits of blue are supposed to be zombies. The textures for them haven't been done yet ). It's even worse in game since they kind of "queue" until they can move. What i would like to do is to have them use an alternate path if they cannot move. At the moment the AI will calculate the shortest path to the nearest player unit (there can be up to 4 player units) using the A-Star algorithm.

    My thoughts would be to have a variable for each AI that keeps track of how long it has remained motionless. After a period of time, i would have them find the 2nd shortest path (3rd, 4th, and so on) instead of the shortest and have them use that path to move towards the player.

    Can anyone suggest a better way?
    Or am i already on the right track?

    The problem doesn't always happen since it depends on how many enemy AI are present (there can be up to 23 and will respawn) and the location of the player units, but to me the game would play better if they occasionally used a different path anyway.
    Attached Images Attached Images  
    Last edited by Dekade; Feb 23rd, 2004 at 08:58 AM.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    as you are using a*, you can simply increase the "weighting"/"cost" of moving through a location occupied by another AI player, thus making alternative routes more likely to be taken.

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    34
    Beautiful. Works like a charm.
    I'm sure i would have thought of that eventually *cough*

    Excellent. Thank you.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    no worries mate

    looks good, are you gonna release it?

  5. #5
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Have nothing more to contribute with here...but I have to say that I love the graphics of your game. Reminds me of an old Nintendo 8Bit game I have. Can't remember what it was called....might have been something like Smash Brothers or something...hmmm....anyway...love the graphics.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    lol.. it reminds me of "Into the Eagles Nest" (had to look that up, it's been a while!). I used to love that game

  7. #7
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    It wasn't called smash borthers, but smash tv...here is a link to some photos.....can barely see the screen shots on the right side there...

    http://www.fatmangames.com/systems/b...meid=5293#pics

  8. #8

    Thread Starter
    Member
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    34
    Heh, I've never played that but it sounds like something i would have enjoyed. This may sound funny, but the whole reason i decided to make this game was due to one of my old favourite games no longer running on my pc (Space Hulk 2). I liked the idea of and endless stream of enemies attacking you as you strategically made your way through the maps.

    The idea of this game is to get your units to the exit point alive. Some maps also contain trapped civilians that you have to rescue and herd to the exit point. Civilians cannot defend themselves so you'll have to place your soldier units well in order to ensure everyone makes it out alive. Simple, but can be a lot of fun (well i enjoy playing it at least ).

    I wish i could say that i done the artwork, but the truth is i have trouble even trying to make stick figures using MS Paint. All current artwork is done by a friend of mine.

    I've made the editor flexible enough that you can make you own custom tile-sets if you wanted. That way all you need to do is flag a tile as being pathable and you can create virtually any type of landscape.

    As for a release, yep, i'll be releasing it one day i hope
    Although the version in the screen shot (which i call the "prototype") is a VB version that i'm using for testing new stuff out before rewriting it in C++. May sound like extra work but i work faster in VB and find it easier to debug.

    Anyway, when the day comes to release it i'll be sure to post a link here. Thanks for all your help

    Okay i'll stop rambling now.

  9. #9
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Sounds fun. Looking forward to see if you manage to wrap it up some day. ANd yes. It sounds like it is a lot of work to first do it in VB then in C++...

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    Sounds great, I look forward to having a play.

    I can't do art either.. I just use silly pictures or get other people to do them

    Oh, and you never know - VB could be fast enough for you.. I wrote a game in VB once with basic AI that seemed amazingly slow, a bit of re-organisation of the code (mainly reducing the number of procedure calls) made it about 20 times faster, so it was definitely playable

  11. #11

    Thread Starter
    Member
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    34
    VB is certainly fast enough for it. The game runs well. The main reason behind using VB is that i only started learning DirectX at the beginning of this year and i am more comfortable with VB than C++. I still want to redo it in C++ just to help me learn though. I wish i started learning this stuff sooner... i'm having a ball

  12. #12
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I see what you meen. I wish I started C++ earlier too. Done VB for more then 7 years now. And C++ only in one year. Done DX in VB for 3-4 years or something. And only 3 months in C++, but I all ready feel more coffortbale using it in C++ all ready. Even if my C++ isn't that good yet. But I love it. Keep us noted on any questions or anything we can help you with. Looking forward to all of your work on that game.

    ØØ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width