Legacy GM Sports Game Intricacies Brainstorm

mar_cuz

Member
Hi all,

I'm currently working on a sports game. I believe I have a good plan to handle general play and ai of the players and that part should be o.k. I just don't know how I would go about handling the intricacies of the sport. For example in soccer when there is a free kick awarded, the player gets the ball and the opposition cannot attack them until the player plays on and kicks. Also the players in soccer would move and man up or zone the field in that circumstance. Also if there was a corner kick or a throw in, the players would choose a specific position on the field. I was thinking these could be like a cut scene or something similar.

How would you handle this? I'm just looking to pick some brains and get some ideas to help in the right direction. There are no right or wrong answer to this think of this as a brainstorm.

Thanks.
 
Last edited:

Neptune

Member
I definitely feel like a state-machine.

For the AI:
if state == "free kick" {"run to x,y"}
if state == "normal" && type == "goalie" {"defend the goal"}

This is obviously simplifying the situation a lot, but you could make a nice system with a bunch of different states and 'switch' statements.
 

mar_cuz

Member
I definitely feel like a state-machine.

For the AI:
if state == "free kick" {"run to x,y"}
if state == "normal" && type == "goalie" {"defend the goal"}

This is obviously simplifying the situation a lot, but you could make a nice system with a bunch of different states and 'switch' statements.
Thanks for your input. I am currently using state machines for general play and ai. I was hoping for another solution I wasn't aware of.

There are a large number of different situations that will happen all over the field. For example, a throw in, a particular player (generally nearest to it) will be chosen to throw it in, and the players will assume a position on the field based on where the throw in is happening. But throw ins can happen all along the side line so telling the players 'if throw in, go to x will only work for that single throw in only. Also, it's not a soccer game I'm just using it as an example because it's a wider known sport than the one I'm trying to make which is Australian Football.
 
If you are not doing this already, use formations. Have a "throw in" formation.

The formation is just a set of x,y coordinates centered around the origin that so players can use as target positions to aim for. When there is a throw in, assign an AI player to each of the target points and have them run there.

Just offset the x,y of the formation coordinates with the x,y of the throw in position.
 

mar_cuz

Member
If you are not doing this already, use formations. Have a "throw in" formation.

The formation is just a set of x,y coordinates centered around the origin that so players can use as target positions to aim for. When there is a throw in, assign an AI player to each of the target points and have them run there.

Just offset the x,y of the formation coordinates with the x,y of the throw in position.
Hey thanks. I hadn't thought of formations. So I could get x,y of where the ball goes out and have the formation use those coordinates as the 'start point' and move players like x = start point x+ 25 etc. I like it. I'll see if I can work that into my game.
 
Yes, that's it. You could have different formations set up for different parts of the game. Also, you can take the formation target positions and add a little randomness to them to make the ai actions more life-like. I'm sure you get the idea already!
 

mar_cuz

Member
Yes, that's it. You could have different formations set up for different parts of the game. Also, you can take the formation target positions and add a little randomness to them to make the ai actions more life-like. I'm sure you get the idea already!
Yes randomness will give it a more natural feel will definitely add it in.
 
Top