How do I make a good Sport AI?

0 favourites
  • 4 posts
From the Asset Store
Setup and ready for your art, animations and story. Viral Storybook App Template.
  • right now i just use pathfinding to make the AI move to the ball but its not great, has anyone found a good way of doing it?

  • This is a very broad question and impossible to answer properly without more information.

    What sort of sport game is it? Do the players need to maintain some kind of field position? Is there a field at all? Is your sport game based on a realism, or is it a fantasy sport game?

    More information about your game would possibly be beneficial to getting a good answer.

    ~Sol

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • its like mini golf and football(soccor), with 2 opposing teams of 4 trying to get the ball in the opposing teams goal. The player can move freely and can also fire "bullets" at the ball. Right now my AI all just charge at the ball randomly shooting at it towards the goal.

    What im hoping for is to maintain field position,

    Shoot more accurately at the goal. (right now im literally just using goal is within x angles then they shoot)

    Any help is greatly appreciated, Thank you

  • This is likely to get very confusing and complicated, but I will try to give you some ideas.

    For maintaining field position you could do a check for the distance between the ball and each AI player. If they are too far away from the ball then they will go to their position on the field instead. You can perhaps over-ride this if there is NO player close to the ball, you can pick the AI which is CLOSEST to the ball and make him chase it. Obvioulsy there are a lot more things to take care of regarding this - but this would maybe be a good place to start.

    You can also make shooting the ball the same... the AI player must be within a certain distance (use the distance(x1,y1,x2,y2) formula) before he/she will shoot the ball.

    Using if goal is within angle is probably a good way to do it - but you could add some accuracy changes using an instance variable for that player so it will maybe go a little bit left or tight when they shoot to give it a little more realism.

    You can also try to make the AI dodge around the player if the distance is too close. This would be a fairly complex thing to do since you would need some math to figure out the best direction for the AI to change to from it's current direction.

    Everything about a sport game is really easy to make, except for the AI. AI in a sport style game is by far the most complex part of the game - since that's really what makes the game good.

    Hopefully some of these ideas might help.

    ~Sol

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)