AI in computer games (1)

Source: Internet
Author: User
Currently, there are two types of games that are closely related to AI:
The first is the so-called War chess/policy simulation game, and the second is the game of the game. The proportion and depth of AI vary in different game types. Some computer games are not advertised as highly artificial intelligence, or no one else can buy them. Others are almost confused, so that players cannot feel the existence of any artificial intelligence.

Guided thinking

The easiest way to make AI is also the primary direction of early game AI development, rule-oriented or hypothetical-oriented. In some simple computer games,ProgramMembers can easily convert the rules and settings in the game into individual rules, and then write them into computer programs. Let's take a role-playing game as an example. Most enterprises usually set the following attributes when setting so-called computer monsters:

Life Value, attack power, defensive power, Mana Property

The last "attribute" is one of the projects that I like to add when setting. By setting this attribute, I can set the monster to "greedy and scared", or set the warrior to "alive ". The outline in the warehouse system was born with the information we currently have:

Rule 1

If (lifecycle <10) // does the edge die?
{If (attribute = fear)
Result = trying to escape
If (there are any items or spells available to restore life)
Result = use or display related items or spells
}

Rule 2

If (you can apply an attack spell & have enough Mana)
{
Result = execute an attack spell.
}

The above series of "if-then-" rules set up to create the most basic AI. It is not of course correct to say that such a system can only establish basic AI. As long as enough and accurate rules are established, such a method still performs well.
The biggest advantage of Rule-oriented is that it is easy to learn and use. Without profound theoretical concepts, there are still a large number of user groups. Therefore, many veteran gamers often find out the enemy's attack strategy and moving method in less than two times.

Speculative thinking

I believe that all my friends who have been familiar with computer language courses or books have heard of a famous program called the word game. I personally think it is the most appropriate example to use word game as an introductory tutorial on AI. Some people may not know how to play the game. As long as either party wins the first line in the Three-character square. The rule orientation we talked about earlier can also be used here.

If there are two of us in any tier and the other tier is still blank, // will we become a tier?
Result = space
If there are two enemies on any front-line and the other one is still empty, // prevent the enemy from being on the front-line.
Result = space
If we have a child in any line & the other two cells are still blank // we can make them two.
Result = space

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.