So I've been bowling in a test match in Ashes and thinking a bit about the AI and how we can get their shot selections, scoring rates and also dismissals more realistic. Currently I'm not a fan of the "hidden scoring target", as I feel it takes things out of the control of the player, but we're told if this is removed then the AI will not play attacking strokes go nowhere. What this suggests to me that there is something fundamentally wrong with the way the AI is coded to choose which balls to attack/defend/leave etc.
I've heard a beta tester (I think @WealeyH?) say that one of the reasons the AI is deficient and needs to cheat is because it's too easy for the player to bowl perfect/perfect deliveries every time. While this is true and it would be great if we could figure out a way to make bowling harder, again I think there should be more to it than this. For example, currently if I decide I'm going to bowl a half-volley on leg-stump and hit perfect/perfect on the timings then does that make it a good delivery? Any good batsman will put that way 9 times out of 10, intentional or not, but currently in Ashes it entirely depends on the hidden run-rate target whether they will hit it to the boundary or tap it meekly to the square-leg fielder. So my proposed system:
Every AI batsman has an "Adaptive Heat-map"
Pictured above is VERY ROUGH idea of what I'm suggesting. The player bowls the ball and depending where it ends up on reaching the batsman this will affect what action he decides to take. For example in this image, which I would consider for a test match batsman quite early in his innings, green would be duck/leave, blue would be block and red would be playing a run-scoring stroke (I'm a horrible batsman so don't take this map as gospel ). Then he will play the appropriate shot based on where the ball is (I suspect there is already something similar to this in Ashes but given the issues we have with the AI it doesn't seem anywhere near comprehensive enough).
The main point of this system is that it will change depending on various conditions such as match type, match situation, required-rate, player confidence, player preference (eg, leg/off side favoured players), the field setting etc etc etc. In the final over of a T20 the entire heat-map would be red which would mean we would NEVER have to see a player blocking the ball at the death again.
(One caveat is full-tosses/double bouncers which would obviously need to be accounted for as a full toss bowled by a spinner on off-stump probably shouldn't be blocked )
Currently there is also a problem with the AI where they always know where the ball is going to end up (wacky fun-house seam patch proved this to be the case ) so how are we going to keep the AI from being too OP with this new system where they always make the correct choice for the situation?
AI batsman "Predict" the path/timing of the ball
Earlier I said that the batsman will play based on where the ball ends up but that's not actually the case. What I propose instead is that when the player finishes the bowling inputs (at the point of release in the animation) there are actually two paths generated in the game. One that the ball will take and the other which is the one that the batsman will make his decision and play his shot for. Here's an example using he heat-map:
Let's say it's the first morning of an English test match and you're bowling as Jimmy Anderson. You choose an out-swing delivery and nail your line+length. At the other end is an Indian opener who is not the best at playing swing (). Therefore, based on his attributes and the line+length that the player input, the game generates point A as his prediction for where the ball will arrive at the crease, it will pick a forward defensive shot for him to play. However, simultaneously the game also takes into account the new ball/overhead conditions/attributes of our bowler (Jimmy) and generates the actual path of the ball, which will swing off the predicted line and reach the batsman at point B. As the batsman has now prodded his forward defense down the wrong line, the ball takes the edge and flies beautifully to slip . The best way to think of it is to imagine you're bowling two balls at once, one an out-swinger and one an invisible straight ball. It is the straight ball that the batsman is playing for.
Obviously on a pitch with no movement and bowling to a high-skilled and confident batsman, the points A and B would be basically on top of each other and you'll be tearing your hair out to get a wicket.
One thing I like about this system is it solves a lot of the problems we've had in the previous games. On top of the batsman seemingly omniscient abilities to predict spin/seam/swing it also creates variance in batsman ability: Lower rated batsmen will obviously have a prediction point much further away from where the ball actually arrives and we can have batsmen who are good at playing spin but bad against swing purely based on how much the prediction point differs from the actual ball. I've thought a bit about a system of player traits and here's an image showing a player who I've decided has the trait "can't pick the googly"
This would be to a ball by a leg-spinner that is pitched around off-stump. Our hapless batsman thinks it's going to be a leggy arriving at point A and so plays a push towards the covers but "oh no!" it's actually a googly and the ball spins through the gate to clatter into leg stump.
Another thing this system solves is the effect pitch degradation has on the batsmen. As the ball starts to move unpredictably just have some random balls where A + B do not match up regardless of what is bowled. Would be great to see some horror balls where it keeps low or spins way more than usual.
Ok so one thing I haven't addressed is the timing. Obviously batsmen can be fooled by changes of pace (or just beaten straight up by fast deliveries) and not only movement. It's harder to depict visually but I think it's a similar idea. Batsman predicts the ball will arrive at point A in 0.5 seconds, but it actually comes at 0.60 and he misses it because he's too early. In stuff like T20 where you're constantly changing your pace to try and fool the batsman this is could get pretty complicated but it would ultimately be down to the batsman's timing attribute how successful they are against different paced deliveries.
Summary of what I feel at the main pros of this system compared to the current one:
- AI no longer has just a number they are aiming for and instead plays based on their "adaptive heat-map" which will change depending on many variables, leading to more natural shot selection and scoring in all formats
- Allows much more noticeable variation between AI batsmen based on attributes, ability and mentality
- Lets the player feel like they can fool the batsman with movement/changes of pace and get realistic dismissals
- Conditions have visible effect on how the AI batsmen play
Alright, that was just me throwing out my ideas again. I'm no coder so I have no clue how feasible this system would be to implement into a game and there's obviously a million variables you can account for in a game of cricket. Just a bare bones proposal and I expect I've overlooked some stuff so I'd be interested to hear the thoughts of anyone who bothered to read all this.
Cheers!
Warning: I've no idea if any of this makes any sense. I'm just running with your idea and mixing it with thoughts I've had in the past.
I definitely think the quality of the delivery (Perfect/Perfect) should not be as big a determining factor for whether or not the AI batsman plays a delivery. Ideally, Perfect/Perfect delivery would mean the length and movement is spot on. Drop below and there are reductions in the effectiveness of the ball in terms of accuracy and intended movement. I don't think speed should be reduced unless the timing is way off.
When it comes to AI batting whatever system I think of it in terms of whittling down the shots available to the batsman until you are left with a single shot they would play to each possible delivery. So you go from all shots being available then factors such as batsman skill, batsman mentality, match situation, conditions, opposition get you down to the shot that is played. So it's not always the case that the shot selected will be the batsman's best shot but the shot that is most suited to the situation - so conservative batsman that need to attack would be forced out of their comfort zones in T20 and the same for attacking batsman needing to defend in test matches.
I like the idea of thinking of it as heat maps. The Shot Zones image is just a quick example I threw together. Each circle would correspond to a set of shots (Normal, Attacking, Defensive, Leave - maybe grounded aggressive and special shots too) that would be selected prior to the delivery so that when the ball pitches in the zone that shot is played. In theory it'd be a normal cover drive, a lofted cover drive, a defensive push directed towards cover and leaving the ball. Green they are good in that zone, amber they are Ok and red means it's not a strength. That would be determined through however skills would be set up. Maybe it'd be for individual shots or something more simple like ability at front foot, back foot, leg sides, off side, straight etc.
Let's say a Zone has five possible varieties of a shot - they begin with an equal likelihood (20%) of being played. Then you introduce the other factors which adjust the percentage. Mentality (attacking) would push an attacking cover drive to 40%, leave and defensive to 10%. Match situation - if it's say the last over of a T20 - pushes the attacking cover drive up to 60%, leave and defensive down to 0%. That's a basic start, other things would need to be thrown to refine the calculation.
For me the key is refining the skills that are involved with how the shots are selected. In the image below I've thrown in a few example skills that might be useful to explain my thoughts about the process. So, it isn't that the AI will know where they ball will go but will have a pre-determined response for each scenario (which zone the ball pitches in).
For all I know this may be similar to how it actually works now and it just needs refining - which is where those new skills could come on useful.
I think you've got to take into consideration batsman skill, batsman mentality, batsman preferences, conditions, match situation, opposition tactics (the bowler and field settings) and the batting team tactics.
It's trying to find a logical path for each batsman to play a certain shot.