How do I create an online room with a password ?

From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • My problem is : I want every room to have a variable called "password" .

    Anyone that tries to enter the online room will have to type the password in a text box .

    If the text typed is equal to the password of the room they are trying to get into , they will connect to the room .

    I didn't find a way to create instance variables for multiplayer rooms .

    How do i do that ?

    Thanks in advance .

  • Set the ROOM NAME to be the password. If the password (room name) is entered correctly, you join the room. Otherwise, that room name would not exist, and 'Wrong Password' shown to the user.

  • That's nice , but i would like my game to have a room list , showing all available rooms the player can join .

    If i did what you said , the players would aways know the password of the room .

    Still , it's a nice possibility i didn't even think of .

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nope. They won't. Because you're the game developer.

    You can make them see whatever you want. Like: Room1, Room2, Room3.

    If you have a lot many rooms, I suggest you use Dictionary/Array/etc to save passwords for each room.

    Programming logic will be something like this:

    if Touched Room1, Enter the password.

    If the room exist in dictionary

    Join Multiplayer Room with Room Name: Password.Get("Room1")

    Else: Wrong password

    You can even do the same by having Buttons (that says Room1, Room2) and their instance variable define the real room name (password). That should be easier if you don't want to use Dictionary, or you have less rooms. Programming will then be:

    On Touched button1, Enter the password

    if password = button1.roompass

    Join Multiplayer Room str(button1.roompass)

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