r/rugbyunion Mar 04 '25

Video Retro rugby game - Another 6 months progress

1.4k Upvotes

234 comments sorted by

View all comments

1

u/EatThatPotato šŸ‡°šŸ‡·KoreašŸ‡°šŸ‡· Mar 04 '25

I’ve always wanted to make something like this, but could never get around figuring out how to do the teammates/enemy team AI. Just curious how you did that one, is it reinforcement learning, if so, with what heuristics, how is the reward and all that.

I would love to hear a technical breakdown, or just a simple one would be nice. Just a nerdy CS student, but not much of a game dev haha

Love the game, definitely getting it when it releases

1

u/Spripedpantaloonz Mar 04 '25

Thanks for checking it out! With regards to the player AI, it’s all controlled with a finite state machine. So their states are broken down into like ā€œfreeā€, ā€œtacklingā€, ā€œbeing tackledā€, ā€œin ruckā€ etc. then within those states you can do further checks to control their placements depending on who has the ball or if the ball is free etc. the hardest state is the free state, because this is basically where the most decisions are made. I save each players formation in separate arrays depending on defending, attacking, line outs, kickoff, scrums etc. and they will align by checking the array and moving towards those positions. I swap between a mix of hard coded coordinates on the pitch, which is exact x and y values. And sometimes offsets from the balls position. Depending on the situation. Hope this helps, and good luck with any future efforts!