How to write a game AI (1)

       Due to the unsatisfactory playing of the last two hands of ai in the current game, the work on hand is temporarily finished. I was arranged to learn AI, and the ultimate goal is to retrain/optimize the existing AI . And this is just my record, only my application, not research . Although it was just like this, when I heard about this task, my heart refused.

       The reasons are as follows:

       1. To write a Doudizhu AI, I think it is very difficult, technology and mathematics must have a certain level.

       2. The old man is just a programmer who has just worked for 2 years, and he is still a non-AI major. When I was born, I found it difficult to get ideas.

       3. The old man takes this salary (ashamed, hey). . . If I can really write, am I worth the money? Do I dare to use what I write.

       Although I am unwilling in my heart, my body is very honest. After all, I betrayed my work. Even if you ask me to go to the sun at 38 degrees and ask me to eat fast food in the toilet, I have nothing to refuse. After all, I spend money to buy my time. Record your own journey as much as possible, show it to yourself, and share it with people who want to learn to write game AI in a situation similar to mine. If any colleague sees what I said is wrong, please point it out. I would like to thank my manager Xiao Ye, my talent is relatively dull, he took me to understand and write down the first test about 0-9 black and white pictures . Let's enter the text below.

       

     1. What is the AI ​​in our game?

        In fact, AI is not as difficult as imagined. AI is also divided into 369 levels. For example, the NPC in the game can talk to you and give you tasks. This is relatively simple and does not require machine learning; furthermore, in mmo games The monster, boss, knows to attack you actively, knows to release skills, knows to hide skills (this may not need to use machine learning, or I don’t know, because I have only played board games at present); further, do you think Do you match real people in the chess and card games you play, or do you think that the teammates you match in other games are all human? Maybe they are just AI (this requires machine learning, this thing already has Similar to human thoughts to accompany you to play games).

      2. What is training an AI

        It is to train a model. When you give it an input, the model can predict the output with the greatest probability (similar to a function, you give an input and it returns an output). For example, the image test AI, given the input is an image, it uses the output to tell you what the maximum probability this image is. Note that this is to tell you what the maximum probability output is, not what the output is (will continue to talk about this later).

      3. How to train an AI

        In fact, predecessors have already done a lot of things, just like we want to train AI, not everything has to be written by ourselves. Now there are many deep learning frameworks, just me, I just apply, I just need to find the right framework , Then use the framework to train the AI ​​you want (similar to many library functions, just find the library function you want to use, then call it, and get the result).

      4. My learning journey

        1. Added some knowledge

        2. The manager added some knowledge to me, and then under his leadership, wrote a 0-9 black and white image to try AI

        3. After the above journey, start to explore on your own and train a Doudizhu AI

 

        Note: Training == writing, training an AI == writing an AI, some things are terminology, I am not a professional, but I contacted it again, so sometimes I will be incoherent.

        The first article probably writes so much, and will be updated later

       

Guess you like

Origin blog.csdn.net/banfushen007/article/details/107698113