C
C
Clifford2014-07-08 08:44:37
C++ / C#
Clifford, 2014-07-08 08:44:37

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);
                }
            }
        }

To be honest, I'm not very happy with procedural programming in C # + this method is more suitable for Python than Sharp. So I hope you can point me in the right direction.
PS. Nobody knows how to check if SocketAsyncEventArgs is busy or not. There were times when the message was not sent because the process was busy.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cyril, 2014-07-08
@Clifford

read, mb chnit it will seem useful to you:
habrahabr.ru/company/mailru/blog/220359
habrahabr.ru/company/mailru/blog/182088

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question