How to create artificial intelligent for monopoly game?

0 favourites
  • 11 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • How to create artificial intelligent for monopoly game?

    Such as when to buy, sell, making decisions...

    Is it difficult?

    Do you know any tutorial about this?

    I've learned simple AI like in platform game...but I think here is a bit different.

  • Unfortunately, you aren't going to find a tutorial for every single thing you want to do. What you need to do is, read and build many small simple games that add to your understanding of AI until you can design the system your self. A true Monopoly opponent AI is a complex system to design. Something that, in my opinion, would need a much better understanding of AI than just [quote:138fj3r4]simple AI like in platform game.

    I know it is tempting to try and rush ahead to push your skills but, it is more detrimental than beneficial to skip the process of learning how to design your game. By design I mean, writing a document that describes exactly how your game will react/interact before even booting up your computer. Counting on tutorials to give you each piece of what you need will make you a worse game developer.

    Before beginning any game project, you should create a design document. This document should explain all the rules of the game and how each object will interact. It should also include some information on the style and scope of the project. Next, break down the things you need the AI to do. Take out a piece of paper and think of all the things the player must do on their turn and all the things they can do if they choose.

    Must do items, such as rolling the dice, are easy. Here is a simplified breakdown:

    Must Do

    Roll Dice

    Move number on dice

    If number rolled is a double: roll again

    If landed on Go To Jail: go to jail

    If landed on Chance/Community Choice: draw Chance/Community Choice Card

    If landed on Property owned by other player: pay player rent value

    etc...

    Optional Items are where the actual AI comes into play:

    Optional

    If in jail: decide whether or not to pay to get out of jail (must take in account if a get out of jail free card is held or money available to the AI player including money from mortgaging)

    If on unowned property: decide whether or not to buy property (must take in account money available to the AI player including money from mortgaging)

    If property auctioned: decide whether or not to bid (must take in account money available to the AI player including money from mortgaging)

    During turn, decide if a trade will take place and with whom (must be able to offer an appropriate trade that would benefit the AI but would possibly be accepted by the other player)

    If offered a bid: accept/reject (must be ale to decide if the trade would be beneficial to the AI)

    etc...

    Of course this isn't everything you will need to have on your list, just a simplified list. After you write the list, it is up to you to decide how to simulate these choices in the code. Because Construct 2 works on an event system, it would be best to write your list in an event/action style similar to how I did above, [quote:138fj3r4]If landed on Go To Jail: go to jail

    After you have completed your design document, you should build the entire game, minus the AI. Get all the rules working properly. Ensure that the game is built fair and balanced. Make sure the players have access to all the features of the game and that they cannot do anything that would not be allowed in the real board game. If you can get the entire game working 100% as a multiplayer game, then and only then should you start trying to implement AI opponents.

    Finally, you will add in the AI. On each turn the AI must define which step above takes priority, then include some amount of randomness so the player doesn't just know exactly what the AI will do.

    This post isn't to discourage you from making your game. It is meant to encourage you instead to slow down and take some time learning more before attempting something on this scope. some of the best game designers in the industry suggest all new game designers build clones of the old classics long before attempting more modern games.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So.. basically AI is a complex "if" which considering a lot of thing into account, weighing things?

    And a good natural AI probably going to be like a root of tree which going to be very deep?

  • ekajuan

    It seems you kind of missed the point. I used the word "If" in places where something might happen but has a chance not to:

    [quote:12zvvbrp]If number rolled is a double: roll again

    This isn't to mean the AI event system will be like a giant embedded/branching If statement, although it could be modeled that way. It was just to show the events may or may not take place. The entire original post was more to explain the steps of evaluating the actions ON PAPER so you have a guide of what decisions the AI will have to make.

    Personally I think using a State Machine is easier than a giant if statement for this type of system. However, to use a State Machine, you would have to know what it is and how it works. A State Machine would store what state the AI player is in and have certain valid next state conditions that the AI could choose.

    For Example:

    AI player turn Starts

    State:

    Has not rolled yet

    Exit Conditions:

    Roll Dice

    Offer Trade

    AI Chooses to Trade - New State

    In Trade

    Exit Conditions:

    Complete Trade

    Trade Completed - New State

    Has not rolled yet

    Exit Conditions:

    Roll Dice

    Offer Trade

    AI Chooses to Roll Dice - New State

    Rolling Dice

    Exit Conditions:

    Dice Rolled

    Dice Rolled - New State

    Moving

    Exit Conditions:

    Finished Move

    AI Finished Move - New State

    Has rolled

    Exit Conditions

    Offer Trade

    End Turn

    Notice the AI can return to certain states. The AI is in the "Has not rolled yet" state after each trade and before the dice have been rolled but cannot re-enter that state after the dice have been rolled.

    Again, a State Machine is another advanced system that it will take some time to learn if you have never dealt with one before. I again would like to encourage you to get more experience designing clones of games like Tetris, Galaga and Pac-man to build your skills as a game designer before you dive into an AI system like this.

  • AI as a real thing doesn't really exist, especially not in games. what you see there is scripted behaviour. loads of IFs - scripted behaviour - you can learn by time what pc does and beat it everytime.

    there's a possibility of adding fuzziness (check fuzzy logic) - where PC could choose sometimes differently then what was anticipated.

    the "realest" AI would be neural networking (which you can't really use in C2) - when you got loads of neurons which have their weight and neural links coeficients which multiply and choose the results - therefore loads of possibilities and different reactions + learning - you can update those coef. and weights - making a neural network work better, make pc learn what you do. but this one is a complex model which isn't really yet used on any game (at least i think).

    so mostly what you can do is a expert system - check bayes networks or fuzzy logic or just make a loads of ifs where some of them execute if random (0.100) ends up under some X that you put, or random that ends up < random (0,100) etc.. there's loads of possibilities

  • Okay... Thank you all for your time and inputs, now I have a clue to where to go...

  • For monopoly decisions for a big part are influences by:

    • which turn it is (early turns -> some fields like the public transportation have higher priority, you tend to save up a bit of money towards the end of the course, so that you could buy more expensive streets, but not always... stuff like this)
    • which streets the AI owns (trying to complete a series, if possible)
    • which streets enemies own (if enemy has a street of the series already you have the choice of either sabotaging by buying it or leaving it, because you can't make a profit out of it; which you chose kinda also depends on the money and board influence you have and how well situated the enemy is)
    • total money available / board influence
    • small influence: where players on the field could roll in the next 1-2 turns (short term profit)

    You can probably formulate a rough estimation on the value of a move / estimated profit in midterm - so to say put a number on it. And then chose the better alternative most of the times, or all of the times depending on difficulty and numerical difference between the choices.

    Giving the AI clues when to sell/try to buy streets is probably the hardest to do, because that's side stuff where negotiation with the player can come in...

  • ekajuan I am not that sure but, Rexrainbow has something try his site

  • I found this site by searching for AI monopoly. I have been working on an AI Monopoly game for a while. I started with AI players. I have 100 players. Each player has different values (DNA) or weighting for different variables. Some variables are: the value of a property, the value of a monopoly, the landing count of a property, how much minimum cash should I have, what is the total income of each player, does anyone else have a monopoly, how often do I bid for a property. etc, etc. Each game has from 4-8 players and each player plays 100 games to make a generation. At the end of a generation the players are ranked and the bottom 10 are replaced by slightly different (random) variations of the top 10 players, Except the worst player. It is replaced by a totally random generation of DNA. This allows for a black swan to enter the players. The program runs in two modes. Human players or no humans. With a human player I can play against a random selection of AI players. Aggressive AI players tend to win more than wimpy players. (Duh!. I'll buy Tennesse for a dollar. Wimpy says OK.)

    With no humans it pits AI players against each other to get to 100 games per player and a new generation. In no human mode it plays 7 games per second. As of now, It has played 1200 generations. Some AI players have been around for over 700 generations. I am still tweeking the program. BTW: Landing counts are based on games it has played. More real world then mathematical calculations. Computer random number generators are not 100% random.

  • For anyone interested, we have recently finished developing AI for Monopoly trained with Machine Learning.

    Quadropoly

    This is a AlphaGo / Deep Blue style project, but for Monopoly. For the first 16 months, AI was trained by playing against each other (4 player's games). Currently, full logs from games with top level AI are uploaded to the cloud for Machine Learning, so every good player ( >25% winrate) is helping to make AI better. AI has already invented several dozen effective strategies which has never been used before by humans. Less than 1% of players are having 25% winrate or higher playing with 3 AIs on top level difficulty. Game has no cheats in any form, AI does not know whether they trade with human or another AI, and treats every opponent equally on all difficulty settings. Game is 100% free for anyone with Android device, feel free to check it out.

    If you would like to know more:

    Website: quadropoly.com.au

    PlayStore: play.google.com/store/apps/details?id=au.com.quadropoly.quadropoly

    Get in touch:

  • I started a project for this kind of thing. So far you have to enter properties, money, etc. manually and the layout is weird, but I'm still working on it. Where I started, is with an AI for determining the value of a property based on original cost and how many of the color-group the person owns. From there I mad a 'barter bot' that adds up the properties and money you're trading and determine who comes out on top in a deal.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)