Answer the question
In order to leave comments, you need to log in
How to organize business logic on the server?
In fact, my question has already been, but they did not give a clear answer. C# asynchronous server architecture
I'm more interested in how to organize a layer between the application server and the logic, well, and the implementation of the logic itself.
It is especially interesting to learn how data processing occurs, for example, in large MMORPGs. Indeed, in such games you need to process heaps of data (coordinates, objects, etc.) How does the server cope with the load?
Okay, back to my "rams". Now I have implemented a layer and the logic, to put it mildly, is not very good.
In short, the client sends a json message to the server, the server pulls out the type (what the user did) from this message, this type flies to the function where the dictionary is searched, and when the key is found, the desired function is executed. I did not explain very well, it will be easier to show in the code.
// key - ключ\тип действия пользователя;
// player - экземпляр игрока
private void messageHnd(String key, Client player)
{
foreach (String i in Settings.types.Keys) // types - это словарь вида <String, delegate>
{
if (i == key)
{
Settings.types[key](data, player);
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question