Search Unity

Finally I create

Discussion in 'Made With Unity' started by AngryAnt, Feb 9, 2008.

  1. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Hey

    So I got a license and found me some time to play around with unity after hanging around here for the better part of three years.


    Here it is

    http://eej.dk/unity/path/


    What is it?

    Simple A* pathfinding.


    How do I use it?

    The sphere is your character. Click it to highlight it and right-click anywhere on the surface to make the sphere go there. You'll have to set the player to full screen in order to use the right click.


    Whats wrong with it?

    I've got one bug left, and a rather serious one of the kind, where the character will some times completely ignore the pathfinding system - thinking it has a direct route to its destination. Hoping to solve that in the next few days provided I get some time to work on it.


    So whats the plan?

    To some of you it may not come as a complete surprise that my first project is concerned with AI. I'm currently working on getting a solid base for some playing around with decision logic. That includes a complete pathfinding and obstacle avoidance system.

    I'm currently in the final stages of my first version of the pathfinding system. Guide points are used to form the path network - thanks to Jonathan for inspiration on that. The second version will use navmesh for network generation. I have also made room in the design for custom/dynamic connections.

    As soon as I have the last bug ironed out in the pathfinding system I'm going to work on the obstacle avoidance system - getting simple implementations of both in place before implementing groovy features like navmesh and enhanced crowd movement.


    Thats all good, but who is you?

    Go to the unity3d irc channel on Freenode and find the loudest guy who bugs Neil for fun and spits out random garbage. Chances are you have found me or Neil in a case of split personality.


    Thats it. Just though I'd follow the trend and post my first unity project. Hope you like it. When I'm done with this and have played around with implementing a general decision logic system I'm game for some collaboration projects.
     
  2. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    Looks good, how is it working ? Grid, connected nodes or what? Does it continue to work if you move cubes around and rotate/scale them before hitting play?
     
  3. DaveyJJ

    DaveyJJ

    Joined:
    Mar 24, 2005
    Posts:
    1,558
    Very very cool. If you could also post a simplified public version on the Wiki or share anything like that here, I'm sure there are a lot of Unity folks who'd love to use that sort of thing.
     
  4. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Hi AngryAnt,

    Interesting demo. Looks like your path finding works a bit better than mine, but it seems to share a similar shortcoming as mine: if you click on an outside cube while the ball is enroute to another cube it will often hit an obstacle. In my script I think the problem is that I've only got two raycasting "feelers" and it probably would benefit from more.

    Keep us posted!
     
  5. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    Can you use something besides right-click for us Macbook and Macbook Pro users? :D
     
  6. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    You can use the alt button rather than right clicking (right click doesn't work in the web player).
     
  7. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Nice one Ant. Congrats on getting Unity.
    Did you play around with getting Ai Implant type stuff into Unity at all?
    AaronC
     
  8. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Yoggy:
    Yes. A standard A* grid. And yes. The grid is created at start and can be regenerated in its entirety or partially run-time. (If, for instance a door is closed or a building is placed in an RTS game. I'd then tell the grid to regenerate in the affected region).

    Dave:
    I have not yet decided whether I'll be releasing the source or part of it. At any rate its not suited for any eyes atm.

    Kahuna:
    That is because my path follower script is very simply implemented. It does not take into account that the character might already be moving.

    Bronx:
    Mbp user myself. Addicted to two finger click :p

    Targos:
    Naw. Uniy was not suited for our needs in ZeitGuyz and privately I don't have a license for AI.implant.
     
  9. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Fixed the bug. I have a test in my goto method which tests if pathfinding is needed at all or a direct route exists. Had forgotten to update this to include my width checks.

    Gonna have a look at some obstacle avoidance later today.
     
  10. KlaRo115

    KlaRo115

    Joined:
    Feb 24, 2006
    Posts:
    675
    I like it, that's exactly what I need for one of my games! :)
     
  11. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Hm. Made a more complex test and this revealed horrible performance. Gonna tweak the algorithm implementation some more and add multi-threading.
     
  12. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Multi-threading is now implemented, but its painfully transparent that I have a bug in my A* implementation. Will be working on optimising that next weekend perhaps.