Jump to content
  • Advertisement
Sign in to follow this  
MrAkroMenToS

MMORPG separated servers (world, login) and the client to it

This topic is 1413 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!

I am working on a kind of MMORPG server-client system, just for fun and to learn things. I use c# console for server and Unity for the client (script in c#).

I have a basic idea and i would like to ask you guys to over-watch it and correct it.

After my ideas, which are done and i'm quite sure about it I will put a "//DONE", the rest will be "//WORKING ON AND NOT SURE"

 

 

So, I make a Socket server for the world and for the login //DONE

the two servers have two ports //DONE

I handle the incoming connection in login server, check the PW and USERNAME, //DONE

   if it's correct I move to the character select screen and the character creation screen in the client, //DONE

     handling the selection and the creation in the server //DONE

     if the character get selected the login server will pass the data to the world server and the game starts //WORKING ON AND NOT SURE

   if it's not i alert the client about it. //DONE

 

On the client side, I have a static client Object. I connect, i handle the errors //DONE

I can login, select the character, create new one //DONE

i want to move to the GAME scene, but i don't know how. //WORKING ON AND NOT SURE

--> this is where i stuck. Should I make my client to connect to an other PORT (the world port) when the game scene appears?

 

Guys, i need your help! If anything with my idea is bad please let me know it.

I appreciate your time!

Thanks for the answers!

 

~MrAkroMenToS

 

PS.: I'd like to apologies cause my english. If something is not clear, please let me know and i will make it clear!

Share this post


Link to post
Share on other sites
Advertisement
The right answer depends on how you intend to build your world.

If your world will be made up of multiple, separate shards (areas, instances, levels, ...) then it makes sense to have the login server tell the client "your character's current area is available at foo.bar.com:12343" and have the client make a world connection to that address.

If your world view is a single, large, seamless world, then perhaps you're better off creating a "gateway" server which handles all the connections to clients -- spin up as many of these as you need, and load balance with HAProxy or an F5 or whatever. The gateway server would then make/break connections to the different world and login and whatever-else servers, and funnel requests from all its clients across each of those connections.

In general, though, the best you can do is to make sure that you're well defined in what your protocols look like. What kinds of data does the client send, and when, and what kinds of data does each server send, and when? The more you can make this "stateless" (as in "I just stream out information X on interval Y") rather than "RPC" (node X sends a request and then waits for node Y to send a response) the better your system will likely perform in reality.

Share this post


Link to post
Share on other sites

Thank you!

 

I will make a login server, and a ton of world servers (for each maps). The problem is, if i have 10-20 maps, I will have to open 10-20 +1 port on the server computer.

 

 

I have a login server (port example: 4040). After I logged in, I will tell the client, hey, you logged in, please move to port: 7007 (world gateway).

There will be a server side switch to control the datas to the multiple world servers.

 

What do you think? which one would be better?

Share this post


Link to post
Share on other sites

The problem is, if i have 10-20 maps, I will have to open 10-20 +1 port on the server computer.


Why is this a problem?

Share this post


Link to post
Share on other sites
I think, because i cannot open a port each time I add a new map. I want to make separate " servers" for dungeons as well and I cannot open as much port as I have to. Is it a good idea then to make a gateway server for the worldserver communication.

Share this post


Link to post
Share on other sites

I think, because i cannot open a port each time I add a new map. I want to make separate " servers" for dungeons as well and I cannot open as much port as I have to.


Why not? Will you have more than 16,000 instances of maps/dungeons on a single server?

Share this post


Link to post
Share on other sites
If player A wants to join to an instance i have to create a new map for player A's group, so they can enter to the instance. If player B eants to join to the same intance, i hate to create an other map for the instance.
I could create 500ports for the intances and say, if these are full, sorry the server is busy you cannot join to an instance, please try again a few minutes later.

Share this post


Link to post
Share on other sites
I still don't understand what the problem is.

The simplest, and most robust, way to spin up instances of maps is to have a mapping, server-side, of instance-id to ip-address:port, and give this out to each player that wants to join that instance. If you have the CPU/RAM, you could have thousands of instances on a physical host, and thus have thousands of ports active on that host.

A perhaps slightly more efficient variant, if your application is perfect in threading and memory management, is to spin up a single game server, and have that load each map static data once, and create a separate "game world instance" per instance with dynamic data. That will save some RAM (through static map and code sharing,) but is significantly more complex.

In this second case, you would have to give some token to each user, which would identify the instance ID when the user connects back to the server.

The simplicity of option 1) is super great -- if a server process crashes, all other instances stay up. If you need more servers, just add more possible IP addresses that the instance could be hosted on. This also scales easily to cloud hosted solution.

Share this post


Link to post
Share on other sites

How can i open ports dinamically?
The router blocks the connections


I see -- your problem is one of router configuration.

You could either set the server machine as a DMZ (receiving all incoming data,) or if your router supports it, you can set up a range of ports to forward rather than single ports. If your router doesn't support range forwarding, get a new router.

Also, in general, if you're talking about lots of maps/users, then you're not talking about a residential internet service in a closet; you're talking about some kind of data center co-location or managed hosting, where the network hardware and setup is tuned for your application.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!