How to create artificial intelligent for monopoly game?

Get help using Construct 2

Post » Thu Mar 26, 2015 12:31 pm

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.
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Thu Mar 26, 2015 4:45 pm

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
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,
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.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Fri Mar 27, 2015 5:44 pm

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?
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Fri Mar 27, 2015 6:49 pm

@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:
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.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Fri Mar 27, 2015 11:28 pm

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 :)
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
39
S
14
G
12
Posts: 617
Reputation: 9,297

Post » Sat Mar 28, 2015 7:35 am

Okay... Thank you all for your time and inputs, now I have a clue to where to go...
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Sat Mar 28, 2015 9:36 am

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...
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Sat Mar 28, 2015 11:05 am

ekajuan I am not that sure but, Rexrainbow has something try his site
B
239
S
37
G
15
Posts: 1,922
Reputation: 39,744

Post » Tue Jan 24, 2017 10:37 pm

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.
B
1
Posts: 1
Reputation: 127


Return to How do I....?

Who is online

Users browsing this forum: DivineVoider, Google [Bot], odiusfly, Snowmany and 2 guests