Gvgai Framework Construction

Source: Internet
Author: User

Home in this: http://gvgai.net

References in this: http://gvgai.net/papers.php

The Gvgai framework is a game framework that interprets the rules of the game (a text file) and then translates it into a game. But it's mostly used to test AI.

Game rules such as:

This is a complete definition of the game definition we can query in the reference vedio game Description Language (VGDL) document, but we do not need to know so much, because we mainly do is AI.

Steps to build a platform:

1.

Download the source code first

2.

Then eclipse loads into the ant project

3.

Modify the Basedir directory in the Build.xml to point to the root directory of the code (if you choose the option of link when loading, it does not seem to be modified).

can also be modified in the base directory

Write run on the arguments. You can run it. Or tick the run option in target. These are small things. Once you've set up your catalog, you're ready to run the game.

Code section:

Noun Explanation: Avatar----Avatar, is the protagonist of the game we want to control.    Agent----is the AI we do.   NPC----are game characters. Controller----are our controllers, namely AI.

We say that do the controller and agent are to do AI means, because the agent is also used to control the computer.

Any agent must overload the following two functions, and we can see that one is a constructor, one is act, and that is what action is performed. The parameters are Stateobs and Elapsetimer. One is game state, one is how long the game has been running.

    • Public agents (stateobservation So, Elapsedcputimer Elapsedtimer): The constructor of theclass.
    • Public Types.actions Act (stateobservation stateobs, Elapsedcputimer elapsedtimer): Thefunction called every Game Cycle to retrieve

In fact, according to the current game state to return to perform the action, and our people play is the same, the human game is also a response mechanism: from the current, historical, future predictions, game information to determine how to respond, said here is very clear.

The good news is that the framework itself implements a lot of convenient and fast APIs for us.

Http://gvgai.net/forwardModel.php has a well-implemented API here.

Advance is predicting the next game state. We can also predict for ourselves ...

Sample

This is the simplest random controller.

First step: Get legal action

Step two: Randomly select one from the legal action

Part III: Return to this legal action

A second sample--genetic:

Generates a sequence of actions, constantly using the advance function to predict the next state, and then to score. Because it is the state of prediction, it is not guaranteed to be correct, so each prediction of a state, the weight of the score value will become the original 90%. Then through the basic screening of high-quality sequence, replace the inferior sequence, then the random mutation, get a good sequence of action, return to the first action. It's almost like a search tree, actually.

The rest of the site is available, read the instructions on it.

Gvgai Framework Construction

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.