Multiplayer games with two different screens

Ok so a ton of people, including me, have said that this is not possible… and we were wrong. The main issue with this is that you need to actually share and play the multiplayer game to test it, as it doesn’t work in the multiplayer sim view, only when actually hosted and played.

Basically, I looked at the multiplayer code for like 5 minutes, saw a special little function that I thought might do what I want, and then it did! I will be making more stuff with/about this in the future, but I really wanted to get this out there so that my fellow javaScript devs could mess around and find more stuff with this (I’m lazy and finals are happening so other people will have more time than I have to test this out)

The only limitation is that only the host screen can be different. All other screens look the same, so something like 4 player Uno would unfortunately not be possible… unless some other method is found, who knows, but I really doubt it.

Here are some ideas I had for games that are possible to build now:

  • Two player board games where there is hidden information such as Battle Ship and Guess Who
  • Chess, checkers, tic tac toe, etc where each view is the correct one for the person playing
  • Uno, Scrabble, Dominos, and a TON of card games (all these would only be 2 player only unfortunately)
  • Classic .io games but just 2 player
  • Co-op puzzle/survival games like MineCraft, Portal multiplayer, Ibb and Obb

If you guys have more ideas, please share them below! I haven’t decided what I’m going to make first yet… lets be real I’ll probably make an extension first, but still I really want to make games too!

12 Likes

DUDE WE CAN MAKE POKEMON!!!

2 Likes

very nice! 2 player games already opens up so much, I could really see a vampire survivors clone like my own Robot Survival with this

4 Likes

holy namespace userconfig { export const ARCADE_SCREEN_WIDTH = ; export const ARCADE_SCREEN_HEIGHT = ;} this is awesome, so many new things can be made with this

4 Likes

@richard I’m guessing that the reason this doesn’t work in the simulator is that the sim assumes all the screens will be the same and just copies the host screen. I’m wondering how performance draining it would be to have them work like the shared versions, where the 3 other screens work with a fake “server” behind the scenes.

2 Likes

Can u make it an extension were there are blocks like “show (variable) on X player?” and stuff like that?

1 Like

No, as only the host screen can be different. The way multiplayer works is that, after the host’s screen renders, it runs the code postImage(screen), which sends the whole rendered screen to all the other connected players. Obviously this is a simplification, but it does mean that all the other players all see the same screen and cannot be addressed individually.

2 Likes

I like the idea of 1v3 games.
The host has their own screen while the other 3 players have to share one.

4 Likes

uh… tbh the reason i never mentioned this was because i did not know that this was possible (i didn’t work on the online multiplayer stuff)

@WoofWoof feel free to make an extension but i’m gonna make one too

5 Likes

we’ll do this on stream today

6 Likes

Oh I am SO looking forward to this! I’m shutting my office door today so that I can watch this live.

3 Likes

Well that makes my job easier. If you can, try to locate and destroy the frame handler that is created in the initServer function, as that could lead to the host’s screen being momentarily flashed on the screens of the other players if a lag spike occurs or the frame order gets messed up somehow. I haven’t seen this happen, but I haven’t tested creating particularly laggy functions that would occur between the default postImage() call and the one we are sending to replace that screen afterwards.

It would also stop the host from sending literally double the needed information over a potentially laggy internet connection, as well as taking double the necessary resources on whatever server is stuck in between the host and the other players.

1 Like