nickhadder
Member
Howdy all,
I am creating a MMORPG game (like RotMG) where there are multiple rooms the player can go into. The server is like the client where you can see the game world, fly around and look at everything going on while handling the server stuff in the background. However, im at the part where I want to start spawning mobs in the game that all the players can attack together and I want to sync everything up between the clients such as movement, attacking, and colliding with solids in the room. There are a couple of ideas that came into my head, but each have their own drawback. I just wanted to know if anyone on here is experienced in this topic or knows how game companies manage this in the real world.
For reference, the client and server are integrated into the same project so the server has the same room as the client does. There's just a super-secret way to boot it up in server mode.
Scenario 1:
The client that wants to spawn mobs around them creates them on the client side, then each mobs sends a message to the server so that it can spawn it in the room with everyone else in it. When the player spawns the mob (obj_clientmob), that mob keeps track of the collisions around it in the same room as the player. The server will spawn a obj_othermob for everyone else linking together with a GUID to keep track of which mob is which.
Drawbacks:
When the player leaves the room into another, I will have to convert the obj_othermob for another player into a obj_clientmob so the mob just doesn't suddenly stop working after a player enters another room so that other players that may be fighting the mob can continue to do so. Having to pick another player to take this over might be a difficult one if there are multiple to choose from.
Scenario 2:
Make the server go into all of the rooms at the very start of booting up the server and make all the collision objects and mob objects persistent so that when the obj_god object (that flys around the game world to see everything) goes back to the first room, all of the mobs and collisions are there in the background. I can easily hide mobs and collisions and prevent them from working for god and the other players if they are not in the same room as I already track that for each player. Then, I can just have the server manage spawning mobs around the players and handle the mob movement and collisions server-side.
Drawbacks:
The idea of having the server go through each and every single room, to make all the collision objects in the background doesn't seem like a very clean solution and as this game grows, we may be talking about a very large number of objects and collisions to handle at one time. I understand servers are supposed to be processing heavy for reasons like this, but if I can have each client handle the mobs spawned around them like in scenario 1, that might ease the server processing and allow it to run faster and more optimized.
If you have another scenario that is better than what I listed or any information on this topic, please let me know. I've tried looking all of the internet for a solution but couldn't find anything useful especially when it comes to Game Maker Studio 2. If anyone needs to know anything more about my game or look at some code, I would be happy to share.
Thanks for your help,
Nick
I am creating a MMORPG game (like RotMG) where there are multiple rooms the player can go into. The server is like the client where you can see the game world, fly around and look at everything going on while handling the server stuff in the background. However, im at the part where I want to start spawning mobs in the game that all the players can attack together and I want to sync everything up between the clients such as movement, attacking, and colliding with solids in the room. There are a couple of ideas that came into my head, but each have their own drawback. I just wanted to know if anyone on here is experienced in this topic or knows how game companies manage this in the real world.
For reference, the client and server are integrated into the same project so the server has the same room as the client does. There's just a super-secret way to boot it up in server mode.
Scenario 1:
The client that wants to spawn mobs around them creates them on the client side, then each mobs sends a message to the server so that it can spawn it in the room with everyone else in it. When the player spawns the mob (obj_clientmob), that mob keeps track of the collisions around it in the same room as the player. The server will spawn a obj_othermob for everyone else linking together with a GUID to keep track of which mob is which.
Drawbacks:
When the player leaves the room into another, I will have to convert the obj_othermob for another player into a obj_clientmob so the mob just doesn't suddenly stop working after a player enters another room so that other players that may be fighting the mob can continue to do so. Having to pick another player to take this over might be a difficult one if there are multiple to choose from.
Scenario 2:
Make the server go into all of the rooms at the very start of booting up the server and make all the collision objects and mob objects persistent so that when the obj_god object (that flys around the game world to see everything) goes back to the first room, all of the mobs and collisions are there in the background. I can easily hide mobs and collisions and prevent them from working for god and the other players if they are not in the same room as I already track that for each player. Then, I can just have the server manage spawning mobs around the players and handle the mob movement and collisions server-side.
Drawbacks:
The idea of having the server go through each and every single room, to make all the collision objects in the background doesn't seem like a very clean solution and as this game grows, we may be talking about a very large number of objects and collisions to handle at one time. I understand servers are supposed to be processing heavy for reasons like this, but if I can have each client handle the mobs spawned around them like in scenario 1, that might ease the server processing and allow it to run faster and more optimized.
If you have another scenario that is better than what I listed or any information on this topic, please let me know. I've tried looking all of the internet for a solution but couldn't find anything useful especially when it comes to Game Maker Studio 2. If anyone needs to know anything more about my game or look at some code, I would be happy to share.
Thanks for your help,
Nick