SRCDS Steam group


Crazy idea
#1
Shy 
Please dont hijack this thread with a debate about the pros/cons of multi-threading!

So since it appears valve has aborted the multi-threaded srcds, couldnt we just make a plugin that overrides the normal game engine frame routine with helper threads instead of sequential calculation of each client's state. For each client there is a set of things that the server has to calculate each frame. By spawning one helper thread per client, then letting them run on any available logical core, a dual core server theoretically would finish calculating a tick in half the time. This of course is pointless on a relatively small server, but a 20 player iceworld server could definitely see major performance increase when full. At this point a 20 player 100tick iceworld running on a 2.0ghz xeon processor starts to drop tickrate at about 15 players. Without multi-threading a dual core server is no better than a single core unless you are running 2 servers on it. But even if you are running a server per core, while one server may only use 20% of its core the other 80% could be available to the 50 slot d2 dmatch server if it were multi-threaded. Of course, since the source for srcds itself is not available(for obvious reasons), this means sig-scanning for the snapshot generating function, finding the loop that renders each client's snapshot, spawning a thread to calculate each client and blocking execution on a counter that is decremented as each thread finishes.

yeah, just an idea, Im a srcds coding noob, but i have experience coding programs that break iterative tasks into multiple threads for increased performance.
Reply
#2
Update...

After snooping around in the SDK a bit more I found what might be the server source code. It appears to be in the Game_HL2-2005 project file. I haven't yet found the tick-snapshot subroutine, and an unmodified build of the server fails with a few errors during the linking process:

1>Linking...
1> Creating library Debug HL2/server.lib and object Debug HL2/server.exp
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Editor_SendCommand.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z)
1>Editor_SendCommand.obj : error LNK2019: unresolved external symbol __imp__SendMessageA@16 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z)
1>Editor_SendCommand.obj : error LNK2019: unresolved external symbol __imp__FindWindowA@8 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z)
1>registry.obj : error LNK2019: unresolved external symbol __imp__wsprintfA referenced in function "public: virtual bool __thiscall CRegistry:Big GrinirectInit(char const *)" (?DirectInit@CRegistry@@UAE_NPBD@Z)
1>Debug HL2/server.dll : fatal error LNK1120: 4 unresolved externals
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 8.00.50727
1>Copyright © Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://g:\tourneymod\dlls\Debug HL2\BuildLog.htm"
1>server_hl2 - 5 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Also, I have not yet tried to build the project on linux using a modified Makefile from the linux_sdk folder. Has anyone out there tried to do this? Has anyone been able to successfully build the windows server.dll from this project in the sdk?
Update... again...

I found what I am pretty sure is the simulation function call for server side physics generation per client(void CBasePlayer:TounguehysicsSimulate( void )). I still have to find where the engine loops to call this for each player then from there I can probably find the function that is used to decide what info about other clients and the world gets sent to each client. But finding this per tick physics generation routine is a huge step forward in itself if it is indeed what I think it is.
Reply
#3
Hi mumbles, you aren't the first to try this.

Unfortunately, the actual source code of the SRCDS program is not public, which makes it (as far as I know) still impossible to create a multithreading program/server.
Join the Source Dedicated Server Support Group on Steam Community!
Source Dedicated Server (SRCDS)
Free to join, Live support! (When available)

http://forums.srcds.com/viewtopic/5114
Reply
#4
i think you may be over-simplifying things, but monk is probably the only person here who can provide meaningful feedback on this. otherwise post on the hlds mailing list. i would think if it could have been done in a sane manner, someone would have tried it by now, but you never know.
Reply
#5
ok, i got vc++ 2008 express to build me a server.dll, when i run it using the -game cstrike command line option the srcds application runs, with some errors, but at least it runs. I tried with the -game hl2dm and -game hl2 options but then it just crashes immediately. I am posting a log of the server console with some commands that are broken. I still consider this a step forward. Interesting how it loads Game.dll for hl2 even though its launched for cstrike

255.9 fps 0/32 on map de_dust
Console initialized.
Game.dll loaded for "Half-Life 2"
maxplayers set to 1
maxplayers set to 32
Network: IP 192.168.1.105, mode MP, dedicated Yes, ports 27015 SV / 27005 CL
Level "de_dust" has been loaded
couldn't exec skill_manifest.cfg
Error: Material "sprites/bubble" : proxy "AnimatedTexture" not found!
Error reading weapon data file for: weapon_stunstick
Error reading weapon data file for: weapon_smg1
Error reading weapon data file for: weapon_shotgun
Error reading weapon data file for: weapon_rpg
Error reading weapon data file for: weapon_pistol
Error reading weapon data file for: weapon_physcannon
Error reading weapon data file for: weapon_frag
Error reading weapon data file for: weapon_crowbar
Error reading weapon data file for: weapon_crossbow
Error reading weapon data file for: weapon_citizensuitcase
Error reading weapon data file for: weapon_citizenpackage
Error reading weapon data file for: weapon_bugbait
Error reading weapon data file for: weapon_ar2
Error: Material "models/effects/comball_tape" : proxy "TextureScroll" not found!

Error: Material "models/effects/comball_sphere" : proxy "TextureScroll" not foun
d!
Error reading weapon data file for: weapon_annabelle
Error reading weapon data file for: weapon_alyxgun
Error reading weapon data file for: weapon_357
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type func_bomb_target!
Can't init func_bomb_target
Attempted to create unknown entity type func_bomb_target!
Can't init func_bomb_target
Attempted to create unknown entity type func_buyzone!
Can't init func_buyzone
Attempted to create unknown entity type func_buyzone!
Can't init func_buyzone
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_terrorist!
Can't init info_player_terrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type info_player_counterterrorist!
Can't init info_player_counterterrorist
Attempted to create unknown entity type env_tonemap_controller!
Can't init env_tonemap_controller
Section [Scenes]: 0 resources total 0 bytes, 0.00 % of limit (2.10 MB)
Adding master server 69.28.140.246:27011
Adding master server 68.142.72.250:27011
Connection to Steam servers successful.
VAC secure mode is activated.
status
hostname: Half-Life 2
version : 1.0.0.34/7 3698 secure
udp/ip : 192.168.1.105:27015
map : de_dust at: 0 x, 0 y, 0 z
players : 0 (32 max)

# userid name uniqueid connected ping loss state adr
mp_maxplayers
Unknown command "mp_maxplayers"
mp_maxrounds
Unknown command "mp_maxrounds"
stats
CPU In Out Uptime Users FPS Players
0.00 0.00 0.00 3 0 256.03 0
bot_add
Unknown command "bot_add"
Reply
#6
oh, of course it loads the hl2 game.dll, thats all it was built with, thats all it has, game.dll is not in the srcds directory tree. The SDK is not a complete implementation, duh. Anyone know of a way to extract the game.dll from the server.dll in srcds? Actually, some of the code for the css game.dll appears to be included in the sdk, but definitely not all of it. I did find a place where a serverplugin could help make at least a multithreaded bot server. I am going to work on testing that idea probably first.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)