Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: American Football  (Read 160 times)

0 Members and 1 Guest are viewing this topic.

Arcade

  • Full Member
  • ***
  • Posts: 196
    • View Profile
American Football
« on: February 02, 2019, 08:24:49 pm »
A while back I posted in the Screenshot thread with a brief gif of an American football game I had started to work on. I've managed to continue working on it off and on since then so I decided to go ahead and make this thread where I can post some more detail for anyone interested. The game is far from done, but it feels like good timing since the real life football Superbowl Championship is this weekend.

The biggest challenge so far has been implementing the AI. The interesting thing about making a video game based on a real game is that there are pre-established rules that the AI needs to follow and they need to behave somewhat realistically. I don't want to fill up this thread with explanations of how American football works for those unfamiliar, but I'll try to give some brief descriptions of what my following gifs are showing.



A lot of these gifs are showing different game situations. The first one shows the offensive team on the left in white shirts throwing a quick pass to one of their receivers. The red lines show the routes that each receiver is going to run. The job of the thrower (quarterback) is to find an open receiver and throw them the ball.

Some of the players on the defense side in purple shirts have big yellow circles. These defenders are in a "zone" defense. The yellow circles represent the zone that they will try to prevent receivers from catching the ball in. The other defenders are either trying to tackle the quarterback while he still has the ball or are defending the receivers 1-on-1 in a "man" defense. In this case the receiver is able to catch the ball and gain 6 or 7 yards down the field before being tackled.

The small numbers above the players head and the small colored circles under their feet are just debugging information I have being displayed. They mostly represent the ID of the player and what behavior the AI is running.

(click to show/hide)

Part of my motivation for working on this game is that I've always wondered how sports games handle AI. I thought it would be a fun challenge to try and replicate it. The throwing aspect is one part that took me a while to get right. It's hard to calculate the direction angle, height angle, and speed the QB needs to throw the ball in order for the receiver to catch it on the run. The previous gif shows the QB just able to get the ball between 2 defenders so that the receiver can make a big catch. Sometimes the defense is able to crowd the receiver a little better resulting in an unsuccessful catch.

(click to show/hide)

There are also several kicking situations in American football, which I've been implementing. This next gif is a Field Goal kick where the team with the ball (in purple) tries to kick the ball between the goal posts for 3 points.

(click to show/hide)

In order to design these plays that I want each team to run, I've built an editor into the game. The next gif shows me designing the starting position and route I want a receiver to run. I then simulate the play which shows the receiver following the route, making a catch, and then juking the defenders for a big gain.
(click to show/hide)

The last thing I'll show off are some of the menu systems outside of the main game. These still need a lot more work aesthetically, but one of the important things you can do from here is set your "depth chart". This basically means setting which of your players you want playing at each position. Each player has different stats and abilities.

(click to show/hide)

The post is getting long, so I'll stop it here. The game still needs a lot of work, including a lot of planned AI improvements, but I hope to stick with it as I have time. The libraries I've been using to put this all together are just SFML (window, graphics, etc) and SQLite for the database backend to store information about each player.

 

anything