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

Author Topic: American Football  (Read 16883 times)

0 Members and 1 Guest are viewing this topic.

Arcade

  • Full Member
  • ***
  • Posts: 230
    • 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.

neves768

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Re: American Football
« Reply #1 on: April 21, 2019, 05:16:04 am »
Looks amazing! Can't wait for more :)
Are you still working on it?

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: American Football
« Reply #2 on: April 22, 2019, 04:39:04 pm »
Thanks for taking a look, I'm glad you like it so far. Yup, I'm still working on it as I have time, but there is still a lot of work to be done.

I've taken a break from working on the football simulation aspect of it for a bit and am now focusing on some of the menus. I'm specifically implementing the ability to create new teams/schools from the main menu right now (I say 'schools' because I actually intend for this game to be based on American college football). This means things like being able to customize the team name/colors (the gifs above have the team colors hard coded), and generating a realistic roster.

The roster generation part has been pretty hard to get something implemented I'm happy with. I've had to throw it away and re-do it few times. My first naive approach was to just generate the abilities of each player on the team completely randomly, but as expected this would cause goofy things to happen like randomly making a lineman the fastest player on the team, or making the kicker the best thrower on the team. I've now attempted to put a weight on each ability based on the player's position and how good I want the player to be. My current implementation still isn't perfect, but it's getting closer. I think if I just tune the distributions on my random number generators a little more I can end up with something pretty good.

Hopefully sometime soon I'll have more screenshots/gifs to share.

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: American Football
« Reply #3 on: May 16, 2019, 06:50:25 am »
As I mentioned in my last post, I've been working on menus to allow creating new football teams in-game. It needs to be polished up and made to look nicer, but I think a lot of the initial functionality I want is there. Sorry that my gifs below have been shrunk down, which makes the text a bit hard to read.


Creating a new team also means creating players for that team. Each player has 17 abilities right now (speed, strength, etc) that impact how they perform. Again, sorry the text is hard to read in the below gif, but it also shows off some of the improvements I've made to my widgets for displaying tables of text. I can now scroll vertically and horizontally to see all of my players and all of their abilities.
(click to show/hide)

Lastly, I've started working on a "dynamic" camera which attempts to automatically follow the action of the game and also automatically zoom in/out as needed.
(click to show/hide)

higgipoker

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: American Football
« Reply #4 on: July 30, 2019, 11:00:43 am »
Great project! I'm doing something similar with soccer, in the style of that timeless classic - Sensible Soccer:

https://youtu.be/vE9_PJwoXeA

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: American Football
« Reply #5 on: April 07, 2020, 04:51:43 am »
Looks good higgipoker!

It's been a while since my last update, but I'm still slowly making progress. I've implemented a lot of miscellaneous things, but I'll just call out a few of the larger changes.

First of all, I've implemented the ability to choose which plays you want your team to run. The gifs I posted in the past also showed me modifying plays, but that was in my "play designer" tool. Now you can choose plays during the actual football games. I'm exciting about this because it's the first step in turning this project from just a simulation you watch into an actual game where your input influences what happens :) . You still can't control the individual players, but you can be the coach and call out the plays to be run.


Another big feature that I implemented is a "career mode". This is where you pick out a team to control game-to-game and season-to-season. A schedule gets generated at the beginning of each season that each team follows as you progress through the season. This also means that there are a lot of football games being played between AI controlled teams that the user isn't involved with. A big challenge I faced for the career mode was re-architecting my code to allow running these AI games in a background thread. The gif below shows a dialog running in the main thread providing score and other stat updates about a game running in a background thread.
(click to show/hide)

On my computer a background simulation like this takes a couple of minutes, which isn't too bad considering a normally played game can last around an hour. However, it's unfortunately still unacceptably slow. In real life there are over 100 football teams, which means I would need to simulate over 50 games at a time. I need all of these games to be simulated in seconds or minutes, not hours. Because of this I had to implement a second method of simulation, one that determines the outcomes of games based on statistical analysis instead of fully simulating all of the players and ball movements. With this method, I'm able to run all of the AI games in the background at a much faster speed (though there is still room for optimizations). The gif below shows multiple games involving different teams being simulated back-to-back.
(click to show/hide)

I am also now keeping track of various statistics during games, which get saved to a database and can be viewed in the menus between games. I've added the ability to sort data in my table widgets by columns for easier browsing.
(click to show/hide)

Lastly, I've implemented the ability to recruit new players to your team. For those that follow American Football at the college level, you know that this is a big part of a coach's responsibilities. You can research what kind of players your team needs and then search for available recruits that match your criteria. Once you find the recruits you want, you can start trying to convince them to join your team while competing against other teams trying to do the same thing. I won't post a gif for this one because it's just more menu interactions like my previous gif and isn't too visually exciting

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: American Football
« Reply #6 on: November 09, 2020, 04:36:03 am »
Hello everyone

Poking in for another update after a long delay. The game is still a little rough around the edges, but otherwise it's starting to feel more and more like a real game! In fact, it's at a point to where I want to open it up for others to play.  I recently put up an "early access" build on itch.io if anyone is interested in checking it out. Though, I did put a price on it. I'm testing the waters on itch.io to see if this is something anyone would be willing to pay for  ;D.  Hopefully the price isn't too steep. Sorry in advance if this type of self-promotion isn't appropriate here.


Since my last post I've implemented a lot of miscellaneous things. A few of the highlights include:
  • Major improvements to player recruiting. A large part of American Football at the college/university level involves the coaches recruiting players to come to their respective school and play for their team. I've implemented a bit of a mini-game where you can research these prospective recruits and save the ones you want to go after. You can then try to convince them to come to you school by calling them and picking a topic to talk about. If you picked a topic that is important to that recruit then you may receive bonus points towards their interest in your school. If you have the most points for a given recruit at the end of the season then they may choose to join your team next season.

    (click to show/hide)

    In the above screenshot you can also see that the window shows a picture of the recruit. As part of this update I implemented a way to procedurally generate pictures for all recruits (and all other players too for that matter). I'm pretty happy with the way the pictures have turned out. I plan to implement more variety in the faces over time.

  • I always envisioned this game to be a management sim where you call plays as the coach and watch the players act them out. However, I've been experimenting with direct player control like a more traditional football game. You now have the option of picking what control style you want to use. You can choose to control the players like a traditional football game, choose to only call the plays, or choose to do nothing and only spectate. The gif below shows me directly controlling the players on the left team.

    (click to show/hide)


Faenrir

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: American Football
« Reply #7 on: December 03, 2020, 05:35:33 pm »
Really cool project !!
Looks fun.

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: American Football
« Reply #8 on: August 08, 2022, 03:41:07 am »
I've continued to add more features and polish to my American Football game over time since my last post here. Too many changes to list them all here, but most notably I decided to create a demo if anyone wants to give the game a try for free :)! The demo is fully featured other than limiting the "career" mode to 2 in-game weeks. It can be found on the game's itch.io page.

 

anything