0

I'm currently designing MORPG server and I have a question about which i/o model I should use.
It's fast-paced 3rd person RPG and 1~3 players can join a session.
In the worst case, about 50 enemies can be shown.
I thought this could be too much process for a single-threaded server to do all the collision detection process and i/o process so I precalculated how much data would be processed and here are my results.

// (Server's tickrate is 60hz)
Object movement packets
6(header) + 2(uuid) + 4(x) + 4(y) + 4(z) = 20bytes

800bytes ~ 1000bytes per tick, player                 // 20bytes x 40~50objects
48,000bytes ~ 60,000bytes per second, player          // 800bytes ~ 1000bytes x 60frame rate
144,000bytes ~ 180,000bytes per second                // 48,000bytes ~ 60,000bytes x 3players

and I have other packets of, less than 1000bytes per second.

I think it's too much to handle for a single-threaded server since there can be multiple sessions and I'm using a normal computer as a server machine since this project is for learning purposes only.

I think IOCP can help to improve performance since it uses multi-threads(I'm kinda familiar with multi thread programming).
Also I'm considering reducing server's tickrate to 10~20 and using dead reckoning on client-side.

Is it reasonable in this case to use IOCP and dead reckoning to prevent too many works for the server?

Jeongmin Heo
  • 61
  • 1
  • 7
  • No API will make the data arrive faster or be read faster. I'm not aware of what you mean by 'dead reckoning'. – user207421 Jan 07 '20 at 10:02
  • TCP or UDP? How many sockets will simultaneously exist on your server? Knowing this will greatly influence my answer. – selbie Jan 07 '20 at 11:23
  • @user207421 - "dead reckoning" is a game technique to interpolate/smooth an object's motion based on a vector change. If the game object is "running north", but the next server packet says it's "moving east", it interpolates the motion to appear more smooth on the client side so it doesn't look like the object made a "hard right turn" with a disregard for physics. – selbie Jan 07 '20 at 11:28
  • @selbie I'll be using TCP and most of the time, 3 sockets because I think I will be testing only one session. However, what I'm aiming to do with this project is to understand how fast-paced MORPG servers should be designed when I want to publish them without problems. I think I don't need to use IOCP or dead reckoning if I'm going to take only 3 players because it's just too much work considering how small the number of players the server would deal with but I want to know how programmers currently in the game industry would design. – Jeongmin Heo Jan 07 '20 at 11:55
  • @selbie What if I say 1 session and 10 sessions both with TCP and full of players? Do they make differences? (I'm using intel i7 7700HQ 2.80GHz and 16GB ram) – Jeongmin Heo Jan 07 '20 at 12:03
  • Having done lots of socket programming and a brief year working in a game studio, let me summarize: 1. The choice of dead reckoning vs absolute positioning is an entirely separate choice from the server's threading and polling model. Your interpolation model is really to address issues with lag and animation smoothness. Your threading and polling model is for scalability of sessions on the server. – selbie Jan 07 '20 at 12:14
  • IOCP is common in massively multiplayer since it enables more socket sessions per thread. There's an overhead of invoking `poll` or `select` when the socket count gets into the hundreds or thousands of simultaneous CPU sockets. IOCP by itself will not make your networking faster. It just uses less CPU when the socket count gets high on the server side. – selbie Jan 07 '20 at 12:15
  • You didn't discuss the data structures of your game's server. Is each session its own thread? Or do all the sessions run on the same thread. You should probably start by deciding if you want your game (or game sessions) to be single threaded with all network messages being processed by the game logic on the same thread. Or can the game simulation later be thread safe. Again, this is a different decision from your socket threading model, but one might influence the other greatly. – selbie Jan 07 '20 at 12:15
  • This question should be moved to https://gamedev.stackexchange.com. A "good" mmorpg server doesn't send all information to all clients. It only sends the information a given client needs to render the scene. So he sends state changes. – user743414 Jan 07 '20 at 12:19
  • Additional you should read about packing numbers, as a start point this: https://en.wikipedia.org/wiki/Binary-coded_decimal could be used. – user743414 Jan 07 '20 at 12:25

0 Answers0