InDWrekt's Recent Forum Activity

  • It has already been stated that Scirra plans to include a discount to upgrade from C2 to C3 but it will still have a cost. See this reference from a blog post by Ashley.

    https://www.scirra.com/blog/155/the-future-of-construct

    [quote:1nmgbr0v]Construct 3 is likely a long way off, and upon its release we plan to have a great upgrade deal for existing Construct 2 users. Further, we are confident Construct 3 will be able to import Construct 2 projects, allowing you to easily transition over.

  • When you say "dice roll," I am guessing you mean you want the computer to choose a random value. Take a look in the manual at the random() system expression:

    https://www.scirra.com/manual/126/system-expressions

    Since random returns a float (or floating point number), the return will be a decimal. You will want to get the integer value from it.

    Something like this would get what you want:

    int(random(1,111))

    *note: random returns the a number below the high value so to get 110, the high needs to be 111.

  • 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.

  • You do not have permission to view this post

  • 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.

  • On the right hand side of the screen, there is a folder under projects that is the base of your project. If you select that, the properties panel on the left will show an option called "Window Size."

    You can also get these same properties to show by clicking the view link on the left side of the screen next to where it reads "Project Properties."

  • davidross900

    If you change MaximumSpawnTime to 4.5 instead of 5 your resulting spawn speed will be every 0.5 seconds (5 -spawnTime = 0.5 where spawnTime = 4.5). Just takes a little basic algebra.

    I hope that helps and good luck with your project.

    [Edit] just to be clear, you would change your Set spawnTime method to:

    spawnTime = min(spawnTime + 1, 4.5)

  • davidross900

    Yes, that is correct. What you have in the image above will stop the variable SpawnTime from being set higher than 5. In your spawn event, you should see objects spawn between than 0 to 3 seconds at the fastest.

  • It looks like you might be going with Tyler's method but, to answer your question:

    [quote:33afw4ed]interesting, i never knew about this function before. How should i code it?

    /b]

    You code it exactly as I typed it:

    [quote:33afw4ed]min(spawnTime + rateChange, maximumSpawnTime)

    Replace rateChange with the amount you want to change the variable with. In your picture you are just adding 1 so, replace rateChange in the above with 1. Replace maximumSpawnTime with the maximum you want the spawnTime to be. If you don't want the spawnTime to be higher than 5, replace maximumSpawnTime with 5. Other than that, you can copy and past this equation directly into where you are setting the variable. Again, use the "Set Variable" method, not the "Add To" variable method.

    I hope that clears things up for you and good luck with your project.

  • Construct has a function called min(). It takes a list of variables and returns the one that is the lowest. When you set your spawn rate value, instead using the "Add To" action, set it using the min() function. You will wind up with something like this:

    spawnTime = min(spawnTime + rateChange, maximumSpawnTime)

    spawnTime : is the current spawn rate

    rateChange: is the value you will change spawnTime by each time it changes

    maximumSpawnTime: is the highest value you want spawnTime to be set to

    Using this method, your spawn rate will never be faster than what you set as the maximum.

  • Web browsers don't have a way to process calls on exit. However, to use a proper log in system, all you need to do, is create a session variable on start of the program and set it on the server side. Each time the client tries to communicate to the server, it compares the local variable with that on the server and, if they are different, then the user is logged out. A simple way to implement this is just to use the time stamp of when the game first connected.

    The events would go something like this:

    On start of game: set local session variable to empty

    If local session variable is empty: User signs in and the session variable is set to current time stamp

    If local session variable != server session variable: User signs in and the session variable is set to current time stamp

    If client fails to get a response from the server: set session variable to empty

    If client can contact server and local session variable = server session variable: client is logged in

    This is only one way to handle disconnecting a client. Of course, I would supplement this with a time out so if the client had not transmitted to the server after say 5 minutes, the client would have to sign back in.

    If you haven't yet, you should read up on web page security for sign in pages using session variables.

  • Take a look at this:

    https://www.scirra.com/tutorials/723/us ... t-in-loops

    The wait only stops the follow path event. The loop continues processing the next iteration immediately.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
InDWrekt's avatar

InDWrekt

Member since 19 Sep, 2011

Twitter
InDWrekt has 7 followers

Trophy Case

  • 13-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies