Frozen Synapse-style asynchronous-synchronous game mechanic?

I’m trying to figure out if it would be possible to make a game where first one player moves their pieces to where they want them to be, then the other player does the same, and then they press play and both players units execute their commands in that moment.

Frozen synapse had this mechanic: Frozen Synapse - Wikipedia

I guess this would require a sprite to be moved to a location, then jump back to where it was but remember where it was put, and then go back to the same place when commanded to do so.

1 Like

Welcome to Flowlab! I think @DraftyScienceCoat75 could help you with this (they have made a chess game before iirc).

1 Like

So what you want is for player 1 actions to be recorded, then player 2 actions to be recorded.
Then both of their actions will play out at the same time, correct?

So I’ve never played Frozen Synapse before but it seems pretty doable, I’ve already done something similar with the Replay Car in Alpaca Raceway.


So what I would do is record all the actions made in a Number List, and then just get all the actions.

To make things easier I would use 2 Number Lists, one would record the X and Y position as well as the Rotation.

I would recommend setting the timer to 1.2. (So recording the position ~8 times a second. You would need to experiment with what works best for your game)

Then repeat this but for the other actions you need to record


This is how I would read the values on the Number List (The Advanced Timer bundle is by @Galactian) So now the reason I set the timer to 1.2 before is very important. Because I am reading these 3 values I need it to be timed correctly so 1.2/3 = 0.4, so that is what the time in the advanced time bundle is set to, if it is any lower it can be slightly inaccurate
(A Timer can only output ~30 times a second if it is set to the lowest value, and if it is set to 0.4 it can output 25 times a second, so if it was set to 0.3 it would try to output 33 times a second, but because it can’t it would just activate whenever possible which would make it inaccurate)

A more efficient way to do this is probably just to use a repeater set to 3 (or to however many actions you have) and activate it every time a Timer set to 1.2 goes off.
(Doing this also allows the Timer from before and this Timer to be set to a lower time, meaning the movements will be smoother because you have more recorded positions)

If the game you are making is like chess so you only have set positions you can move I would just record the position of each turn you make.


This is kinda complicated depending on your skill level (I also might have explained it bad) so if you need any more help feel free to ask, I’m always happy to help :llama:

4 Likes

Oh my god, this is an amazingly detailed answer, thank you! Very much appreciated. One thing that makes this a bit simpler is I don’t need the literal actions recorded, it’s enough to record the position the sprite has been moved to, and then have the sprite move to that position according to its own internal logic once “play” is pressed.

This is a tad ambitious for me, but I do have some background in code so I’m hoping this might be within my skill level, even though I’m usually more on the design end of things.

What I’m thinking of is a soccer game that is based around soccer position strategies, so you as the “coach” tell your players where they should run to for the next few seconds based on what you think the other team is going to do, and after both coaches have given their instructions, you see the outcome, and then you repeat from there.

2 Likes

This is as far as I got today, lots of weird emergent, somewhat inconsistent behaviors, and I need to figure out how to limit the dragging distance of each sprite at a time, and ideally the ball would bounce a bit, and and… but it’s a start.

2 Likes

One thing that’s a mystery to me is how the sprites, who are solid, still drift through the walls, which are also solid

1 Like
  1. do you want the ball to be moved by the sprites as you’re moving the players into position?

  2. In the “BtnPlayPause” object I would use a global instead of all of those messages

  3. The sprites move through walls because there is nothing stopping them, they just move to the X and Y position of the mouse. I would recommend not allowing the X and Y position of the players to not cross a specific point (via filters)

I’ll try to find some more stuff but I gtg rn

2 Likes

Ok, so to stop the ball from moving as you are setting up the players there is a behavior called “Enable” if you put input into the “False” input it will turn off all physics for the object.

To make it so the players can only move a certain distance from the starting position add this code

Then make it so the player spawns in a larger object which indicates where the player can move within that object. (This is the object that the Proximity is set to)

If you have any questions about things feel free to ask.

2 Likes
  1. In pause mode, the ball doesn’t move, but you can move the players. In a more elaborate version, players shouldn’t push each other around as you move them around, and ideally teams move without seeing how the other team has decided to move.

  2. Ohhh great, I was thinking there must be a better way of doing this, this is a bit insane :smiley:

  3. Thanks for this tip as well!

3 Likes

Some of my issues are just “wonder how I could code this”, and those feel accessible,

But then there are bugs that don’t repeat themselves consistently, like I’m not sure why the sprites will arbitrarily jump to places they’ve never been after I press the toggle, and inconsistently between themselves even though they all have the same code. (I need to learn how to use parent/child patterns on this platform) And sometimes dragging gets limited along one axis but not another. That’s my biggest headache at the moment.

1 Like

So for the jumping around, I think it’s because you are using Saves instead of Globals. Saves save the value stored in them between game sessions, while globals reset between game sessions. So I think the problem is from it having a value already stored.

Also, JR_01 has an example that I think would work well for your game. It’s pretty simple to use and really well made

3 Likes

ohhhhh this again is very good to know

3 Likes