I work in credit score modeling. I want to explain how I see AI in terms of credit scores. Both AI and credit scores are based on similar underlying processes. The main difference is a credit score will rank order and you pick a value above which to accept all (need a 720 or whatever) whereas an AI credit score will only pick the top choice and reject all the others. So it would be like if the only person that got a home loan this year was the person with the top score and everyone else got nothing.
Fundamentally all AI involves is this:
1) Listing the choices
2) Scoring the choices
3) Picking highest rank
#2 has the most variation. #1 is a brute force exercise of playing your game and making note of all the possible decisions an AI could do. You don't need to be comprehensive - if you play strategy games you tend to see the AI sticks with a limited number of choices and that is good enough to keep people entertained.
#3 is easy
So #2 - how do you score? Well the important think to remember is the actual score does not matter - what matters is rank order of the choices. So lets say you have a tic tac toe game. You have to 1) list the possible squares that the AI can place an X and 2) Score the consequence of each placement and 3) go with the highest score.
Scoring in a tic tac toe game could be simple. You will find that better AIs don't do different methods, they just take more time listing the choices and do a better job at correctly rank ordering the choices.
For my game, an example would be the AI trying to find where to found its first city. I both 1) allow it to cheat and see the tiles around it from turn 1 for the purposes of founding a city and 2) force it to pick the best choice it can get to in the same turn. In practice what I have found is a quicker AI is more fun rather than one that is slow to develop so the choice was made for "fun" reasons and not any real reason.
What the algorithm does is start out searching the tiles immediately around it and each tile gets a score. The score is completely arbitrary. I experiment and right now for farming cities the score is roughly:
float score = (tiles_grass_within_3+.5*tiles_plains_within_3) * (pow(tiles_tree_within_3,.2) + pow(tiles_mtn_within_3,.2));
I raise the trees and mountains to the .2 so that there are diminishing returns. For the basic city (the first city), you want a mix. For an industry focused city, you want mountains & trees and don't care about grass so the score is different.
In the first step, I multiply farming producing tiles by the raw material (wood and mining) tiles. If either are 0 within 3 tiles, the score is a zero and the process stops.
If the score is above zero, I want to add a benefit to having water nearby.
The actual values do not matter - what matters is that they rank order so that the best win is usually one of the best. It doesn't need to be perfect and often you will look at areas and see "overlaps" where a lower score tile would have been better. You can refine it to better rank order, or you can just leave it as is.
What I observe in playing games is that they often get a rough rank order approximation for the choices and then makeup for deficiencies in not having the choices listed and ranked properly by giving the AI bonuses. So lets say it can't rank order its economic choices very well, but it matters less because it gets a bonus.
In addition, because my game has so many AI players (a 50x50 map has about 40+ right now), lets say the AI is 40% as good at playing the game as the human. You can make up for that simply by the fact that if everything were actually equal, the human would have a 1/40 chance of "winning" and now with the inefficiencies, it actaully makes it more fun for people because people will only tolerate getting their asses kicked so many times.
Credit scoring and AI
There's only need for one forum for now. Discuss development. No advertising or thinly veiled attempts at advertising. Create a single thread for your project and be prepared to show and tell.
1 post • Page 1 of 1
- Posts: 40
- Joined: Fri May 08, 2020 2:33 pm
1 post • Page 1 of 1