Jump to content


Photo

Max player for LAN i want 2.


  • Please log in to reply
5 replies to this topic

#1 grossik

grossik

    GMC Member

  • GMC Member
  • 22 posts
  • Version:GM:Studio

Posted 28 March 2016 - 01:58 PM

I want to the maximal number of players be two and a server distinguish player one and player two.

I do not know how to do it. Please help.  :(

 

Code is demo: LAN_Platformer


Edited by grossik, 28 March 2016 - 02:41 PM.

  • 0

#2 Dufner

Dufner

    GMC Member

  • GMC Member
  • 41 posts
  • Version:GM:Studio

Posted 28 March 2016 - 06:35 PM

If a socket connects you have the id from a client and your host can send that id back to the socket. If your id is larger than 2 you just disconnect from the host.


If you use an extra server you let players only connect if the current amount of players is under 2 if not you destroy the connection to the player.
  • 0

#3 grossik

grossik

    GMC Member

  • GMC Member
  • 22 posts
  • Version:GM:Studio

Posted 28 March 2016 - 07:23 PM

If a socket connects you have the id from a client and your host can send that id back to the socket. If your id is larger than 2 you just disconnect from the host.


If you use an extra server you let players only connect if the current amount of players is under 2 if not you destroy the connection to the player.

Can you help me more? I am a beginner in Game Maker.


  • 0

#4 Dufner

Dufner

    GMC Member

  • GMC Member
  • 41 posts
  • Version:GM:Studio

Posted 28 March 2016 - 09:24 PM

Sure, but I recommend an other tutorial if you are a beginner. LAN_Platformer is more complicated programmed as you need for a multiplayer game.
 
 
Sorry it's a lot easier than I thought, if I'm right in the old days you made it this way:
Just if you are interested for knowledge ;)

Spoiler

 
So you only have to define max_clients as 2 in the create server function and the server allows only 2 connections

network_create_server(type,port,max_clients)

Edited by Dufner, 28 March 2016 - 09:27 PM.

  • 0

#5 grossik

grossik

    GMC Member

  • GMC Member
  • 22 posts
  • Version:GM:Studio

Posted 28 March 2016 - 09:43 PM

 

Sure, but I recommend an other tutorial if you are a beginner. LAN_Platformer is more complicated programmed as you need for a multiplayer game.
 
 
Sorry it's a lot easier than I thought, if I'm right in the old days you made it this way:
Just if you are interested for knowledge ;)

Spoiler

 
So you only have to define max_clients as 2 in the create server function and the server allows only 2 connections

network_create_server(type,port,max_clients)

So I delete LAN_Platformer and make my lan multiplayer?


  • 0

#6 Dufner

Dufner

    GMC Member

  • GMC Member
  • 41 posts
  • Version:GM:Studio

Posted 28 March 2016 - 11:38 PM

I would do it. I am currently working on a multiplayer game too and did everything by myself so you know what you did (mostly xD) and have "full controll".

I recommend that tutorial https://www.youtube....h?v=MbUsHVak_yA


Edited by Dufner, 28 March 2016 - 11:38 PM.

  • 0