callofduty4x / CoD4x_Server

Extended Call of Duty 4 server
https://cod4x.ovh
GNU Affero General Public License v3.0
333 stars 121 forks source link

[Request] Consider support for multi threading and running on multiple CPU cores #301

Closed vijayant123 closed 4 years ago

vijayant123 commented 4 years ago

Hello,

First of all thank you for keeping the game alive. This game is closer to our hearts than most other games.

I would like to know if it is possible to refactor the server code to run on multiple CPU cores rather than just 1. I know single threaded and multi threaded programs are very different in structure but I would like to use this issue to cultivate a discussion around the possibility of converting this project to a multi threaded / multi process architecture.

The need for this arises from the fact that the game lags when we try to have a higher number of slots. It also lags when we are running CPU intensive mods like ROTU zombies mod. If we are able to increase the support of playable slots to a high enough number like 128 or 256, we would finally be able to look into bigger mods for gameplay styles like battle royale. Another factor is that we have hit the per CPU core performance bottleneck (most have single core performance ranging 3-4 GHz), multiple core servers are cheaper for server owners when compared to buying a single core with higher performance.

Discussion and comments are welcome. Please suggest a viable action plan as I would like to contribute my time on this problem.

Regards.

Sammy-XI commented 4 years ago

This would be very cool especially for a higher number of players, say 48-64. Personally I doubt anybody would get 128 or 256 people to play unless it was a very special BR mod indeed and better than a certain free game. Assuming someone wanted to make it and also make the new huge maps that would be needed for it. However with the additional players also comes the problems of the added number of variables hitting limits. Another nice thing would be increasing the max number of minimap compass points from 16 per team. There are a couple gametypes that would benefit from it. So many other things. Local strings up from 640. But of course many are simply not possible no matter what you do and that is that.

Off topic, but IIRC... its been a while... the main lag problem with ROTU, from what I could make out of all of it (it IS complicated to be sure), is the real-time logic and math functions working with waypoints. Gets worse the more zombies there are. Experimented with precalculating some additional waypoint comparison data and saving it all in multi-arrays. Also saving that data in a file for later use. Or another was to do it real-time but saving the data as it goes along so it doesnt have to be done the next time. But like I said... ROTU is complicated while it was an interesting experiment who knows how stable the idea was. ;-)

T-Maxxx commented 4 years ago

Most of the server code is asm. Refactor what? ASM code? Sorry, not going to happen - too much work. There is just single developer who still maintains stuff and it's not me. I'm just a little helper here. A lot of player slots can be achieved, but not a priority.

If you want battle royale, try Warzone.

vijayant123 commented 4 years ago

Hi @T-Maxxx thanks for clearing this up. ASM would be a real pain to even touch. It's a sad situation that we cannot add modern feature as the original devs preferred to use a difficult language. Warzone is nothing in front of COD4 when it comes to getting things done in a fast way without compromising on the graphics much. COD4's compatibility with low end gaming pc setups is still a major plus point for it.

Hi @Sammy-XI thanks for your input. Although tinkering with ASM is not an impossible task but I agree it would be counterproductive to do so to this old a game. I think this server platform is going to stay the same forever, it is the mods (ROTU) that would have to look into improving themselves.