Turn-based Sequences

0 favourites
  • 9 posts
From the Asset Store
A well commented RPG game template to learn from or use as a base for your own game!
  • How would I create a turn which loops between Player A & B.

    I was thinkin around the lines of this pseudocode

    ---LOOP---

    1 StartStep PlayerA

    2 PlayStep PlayerA

    3 AttackStep PlayerA

    4 EndStep PlayerA

    5 StartStep PlayerB

    6 PlayStep PlayerB

    7 AttackStep PlayerB

    8 EndStep PlayerB

    ---LOOP---

    Loop these events until winner.

    I wouldnt know how to go about this in Construct 2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Basically a finite state machine.

    A bunch of conditions like this:

    + GameState == "StartStep PlayerA"

    do stuff required for this step

    if done then GameState = PlayStep PlayerA

    + GameState == "PlayStep PlayerA"

    do stuff required for this step

    if done then GameState = AttackStep PlayerA

    and so on. Basically you have a global variable that holds the current state and a bunch of conditions for each of states. While a state is true, that stage is executed, until it is done, at which point the state is changed to the next stage.

    At the last stage, you point back to the first stage.

  • Cool.

    So in my Event Sheet, currently I have Groups for each action that players will be doing: Restore, Retreat, DrawCard, Pass, PlayCard, RevealCard, and so on...

    In your explained 'State', that become true, I would activate the Groups according to what Actions can be done at the time during that State.

    Aka a basic FSM Model for turn-based sequences?

    How would I make it PlayerB's turn?

  • At end of PlayerA's turn you set state to start of PlayerB's turn.

    Try with a simple, dumbed-down prototype, until you figure the most convenient way out!

  • Got It. This leads right into this question though and then i can get things rollin. How should I have Card Objects?

  • Basically a finite state machine.

    A bunch of conditions like this:

    + GameState == "StartStep PlayerA"

    > do stuff required for this step

    > if done then GameState = PlayStep PlayerA

    + GameState == "PlayStep PlayerA"

    > do stuff required for this step

    > if done then GameState = AttackStep PlayerA

    Would GameStates be Groups with conditions and actions in them?

  • Sure, you just disable and enable groups as needed.

  • Sorry to dig up an old post, but i've been searching and reading through many posts and really need help with my domino game.

    My FSM works via:

    +Group 1 = Active

    loop for domino

    > if domino found - play it

    > if not domino - set group 2 active

    +Group 2 = Active

    loop for domino

    >> if domino found - play it

    >> if not domino - set group 3 active

    etc.....

    My AI:

    +Every Tick

    + Turn not=1

    Set group 1 active

    Notes: all groups are deactivated on start and deactivated before going to another group.

    My problem is adding a delay. My game has 4 players (3 cpu). I want a cpu to play then after a few secs I want the other cpu to play, until its the user's turn.

    Currently, after the user plays, all 3 cpu players play instantaneously.

    I've tried C2's 'wait action' and that gave me horrors... <img src="smileys/smiley19.gif" border="0" align="middle" />

    I gave up for a couple months, now i'm back to hopefully get my game completed

  • After many months and no sleep last nite I finally got the dam 'wait' ting working.... <img src="smileys/smiley14.gif" border="0" align="middle" />

    I had to mix my fsm methods. I was using groups for everything (set active, set deactive), which didnt work with the wait action. So I changed only my cpu AI to use a status variable as Mipey mentioned, and (the needed part) set the status to 'wait' during the wait , lol <img src="smileys/smiley17.gif" border="0" align="middle" />

    +After each play - set status to 'wait'

    +(group WAIT) if status='wait'

    wait 5 seconds

    set status to 'AI'

    +(group AI) if status='AI'

    do stuff

    set status to 'AI-2'

    +(group AI-2) if status='AI-2'

    do stuff

    set status to 'AI-3'

    ....etc

    I'm not sure why (setting wait group active, then wait 5 secs, then deactivate wait group, then set AI group active) didn't work for me.

    Unfinished, but you can take a look here:

    Click 'Play' on the intro, then 'Ok' for name, then click 'Deal'.

    The game will auto-pose unless you have 6:6 and when it is your play it will put the domino you click on the correct location.

    chezral.6te.net/Domino/index.html%C2%A0%C2%A0%C2%A0%3Cimg src="smileys/smiley17.gif" border="0" align="middle" />

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