Sign in to follow this  
Andrew Blem

Unity Is the use of path finding algorithms a good idea for dribbling in sport games

Recommended Posts

Andrew Blem    139

Well I  have been working on a soccer game for the past few months ("still learning unity 3d. its my first game"). I have recently come across some minimum path finding algorithms in my studies ( Prim's algorithm, Djikstra algorithm, a*, fFyod etc). I have been thinking of adopting one of these algorithm into my game to help in the players navigating around the soccer pitch to reach the opponents goal. This algorithm will be used during player dribbling and the map will be periodically updated or i was thinking the dribbler will create a map  and decide which path to go to minimize resource usage. I know the best way of learning is trial and error but I would love some heads up on this one. So what do you think I should do

Share this post

Link to post
Share on other sites
Alberth    9525
jdean300    255

It seems to me like you're going to get a lot of complexity for very little gain. If we ignore players for a moment, there are no obstacles with which the players can collide, so you don't need a path finding system to move them around. Now if we consider players, you have obstacles but their positions are changing so often you will have a challenge maintaining the graph used for path finding. You'd either need to constantly recompute paths, which means that most of the last computed path would have never been used, or you're going to need to do a lot of work to predict where players are going to be.


Think about a path as having two sets of constraints - static and dynamic. Static constraints are those that do not move, such as buildings or cars or whatever else can just sit there in your way. Dynamic constraints would be other moving objects or players. Minimum path algorithms are great with static constraints.


In handling dynamic constraints in path finding, you generally use various steering behaviors to avoid the collision, or you replan the local portions of the path. In your application, your static constraints are going to be essentially non-existent, and you will have a lot of dynamic constraints on a path. So the question is, if we need to use short localized paths or steering behaviors to handle all these dynamic constraints, and there are no static constraints, what does path finding get you?


I think steering behaviors are your best bet for this because they are more suited to constant re-evaluation and they are more localized than a path finding approach. If you check out the book "Programming Game AI by Example" by Mat Buckland, you'll get some ideas for combining steering behaviors and how to implement them to give you good results in a sports game. There is also a good amount of information online for steering behaviors, but it's usually for more simple actions such as Seek, Flee, Patrol or Wander. The book will give you information on the more interesting ones like Interpose, which is going to be useful when getting players to intercept a pass.

Share this post

Link to post
Share on other sites
HappyCoder    5053
In an AI I took class we implemented simple pathfinding once using repulsor and attractor fields meaning you can add shapes to grid that effect a flow vector for every other point on the grid. Enemies would push away for a short range, the target would pull from a very far range. Our pathing agents would simply follow the flow. It worked surprisingly well, although it wouldn't work at all in a maze but a soccer field really isn't a maze.

You could have different fields depending on the state of the player (ie, on defense vs on offense with the ball/without the ball). Also something to note, you don't calculate the entire flow field, just the single point where the player is.

Share this post

Link to post
Share on other sites
rjuang    137

I don't see enough reason to do path finding in a soccer game. Soccer field is an open space that you can establish a line of sight from anywhere to anywhere. All obstacles in the soccer game are other players which are dynamic and bad candidates for caching and sharing their states, which can be very bad if every player is also doing his own path planning periodically. Steering behaviors seem more suitable for this type of game. The natural looking movement is also a nice bonus.

Share this post

Link to post
Share on other sites
Burnt_Fyr    1665

I seem to be doing this often as of late, but i second the recommendation to check out "AI game programming by example" by buckland. In fact, it's probably one of the best "game dev" books i have seen on the subject. Matt actually does a soccer pitch as a multi agent sim. It would definitely give you a good starting point. the key points are that agents use steering behaviors (such as seek, interpose, and wall avoidance) to navigate the pitch.

Share this post

Link to post
Share on other sites
Andrew Blem    139
I would have liked to mark all your answers correct. Well Matt Buckland's book is the base of this project and I am trying to add to that. I have implemented the whisker technique, though not perfect its decent.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By EvaBalikova
      Main menu in Feudal Alloy. 
    • By Jcyshadow97
      Hi guys,i m looking for someone that can work with me on a "top-down" multiplayer fps as 2d and 3d artist.I used photon server and i can take the part of programming.For now i made only the basic gameplay of the game that include shooting,switch weapon and and damage player.If someone can help me please contact me via e mail:
      I really appreciate your collaboration and hope you have a good day.....
      Thanks for you time to read the post
      At the bottom i attach some screenshot of the current game,i m sorry that i can't attach a video...

    • By Raptor42
      I'm looking to form a new game development team, mostly for training purposes.
      About me:
      I'm a student - Unity C# developer, who worked part-time in this industry for a couple of years already. I've been a lead developer in many "random collab groups" as well as a few companies. I specialize in creating 2D games for Android, but I'm looking forward to trying out new things - especially 3D development.
      Currently, I've got one Android game close to a release so I'd work for this team in my spare time. 
      About the project:
      I've been thinking about creating a simple tycoon-like simulation game for Android (and PC eventually), inspired by the Game Dev Story (initially released by Kairosoft in 1997) 
      I haven't done much planning though, therefore I'm looking forward to hearing out your ideas.
      Right now, I've only created a test 3D scene using placeholder models and implemented a simple pathfinding system for me to play around with:
      I'm looking to work with people who are:
      - willing to take a position of a: 3D modeller/2D artist/Designer
      - not necessarily very experienced, but eager to learn and improve their skills
      - active - check in at least once a day
      If you'd like to apply for a different position which I didn't list here, you are welcome to contact me as well.
      While this project is created mostly for learning purposes, if we ever get to release it and generate any revenue - you will recieve a certain percentage of it.
      To Apply:
      Send an email to
      Introduce yourself and attach an example of your work (if you have any)
    • By EvaBalikova

      We're a two-member team and I'd like to introduce you our game - Feudal Alloy. 
      It's a metroidvania-style action RPG with fishbowl-powered medieval robots.

      We've been working on the project for a few months. I'd be happy for any feedback.
      Our Steam page is public now: 
      steam link

    • By MisspeldGames
      Ballimals is a work in progress physics-based fighting game where your only source of movement is some form of a "Grappling Gun" or jump, be it a chicken's tongue or an elephant's trunk. It features a similar system to Super Smash Bros, where you have to knock other players off the screen. However there are no "percentage-health" system yet, and I probably won't add something like that either. All aspects of the game is currently made by me, and even though I might believe it is amazing I desperately need someone else to take a look at it and give me some feedback. Therefore, I would appreciate it if you could take a look at the screenshots, try the concept/movement demo and potentially check out my devlog.
      The game currently features three playable characters, three playable levels, a character select and a level select. All of the character's share the same basic moves, but have one unique special attack.

      Character select

      Level select

      Level 1 displaying the elephant performing his special attack: Elphquake.

      Level 2 displaying the pig performing his special attack: Megafart or something... Also, the egg is the chickens special attack and can eggsplode.

      Level 3 displaying the pig swinging by his snot.
      Download the concept/movement demo here.
      You can also listen to some of the music I have composed so far. I am fairly new to composing would love to hear what you think. You can find it on my devlog.
      Any and all feedback is extremely appreciated.
      Thanks for reading!
      Edit: You will need a controller to play the demo.
  • Popular Now