How i can make an local play system?

hello developers!

Goal: make a local play system

I recently started thinking about a 2D game project. one of my ideas was to make a local game system where two people on the same computer could play together but 1- is this possible? one thing that worries me is the character of the player as a player would need two characters a bit difficult to do 2- how could i do it? I really have no idea what the system would be like 3- would it be possible to establish four local players in two diferent devices?

Any idea?

Hey CavaleiroDev,

I have some ideas related to your questions:

  1. I think having local multi-player is certainly possible, but you’ll likely need to do some customization in terms of character controls and the characters themselves.

  2. One possible solution is to create to custom characters for each local player. I believe there are (at a minimum) some free model Ai NPC’s that have animation scripts and such in them already. You could just indicate the players’ controls to control those Ai. You might be able to just copy your player’s scripts when you do a solo test in studio if that’s an option. (You could make those custom characters either client or server side, depending on if you have security concerns with the game. For security, you generally want to use the server. But since it sounds like the whole game is local and performance may be important, you could make it entirely client side.) — In terms of controls, each player needs their own controls. I believe the UserInputService processes requests from any input it gets, regardless of the device pressing it. I believe you can get keyboard, touch screen, and controller input all at the same time for example. So, you can either pre-determine (or better yet let the players choose) which controls they want for a player.

  3. By 2 devices, if you mean a controller and a keyboard using different input mappings, then yes. As I mentioned above, you can have a keyboard and controller input separate. Or, you can have two (or more!) keyboards, with each player using non-overlapping key bindings for your game. — If you mean two different devices, such as 2 phones or 2 computers, then no, because then you would have to use the server to replicate the changes from one client to another, etc.

Hope this helped!

2 Likes

Thank you very much for your ideas! I studied UserImputService and found that it is possible to have up to 8 local devices. I’m going to start working on a local game demo and I’ll be back with more information soon.

That’s great! I’m happy to help with any additional questions or ideas that may arise. Happy developing!

1 Like