How can I create an Among Us style game?

1 favourites
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • You can download C2 or C3 addons / SDKs (realtime or chat) on this page (there is no mention for C3 but both are well embedded in C2 packages with example files): photonengine.com/sdks

    And the dedied topic on Construct forums is here: construct.net/en/forum/extending-construct-2/addons-29/plugin-photon-cloud-93112

  • among us is not peer to peer

    you can reconnect if the host leaves in the multiplayer plugin, just make sure to store the game state on each peer, when a host disconnects, connect to a room of the same name, everyone else in the game does the same, one of the players will become host, players never lost connection to the signalling server so they preserved their multiplayer ID, assign the objects to the respective players by playerID by having the player ID stored in them. If you keep player inputs the same and keep the game loop running for everyone while this is happening they might not realise it even happened.

    bottom line is photon is easier to use but has less features, worse ping, is limited to blocking websockets traffic, 16 players per room limit, and is way more expensive at 0.05$ per both Egress and Ingress GB

    for comparaison, "high tier" infrastructure like google cloud or aws go for around 0.12$ to 0.15$ for the first few Egress TB per month (ingress is free), while more budget friendly providers like vultr or digitalocean charge 0.01$ per Egress GB (ingress is free) and keep in mind that you won't be charged for most of the bandwidth since it's peer to peer.

    nodejs exports for running multiplayer game instances headless were promised with the release of construct 3 a while ago, but might not come to fruition for a long time since scirra says that there is very low adoption of the multiplayer plugin so uh here'S a project to get you started i guess drive.google.com/file/d/1FmEtzZJt_18EVaAoL5sBFS6h69xCr1OD/view

  • among us is not peer to peer

    you can reconnect if the host leaves in the multiplayer plugin, just make sure to store the game state on each peer, when a host disconnects, connect to a room of the same name, everyone else in the game does the same, one of the players will become host, players never lost connection to the signalling server so they preserved their multiplayer ID, assign the objects to the respective players by playerID by having the player ID stored in them. If you keep player inputs the same and keep the game loop running for everyone while this is happening they might not realise it even happened.

    bottom line is photon is easier to use but has less features, worse ping, is limited to blocking websockets traffic, 16 players per room limit, and is way more expensive at 0.05$ per both Egress and Ingress GB

    for comparaison, "high tier" infrastructure like google cloud or aws go for around 0.12$ to 0.15$ for the first few Egress TB per month (ingress is free), while more budget friendly providers like vultr or digitalocean charge 0.01$ per Egress GB (ingress is free) and keep in mind that you won't be charged for most of the bandwidth since it's peer to peer.

    nodejs exports for running multiplayer game instances headless were promised with the release of construct 3 a while ago, but might not come to fruition for a long time since scirra says that there is very low adoption of the multiplayer plugin so uh here'S a project to get you started i guess drive.google.com/file/d/1FmEtzZJt_18EVaAoL5sBFS6h69xCr1OD/view

    I have heard that among us is peer to peer. They have been having huge issue with cheater, and is well known that in peer to peer is easier to cheat since the host can change the stuff.

    Constructorr Do you have any suggestion on how to approach the multiplayer logic? How would you explain how to develop the events logic to someone who is already really familiar with Construct? I'm about to start working on a small project that would allow a player to move in a scenario and solve some puzzles. But I would need to implement the multiplayer at some point. Is it possible to start the project and then implement the multiplayer? or do you suggest to implement the multiplayer at the beggining?

    Thanks

  • El Constructorr: I don't know how to mention your special username.

    Sebastian Ribis Ah yeah! The space is the middle doesn't let us refer. But just figured out, this button does the job!

    Ribis First, learn how Multiplayer works, the concept, how to communicate with other players. Once you know this, it would be easy to add Multiplayer events in an existing game too. (But first, learn by making a simpler Multiplayer game from scratch, that's my advice).

    I've prepared some basic examples for you to understand how Multiplayer works. Here's a VERY minimal working example, using Photon plugin in C3, on how two players can connect, and share their names with each other:

    I presume if you read along the events, everything should be self-explanatory! Notice the first two events got you connected to a Room. (In C3 Multiplayer plugin, this alone takes you several events to do so).

    The idea in Multiplayer game development is to Send signals/messages to communicate with other players. This can be done by "Raise Event" action. Example, in Event 3 above, the player sends a message with Code 1, and has his Name as the data sent. Likewise, Event 4 triggers whenever a Code number 1 is received, if so, it would display its data!

    So if you run this on two browsers, both players will get to see each others name & Connected!

    Similarly, if one player Solves a Puzzle (for example), and you want the other player to know that, you can do this:

    If you got the idea, or understood everything I've said so far, you can continue reading. So sometimes, you need to send a LOT of data together, instead of creating many Events, you can type in the data separated by a Character. Then on receive, just decode it by splitting the data.

    For example, if Player 1 wants to send their position (X,Y) every tick, they can Raise Event like this:

    Notice, the # symbol is used as a separator (you can use a comma, or anything). This is how Player 2 would decode it and set Player 1's position on his screen:

    The 0 and 1 above is the index. 0 to fetch the first portion of the data separated by "#", and so on.

    Anyway! That's all from me.

    All of that I just explained is not just to get you started, but it's literally everything you need to know to make a complete Multiplayer game! (Of course, there are more features, some really handy events and actions you must look into when exploring Photon).

    Hope this helps!

  • El Constructorr Thank you very much for your example!

    I don't quite understand the concept of the rooms (I'm seeing on the event "Join Room").

    Who keep tracks of the rooms available? Like in among us, you can make a room and then the other player can join the room. I already worked with database, and I could make a lobby using php and mysql. But does Photon has its own database/system?

    About the logic of the game, basically, when you make a multiplayer game you must send the data to tell other players where the other player x,y is. I was thinking that the plugin would handle it automatically, but I guess I was wrong.

    For instance, if you move the player using a,w,s,d, for each button you would send an input to everyone saying "playerX send A to everyone", and the other client would move the playerX to the left because if there is an event saying "on event 12" if player ID = Photon.EventData,0 then simulate platform control A.

    However, the platform behavior and the movement can change depending on the framerate of the client right? That's why sending the x,y would be better, however, sending the x,y would take much more bits to send.

    May I contact you on Discord? In this forum is not possible to send PMs for some reasons.

    Thanks again!

  • El Constructorr Thank you very much for your example!

    I don't quite understand the concept of the rooms (I'm seeing on the event "Join Room").

    Who keep tracks of the rooms available? Like in among us, you can make a room and then the other player can join the room. I already worked with database, and I could make a lobby using php and mysql. But does Photon has its own database/system?

    About the logic of the game, basically, when you make a multiplayer game you must send the data to tell other players where the other player x,y is. I was thinking that the plugin would handle it automatically, but I guess I was wrong.

    For instance, if you move the player using a,w,s,d, for each button you would send an input to everyone saying "playerX send A to everyone", and the other client would move the playerX to the left because if there is an event saying "on event 12" if player ID = Photon.EventData,0 then simulate platform control A.

    However, the platform behavior and the movement can change depending on the framerate of the client right? That's why sending the x,y would be better, however, sending the x,y would take much more bits to send.

    May I contact you on Discord? In this forum is not possible to send PMs for some reasons.

    Thanks again!

    Don't get me wrong but you can also discuss here,

    I mean, I am also learning side by side ☺️

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ribis The concept of Room is exactly same as you described, in Among Us. So one person can Create a Room, set settings like: Set max players, allow re-join, etc. And other players can join until the room is full.

    Photon manages all the Rooms, and even the Lobby system. Also, it has an option to set userID's as "Friends" so you could find Friends online, etc. But I didn't quite explore the Lobby/Friends system as I use Firebase myself to handle User data etc.

    It also has an option for sqlLobby, again, I'm not sure what that is, maybe you'll understand it better.

    Here's a portion of Events and Actions of Photon plugin, which should give you a good idea on what all you can do with it:

    Oh and I agree, you must avoid sending 'inputs' to manage positions, because, as you said, there are a number of factors that can affect the 'actual' position of the sprite (e.g. framerate differences in collisions, temporary lag, etc). Unless it's a Sliding Puzzle game where nothing can go wrong, it's advisable to use sync exact absolute positions X,Y. It's not really much of data if you think about it. You're sending all in one event. You can look into BinaryData as well to make a large game more memory efficient.

    Anyway, this should give you enough information to get started and begin exploring yourself! that's how you'll fill the missing pieces on things that you still don't understand. Start with something simple. Good luck!

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