I'm currently working on iocp game server. My game is just like diablo3 basically. 1~4 players join a separate session.

I did basic iocp preparations and now I'm working on game session class. The reason why I'm stuck right now is that I'm not sure if I should create a separate thread for each game session. This concept is the first idea that I came up with but I can't come up with other ideas to avoid creating so many threads for sessions when there are so many game sessions.

So here's my question.

  1. Should I create a separate game logic loop(thread) for each game session? Because that sounds so inefficient when it comes to the situation where only one player joins each session.
  2. If there are some other ways to design the server, please let me know what I should look for to study.

Thanks for your help in advance and sorry for my bad English.

  • \$\begingroup\$ We get a lot of questions asking about how to apply threads in a server context - have you scanned through previous Q&A on the subject to see if it yields any leads you can use? \$\endgroup\$ – DMGregory Jan 27 '19 at 14:04
  • 1
    \$\begingroup\$ Let us know what sort of scale you want this server to achieve. The optimal design for a server that handles 16 players across 4 sessions will be nothing at all like a server that handles 1000 players across 250 sessions. \$\endgroup\$ – Romen Jan 28 '19 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.