Jump to content
  • Advertisement
Sign in to follow this  
Plerion

[C#] Cluster shared content

This topic is 3039 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

Hello!

Maybe the title is a bit misleading, but ill try to explain here, what the idea is:
Im developing a server for my game. As the game is for free also the server can be compiled and used by everyone for free (thats an important thing to think about, when programming :D). My game consist of a few different maps where the main maps have a high population and the others usually aren't frequented very often. So my idea was that every of these main maps has its own executable. The rest of the maps are then in one other exe. The idea is that you can distribute the main maps on several servers to keep latency low.

So there are a few problems:
1. Storage of common information that is the same on every map/server/whatever. An example are infos about items. How could that be handled? Making a central storage exe that also can figure on its own server and query for information using sockets? Every executable loads the information? (i think thats not good if someone puts more than one map on the same server) Or any other alternative?

2. Communicating between the different maps. For example if i say something in my group where some members are on another server i need to tell those members that i've told something. I guess thats only possible with network communication using sockets?

Would be very nice if someone could share his experience with those points!

Greetings
Plerion

Share this post


Link to post
Share on other sites
Advertisement
My guess is that you need to split the data from the executables.
You might not need multiple executables, what you need is multiple processes.

And even then the crowed ones might interfere with the low population. So you might need to move the crowed maps to a seperate server (machine).

Your second question is unclear to me. Are you talking about design time or runtime?

Share this post


Link to post
Share on other sites
Hey!

Yes, I meant multiple executables/processes on multiple servers. But maybe someone cant afford as many servers as there are executables/processes. So in this case I would load the same data multiple times on the same server. Basically the data is separated from the process as its stored in a database. But I cache a lot of information at startup to not need to query everything from the database when the client needs it. Do you think I should take everything all the time from the database and don't cache it? That would basically solve the problem but it may affect performance.

My second point is pretty simple: What's the most effective way to communicate between those executables? I think its only possible using sockets. I was thinking about something like an interface to the objects (players) which decides if the real object is on the same server or not and if not launches a packet to the server with the object on it containing the action it should perform.

Greetings
Plerion

Share this post


Link to post
Share on other sites
Yes communicating between servers you need to use some form of networking. Since you are on C# I'd suggest taking a look at Lidgren network library. It is about as easy to use as networking can get imho:

http://code.google.com/p/lidgren-network-gen3/

As for the communication between players on different servers, if it is only for chat between players you might consider a dedicated chat service. Keeps it pretty simple since all servers need only be aware of the chat server and not every other server.

Share this post


Link to post
Share on other sites
Quote:
Original post by Plerion
1. Storage of common information that is the same on every map/server/whatever. An example are infos about items. How could that be handled? Making a central storage exe that also can figure on its own server and query for information using sockets? Every executable loads the information? (i think thats not good if someone puts more than one map on the same server) Or any other alternative?

Each game server process should load all this information on start-up. The key to scalability is to allow each server to support one map instance per thread, instead of per process. This means that you can load static data once for an entire process and potentially hundreds of threads running different maps can access it. Each physical server then runs multiple game servers. You can then tweak the number of threads and processes dynamically to balance load.

Quote:
2. Communicating between the different maps. For example if i say something in my group where some members are on another server i need to tell those members that i've told something. I guess thats only possible with network communication using sockets?

Dedicated chat server(s), like EJH mentioned. Not only does it seamlessly handle both same- and cross-server communication, but it would also be the perfect place to implement services like language filtering.

Share this post


Link to post
Share on other sites
Hey Zipster, EJH!

From what you and EJH posted i set up a little draft of the system.

There are 4 types of processes:
- Type 1 handles one specific map and all of its instances. The parameters of the map can be configured by the user. Therefore if one has only one server he basically will not need this type of process but if one has 10 servers he can start 10 of those processes with the 10 most frequent maps

- Type 2 handles all maps, that are not handled by an executable of type 1. Various threads for various maps.

- Type 3 is the central processor. It accepts connections, handles authentication and acts as the central information storage. He knows which player is on which server. To get an instance of a player type 1 and type 2 ask their objectmanager for the object. If its on the same server a normal object is returned. If its not on the same server they ask the central processor for information about the object (server, ...) and return an overridden version of the Player-class which can be used just like a Player where the necessary functions send packets to the belonging server.

- Type 4 is a database server for critical queries for which i already developed a system in the past that works fine.

Maybe ill also make a dedicated chat server as this sounds pretty reasonable even if communication isnt just only chat

Thanks for your advices

Plerion

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!