Designing an AI Engine for Cricket

gideon_swrd

Club Captain
Joined
Jul 5, 2016
I've been a big fan of BigAnt due to the dedication they've shown to the community and the quality of DBC 14.

My only nit in the game is the AI which doesn't play rationally at times.

Since I have a background in the field, I decided to write an AI engine for cricket based on a Monte Carlo Tree Search approach

I've written a blog post describing the engine:

Resonant AI: Designing an AI for Cricket

And made the code available on github under the MIT license (most permissive):

GitHub - adikal/cricket: Monte Carlo Tree Search based AI Engine for the game of Cricket

Feel free to check it out. Would also love to hear any feedback.
 
Great read but one thing im curious to know about is the last line of your post, integrating the AI with Graphical engine, how difficult it is, cause Even DBC 14 when simulated the match engine gives pretty decent scorecards atleast for the match [ though over a series or tournament it gives unrealistic figures but i guess MCTS would be helpful there]. to me have always felt integrating the AI with Graphical engine compared to text engine is varied! Text based games have great Decision making AI compared to the Graphical ones especially rpgs, action sports etc... As you have mentioned,I think it also ties in heavily with the field selection, shot placement and shot selection [ i would like to know your ideas on how it would tie with the latitude and other factors while being in sync with stats and attribs] the physics and the independent behaviour of fields and to make it match with MCTS to balance it with attribs as well as stats! Would be great to hear your thoughts on it!



Now i dont know if you are game dev, but since you had mentioned about the graphical engine, have you given it a shot with some thing like say unreal engine 4 were it is easy to to prototype something barebones!

Thanks for sharing, great work, will also checkout the match engine and try it out!

was just checking your profile, The games you have mentioned as inspiration, Wow that OUTCAST (1999) seems way ahead of its time really interesting from the looks of it and the features i read! How did it not Succeed commercially!
 
Last edited:
I've been a big fan of BigAnt due to the dedication they've shown to the community and the quality of DBC 14.

My only nit in the game is the AI which doesn't play rationally at times.

Since I have a background in the field, I decided to write an AI engine for cricket based on a Monte Carlo Tree Search approach

I've written a blog post describing the engine:

Resonant AI: Designing an AI for Cricket

And made the code available on github under the MIT license (most permissive):

GitHub - adikal/cricket: Monte Carlo Tree Search based AI Engine for the game of Cricket

Feel free to check it out. Would also love to hear any feedback.


I expect with the advances in machine learning, computing power (hopefully with the advent of quantum computing) and access to large amount of data (leveraging Big Data Analytics and cloud platforms), gaming (especially sports gaming) will alter drastically. The challenge right now is that with the existing constraints the AI simply can't get the better of a human being for a long enough time span. Eventually human users are able to "figure out" the AI. Machine learning abilities and access to data coupled with enough computing power will take care of this concern coz even if a human user manages to figure out AI and change tactics, the AI will do the same resulting in the video game evolving into a game of chess, which is what the case is with professional sports most of the times.

Currently video games come with tags such as "Adaptive AI" but it really isn't the case. Most of the games rely on balancing the game in favor of AI (also called scripting) at higher difficulty levels to artificially match up to a human user. That's one of the key reasons why folks eventually move to online gaming for longevity but if the AI itself remains "fresh" or keeps on adapting you won't really need to do so.
 
What is the problem with DBC14 AI? I know it is a bit rubbish at batting but if you set your fields properly and give them a chance to score you can get close games. I just had a 50 over match where I scored 422 and the AI response was all out for 289 after 34 overs...on the 20th over mark they were on 180 which was the exact same score I was on after 20 overs...so you tell me :p
 
AI simply can't get the better of a human being
The challenge right now is that with the existing constraints the AI simply can't get the better of a human being for a long enough time span. Eventually human users are able to "figure out" the AI.


I dont believe the challenge is making AI better than human but making it more human! In cricket its not as much about figuring out as it is about executing, everybody knows in the death overs malinga is going to fire in those yorkers missed with slower ones, its about being to get it away for runs thats difficult!

Same can be said when human bowler is bowling, Its not about The game picking up my yorker but rather playing it realistically, and show the difference between say an MSD and a ishant sharma in handling it!



Also i dont want to get into another online vs offline banter but i think they are vastly different beasts in every game that has these two modes!

The aim of AI is always to give you an realistic experience as the irl sport more than challenge you in terms of gameplay mechanics limitations!

For EX: IT would have been super simple for BA to code the AI to bowl long hops Super slow ones and mix it with fast yorkers, I do think some people even complained about Fast bowlers having slow balls nad it was reduced in patches! I mean it could easily replicate the most used techniques of say the online tactices of say the top 10- 15 Multiplayers and randomise it a bit!

Again repeating something A human in multiplayer will just see the opponent gamer behind the screen were as the AI will mostly see the Ingame Player character and its attribs, so say when im playing as Steven smith facing James anderson in game i want the James anderson in game to treat me as steven smith and bowl that one that moves just away from me on 5th stump and not as grkrama who cant for the love of god get away a slow low long hop at 96 kph, hope that makes sense!


PvP and Human vs AI are separate modes for people to enjoy different flavors, i would even say it like this, Human vs AI is like watching the Indo pak WC match and PvP is likle after watching the match getting that rush of blood in your head and goign to the backyard withoyur friends and pelting the ball aorund, sure the later will feeel good for you when you experience it cause its you but not always and sometimes you just want to watch sachin bat or wasim bowl and this case in game feel like them!
 
Last edited:
I dont believe the challenge is making AI better than human but making it more human! In cricket its not as much about figuring out as it is about executing, everybody knows in the death overs malinga is going to fire in those yorkers missed with slower ones, its about being to get it away for runs thats difficult!

Same can be said when human bowler is bowling, Its not about The game picking up my yorker but rather playing it realistically, and show the difference between say an MSD and a ishant sharma in handling it!



Also i dont want to get into another online vs offline banter but i think they are vastly different beasts in every game that has these two modes!

The aim of AI is always to give you an realistic experience as the irl sport more than challenge you in terms of gameplay mechanics limitations!

For EX: IT would have been super simple for BA to code the AI to bowl long hops Super slow ones and mix it with fast yorkers, I do think some people even complained about Fast bowlers having slow balls nad it was reduced in patches! I mean it could easily replicate the most used techniques of say the online tactices of say the top 10- 15 Multiplayers and randomise it a bit!

Again repeating something A human in multiplayer will just see the opponent gamer behind the screen were as the AI will mostly see the Ingame Player character and its attribs, so say when im playing as Steven smith facing James anderson in game i want the James anderson in game to treat me as steven smith and bowl that one that moves just away from me on 5th stump and not as grkrama who cant for the love of god get away a slow low long hop at 96 kph, hope that makes sense!


PvP and Human vs AI are separate modes for people to enjoy different flavors, i would even say it like this, Human vs AI is like watching the Indo pak WC match and PvP is likle after watching the match getting that rush of blood in your head and goign to the backyard withoyur friends and pelting the ball aorund, sure the later will feeel good for you when you experience it cause its you but not always and sometimes you just want to watch sachin bat or wasim bowl and this case in game feel like them!

You missed my point altogether. My post was not about Online vs Offline or AI vs Multiplayer as you make it sound... it was about adaptive or "self-learning" AI which can continue to challenge human users continuously. My point was more about AI learning from human opponents and changing tactics accordingly instead of going with a formulaic approach of field settings and bowling changes.
 
This is Gold with very constructive criticism from people who are much more intelligent then me
There is always room for improvement and that's what they are trying to describe

What is the problem with DBC14 AI? I know it is a bit rubbish at batting but if you set your fields properly and give them a chance to score you can get close games. I just had a 50 over match where I scored 422 and the AI response was all out for 289 after 34 overs...on the 20th over mark they were on 180 which was the exact same score I was on after 20 overs...so you tell me :p
 
Great read but one thing im curious to know about is the last line of your post, integrating the AI with Graphical engine, how difficult it is, cause Even DBC 14 when simulated the match engine gives pretty decent scorecards atleast for the match [ though over a series or tournament it gives unrealistic figures but i guess MCTS would be helpful there]. to me have always felt integrating the AI with Graphical engine compared to text engine is varied! Text based games have great Decision making AI compared to the Graphical ones especially rpgs, action sports etc... As you have mentioned,I think it also ties in heavily with the field selection, shot placement and shot selection [ i would like to know your ideas on how it would tie with the latitude and other factors while being in sync with stats and attribs] the physics and the independent behaviour of fields and to make it match with MCTS to balance it with attribs as well as stats! Would be great to hear your thoughts on it!

Integrating the AI into a graphical engine shouldn't really be that difficult, my issue is that I haven't written a 2/3D game in a while (disclaimer: I am no game dev; as a kid my favorite hobby was writing video games but they were all in Visual Basic and quite simple - Tetris etc). I do have a tremendous appreciation for game devs given that writing a commercial game involves so many different aspects (gameplay, graphics, ai, sound etc) working together in harmony

The AI engine will almost certainly have to be optimized for a production quality game. The AI takes a few seconds to decide each move but I suspect game designers can easily optimize that.

Adding field placement and shot selection will complicate the model a bit, but in theory the framework should handle it just like the other decisions.

grkrama said:
Wow that OUTCAST (1999) seems way ahead of its time really interesting from the looks of it and the features i read! How did it not Succeed commercially!

Indeed it was. I remember being completely blown by it as a kid. I believe it was the use of voxels for the graphics engine instead of polygons (that were the rage at the time) along with extremely high CPU requirements that led to its lackluster sales..and it may also have had to do with a certain game called Half-Life released the same year (kinda like Shawshank Redemption and Forrest Gump)
 
I've been a big fan of BigAnt due to the dedication they've shown to the community and the quality of DBC 14.

My only nit in the game is the AI which doesn't play rationally at times.

Since I have a background in the field, I decided to write an AI engine for cricket based on a Monte Carlo Tree Search approach

I've written a blog post describing the engine:

Resonant AI: Designing an AI for Cricket

And made the code available on github under the MIT license (most permissive):

GitHub - adikal/cricket: Monte Carlo Tree Search based AI Engine for the game of Cricket

Feel free to check it out. Would also love to hear any feedback.

Hey pal just curious, obviously you've played icc. What's your opinion on that ai? And how does your theory-engine differ? Ive found ICC to be the closest match simulation to reality out of all cricket games I've played.
 
@gideon_swrd I just read your blog and I see you mentioned if only you had graphical engine...I remember years ago some PC members were working on a game called "The Art of Cricket" this was in cricket gaming's darkest days, where the community decided to make the effort for a realistic cricket game. Unfortunately it was never completed as far as I know, however they did release a demo sort of version...I don't know if you can get hold of those guys or anything though...

 
This is excellent. I love this stuff and will get super nerdy with you later.
 
@gideon_swrd I just read your blog and I see you mentioned if only you had graphical engine...I remember years ago some PC members were working on a game called "The Art of Cricket" this was in cricket gaming's darkest days, where the community decided to make the effort for a realistic cricket game. Unfortunately it was never completed as far as I know, however they did release a demo sort of version...I don't know if you can get hold of those guys or anything though...


That video bought back some good old memories
I think the game was only developed by 2 guys from here. Don't think they are active here anymore
 

Users who are viewing this thread

Top