Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualsimpler

Posted 21 November 2012 - 11:19 AM

I just recently started working on my next project which will be multiplayer exclusively with support for up to 8 players. It's really important that the clients are synced since avoiding projectiles and having good micro will be a key part in the game.

I got some questions regarding the networking architecture on a game like this. I'm going to use RakNet and I'm pretty sure I will use a client-server approach. I got two different methods I'm considiring

Method 1
  • The only task the server has is to inform all clients when a client does something. The server don't have any World class, it just forwards the events to the client and let them update their own World.
  • A client right clicks on the map to add a target to move to. The client then sends a package to the server containing the event id, client id and the target position. The server then only sends the package to all connected clients and let them handle it.
The bandwidth usage will be very low since packages only gets sent on user input. I do however think that the clients very easily will get out of sync, and there's nothing that will make them synced again.

Method 2
  • The server contains a World class that gets updated when clients perform actions. This World then gets broadcasted to all clients frequently (how often?) and the clients then set the objects positions so they are the same as the servers.
  • A client right clicks on the map to add a target to move to. It sends the event to the server who then updates it's World. The server does nothing more in this stage, the changes will get broadcasted to all clients in X ms.
I'm not sure how often this broadcast will happen but it will definitly be more bandwidth heavy than method 1. This method does however make sure that the clients are synced.

This is just what I came up with after 1 day of researching and I would love if you could share things I should think about and general suggestion. How would you do something like this?

#4simpler

Posted 21 November 2012 - 11:19 AM

I just recently started working on my next project which will be multiplayer exclusively with support for up to 8 players. It's really important that the clients are synced since avoiding projectiles and having good micro will be a key part in the game.

I got some questions regarding the networking architecture on a game like this. I'm going to use RakNet and I'm pretty sure I will use a client-server approach. I got two different methods I'm considiring

Method 1
  • The only task the server has is to inform all clients when a client does something. The server don't have any World class, it just forwards the events to the client and let them update their own World.
  • A client right clicks on the map to add a target to move to. The client then sends a package to the server containing the event id, client id and the target position. The server then only sends the package to all connected clients and let them handle it.
The bandwidth usage will be very low since packages only gets sent on user input. I do however think that the clients very easily will get out of sync, and there's nothing that will make them synced again.

Method 2
  • The server contains a World class that gets updated when clients perform actions. This World then gets broadcasted to all clients frequently (how often?) and the clients then set the objects positions so they are the same as the servers.
  • A client right clicks on the map to add a target to move to. It sends the event to the server who then updates it's World. The server does nothing more in this stage, the changes will get broadcasted to all clients in X ms.
I'm not sure how often this broadcast will happen but it will definitly be more bandwidth heavy than method 1. This method does however make sure that the clients are synced.

This is just what I came up with after 1 day of researching and I would love if you could share things I should think about and general suggestion. How would you do something like this?

#3simpler

Posted 21 November 2012 - 11:18 AM

I just recently started working on my next project which will be multiplayer exclusively with support for up to 8 players. It's really important that the clients are synced since avoiding projectiles and having good micro is a key part in the game.

I got some questions regarding the networking architecture on a game like this. I'm going to use RakNet and I'm pretty sure I will use a client-server approach. I got two different methods I'm considiring

Method 1
  • The only task the server has is to inform all clients when a client does something. The server don't have any World class, it just forwards the events to the client and let them update their own World.
  • A client right clicks on the map to add a target to move to. The client then sends a package to the server containing the event id, client id and the target position. The server then only sends the package to all connected clients and let them handle it.
The bandwidth usage will be very low since packages only gets sent on user input. I do however think that the clients very easily will get out of sync, and there's nothing that will make them synced again.

Method 2
  • The server contains a World class that gets updated when clients perform actions. This World then gets broadcasted to all clients frequently (how often?) and the clients then set the objects positions so they are the same as the servers.
  • A client right clicks on the map to add a target to move to. It sends the event to the server who then updates it's World. The server does nothing more in this stage, the changes will get broadcasted to all clients in X ms.
I'm not sure how often this broadcast will happen but it will definitly be more bandwidth heavy than method 1. This method does however make sure that the clients are synced.

This is just what I came up with after 1 day of researching and I would love if you could share things I should think about and general suggestion. How would you do something like this?

#2simpler

Posted 21 November 2012 - 11:13 AM

I just recently started working on my next project which will be multiplayer exclusively with support for up to 8 players. It's really important that the clients are synced since avoiding projectiles and having good micro is a key part in the game.

I got some questions regarding the networking architecture on a game like this. I'm going to use RakNet and I'm pretty sure I will use a client-server approach. I got two different methods I'm considiring

Method 1
  • The only task the server has is to inform all clients when a client does something. The server don't have any World class, it just forwards the events to the client and let them update their own World.
  • A client right clicks on the map to add a target to move to. The client then sends a package to the server containing the event id, client id and the target position. The server then only sends the package to all connected clients and let them handle it.
The bandwidth usage will be very low since packages only gets sent on user input. I do however think that the clients very easily will get out of sync, and there's nothing that will make them synced again.

Method 2
  • The server contains a World class that gets updated when clients perform actions. This World then gets broadcasted to all clients frequently (how often?) and the clients then set the objects positions so they are the same as the servers.
  • A client right clicks on the map to add a target to move to. It sends the event to the server who then updates it's World. The server does nothing more in this stage, the changes will get broadcasted to all clients in X ms.
I'm not sure how often this broadcast will happen but it will definitly be more bandwidth heavy than method 1. This method does however make sure that the clients are synced.

This is just what I came up with after 1 day of researching and I would love if you could share things I should think about and general suggestion. How would you do something like this?

#1simpler

Posted 21 November 2012 - 10:09 AM

I just recently started working on my next project which will be multiplayer exclusively. It's really important that the clients are synced since avoiding projectiles and having good micro is a key part in the game.

I got some questions regarding the networking architecture on a game like this. I'm going to use RakNet and I'm pretty sure I will use a client-server approach. I got two different methods I'm considiring

Method 1
  • The only task the server has is to inform all clients when a client does something. The server don't have any World class, it just forwards the events to the client and let them update their own World.
  • A client right clicks on the map to add a target to move to. The client then sends a package to the server containing the event id, client id and the target position. The server then only sends the package to all connected clients and let them handle it.
The bandwidth usage will be very low since packages only gets sent on user input. I do however think that the clients very easily will get out of sync, and there's nothing that will make them synced again.

Method 2
  • The server contains a World class that gets updated when clients perform actions. This World then gets broadcasted to all clients frequently (how often?) and the clients then set the objects positions so they are the same as the servers.
  • A client right clicks on the map to add a target to move to. It sends the event to the server who then updates it's World. The server does nothing more in this stage, the changes will get broadcasted to all clients in X ms.
I'm not sure how often this broadcast will happen but it will definitly be more bandwidth heavy than method 1. This method does however make sure that the clients are synced.

This is just what I came up with after 1 day of researching and I would love if you could share things I should think about and general suggestion. How would you do something like this?

PARTNERS