0 Favourites

How do I set up a turn based game

  • Hi, new to the forums, so new in fact that this is my first post, I'm kinda new to construct 2 as well but I have confidence in my abilities, I've made a few basic games that can be found on my itch.io page.

    So I've been working on a game with a small team, which brings me to my point, the game we're building is a remake of an old game called M.U.L.E, which, as some of you may know, was recently (ish) remade and released as M.U.L.E Returns, our version is based around our hometown and is being built to teach people about the many events that happen in Hastings throughout the year, the problem we have, is that I'm the main programmer for the team and I have no experience with building turn based games, so my question is this, how do I program a turn based game with 4 players each having their own turn, 3 of the 4 are NPC's and will need to be programmed to play the game well enough to make it challenging enough to keep the player engaged, but that's a different problem for a later stage, what i need now is help understanding how turns work and how to make them happen.

    Any help will be greatly appreciated, and credited too.

  • Basically the main thing is simply to make sure that things only happen for a given player or AI at a given time. Which sounds logic obviously

    What you can do to control it is simply to make a Variable that keeping track of who's turn it is and make sure that its a condition all the places where its needed. When that player / AI is done you just change the variable to the next turn and so forth.

    Using lots of Functions would be a good idea (in general its a good idea) But what they allow you to do, is to call the function with different variables. In which the Variable that keeps track of who's turn it is could be one of them. That way you can reuse pretty much all the code for both player and all the AIs, if they are suppose to be the same.

    There ain't really a huge difference besides the above mentioned when it comes to a turn based game and a non turn based. Even in real time games things happens in turns, they are just so fast that you don't really notice it.

    Meaning all units in a real time game doesn't reacted at the same time, they simply appears to.

  • Here is a post from FAQ that can be useful:

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Basically the main thing is simply to make sure that things only happen for a given player or AI at a given time. Which sounds logic obviously

    What you can do to control it is simply to make a Variable that keeping track of who's turn it is and make sure that its a condition all the places where its needed. When that player / AI is done you just change the variable to the next turn and so forth.

    Using lots of Functions would be a good idea (in general its a good idea) But what they allow you to do, is to call the function with different variables. In which the Variable that keeps track of who's turn it is could be one of them. That way you can reuse pretty much all the code for both player and all the AIs, if they are suppose to be the same.

    There ain't really a huge difference besides the above mentioned when it comes to a turn based game and a non turn based. Even in real time games things happens in turns, they are just so fast that you don't really notice it.

    Meaning all units in a real time game doesn't reacted at the same time, they simply appears to.

    Thank you, now you've explained it I can't believe I hadn't worked it out yet, I use plenty of functions already, but I don't often make use of the variables, gonna go into the project and start working again now, thank you for this explanation my dude.

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