diff --git a/src/Makefile b/src/Makefile
index cec5dc88f88e588a1f520043f945944584bcebae..750e8ead5f98eea86e2f2f7eb32922d2b83b282d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -207,6 +207,7 @@ objdir:=$(makedir)/objs
 sources+=\
 	$(call List,Sourcefile)\
 	$(call List,blua/Sourcefile)\
+	$(call List,netcode/Sourcefile)\
 
 depends:=$(basename $(filter %.c %.s,$(sources)))
 objects:=$(basename $(filter %.c %.s %.nas,$(sources)))
diff --git a/src/Sourcefile b/src/Sourcefile
index 83e9ebc3b710585359070c735d25d0bc870b0f6c..7d2146411369e475046a1d07c3190749210da43f 100644
--- a/src/Sourcefile
+++ b/src/Sourcefile
@@ -1,9 +1,5 @@
 string.c
 d_main.c
-d_clisrv.c
-d_net.c
-d_netfil.c
-d_netcmd.c
 dehacked.c
 deh_soc.c
 deh_lua.c
@@ -77,9 +73,6 @@ s_sound.c
 sounds.c
 w_wad.c
 filesrch.c
-mserv.c
-http-mserv.c
-i_tcp.c
 lzf.c
 vid_copy.s
 b_bot.c
diff --git a/src/android/i_net.c b/src/android/i_net.c
index f6e642022e4a54360d68004f69d61eaa5e3acb19..4c30dc767a04615b75e6badf68d3603bc475a575 100644
--- a/src/android/i_net.c
+++ b/src/android/i_net.c
@@ -1,4 +1,4 @@
-#include "../i_net.h"
+#include "../netcode/i_net.h"
 
 boolean I_InitNetwork(void)
 {
diff --git a/src/blua/liolib.c b/src/blua/liolib.c
index e029650c0ced525f3bfc56fc9863d9816f6ebb63..8a6354121a90dfa6c240de7fe78fbad6a76cedce 100644
--- a/src/blua/liolib.c
+++ b/src/blua/liolib.c
@@ -19,7 +19,7 @@
 #include "lualib.h"
 #include "../i_system.h"
 #include "../g_game.h"
-#include "../d_netfil.h"
+#include "../netcode/d_netfil.h"
 #include "../lua_libs.h"
 #include "../byteptr.h"
 #include "../lua_script.h"
diff --git a/src/command.c b/src/command.c
index 9be081fb75648c6a1c2017ded3ef648058bb4063..4e8989fd315e25d6295ef889ac46e884e123b25c 100644
--- a/src/command.c
+++ b/src/command.c
@@ -28,11 +28,11 @@
 #include "byteptr.h"
 #include "p_saveg.h"
 #include "g_game.h" // for player_names
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 #include "hu_stuff.h"
 #include "p_setup.h"
 #include "lua_script.h"
-#include "d_netfil.h" // findfile
+#include "netcode/d_netfil.h" // findfile
 #include "r_data.h" // Color_cons_t
 
 //========
diff --git a/src/d_main.c b/src/d_main.c
index 1af8d090c1952a2c56385aec3de742542f1dcda1..8b13dba89bbf3a307dda463fd8250c5954dd0193 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -34,7 +34,7 @@
 #include "doomdef.h"
 #include "am_map.h"
 #include "console.h"
-#include "d_net.h"
+#include "netcode/d_net.h"
 #include "f_finale.h"
 #include "g_game.h"
 #include "hu_stuff.h"
@@ -57,11 +57,11 @@
 #include "w_wad.h"
 #include "z_zone.h"
 #include "d_main.h"
-#include "d_netfil.h"
+#include "netcode/d_netfil.h"
 #include "m_cheat.h"
 #include "y_inter.h"
 #include "p_local.h" // chasecam
-#include "mserv.h" // ms_RoomId
+#include "netcode/mserv.h" // ms_RoomId
 #include "m_misc.h" // screenshot functionality
 #include "deh_tables.h" // Dehacked list test
 #include "m_cond.h" // condition initialization
diff --git a/src/deh_soc.c b/src/deh_soc.c
index 583776ee7db0522714862adc7e7728eb9404b388..f13dd53a2cd3e06936bfe2aca9d9db11fd3e285f 100644
--- a/src/deh_soc.c
+++ b/src/deh_soc.c
@@ -34,7 +34,7 @@
 #include "r_sky.h"
 #include "fastcmp.h"
 #include "lua_script.h" // Reluctantly included for LUA_EvalMath
-#include "d_clisrv.h"
+#include "netcode/d_clisrv.h"
 
 #ifdef HWRENDER
 #include "hardware/hw_light.h"
diff --git a/src/deh_soc.h b/src/deh_soc.h
index f972ec26ecbb7732098e131d427ebd34b5f621ef..cd55b665bd78ede8883714caaa67402b24bb7713 100644
--- a/src/deh_soc.h
+++ b/src/deh_soc.h
@@ -35,7 +35,7 @@
 #include "r_sky.h"
 #include "fastcmp.h"
 #include "lua_script.h" // Reluctantly included for LUA_EvalMath
-#include "d_clisrv.h"
+#include "netcode/d_clisrv.h"
 
 #ifdef HWRENDER
 #include "hardware/hw_light.h"
diff --git a/src/doomstat.h b/src/doomstat.h
index bce43416b840e7704a870857708ae1e019062868..344a3daa47c77573e16102678edfa3f72e2c428c 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -683,7 +683,7 @@ extern boolean singletics;
 // Netgame stuff
 // =============
 
-#include "d_clisrv.h"
+#include "netcode/d_clisrv.h"
 
 extern consvar_t cv_timetic; // display high resolution timer
 extern consvar_t cv_powerupdisplay; // display powerups
diff --git a/src/dummy/i_net.c b/src/dummy/i_net.c
index f6e642022e4a54360d68004f69d61eaa5e3acb19..4c30dc767a04615b75e6badf68d3603bc475a575 100644
--- a/src/dummy/i_net.c
+++ b/src/dummy/i_net.c
@@ -1,4 +1,4 @@
-#include "../i_net.h"
+#include "../netcode/i_net.h"
 
 boolean I_InitNetwork(void)
 {
diff --git a/src/f_finale.c b/src/f_finale.c
index 307e00aaa2d26118672b1d173be0b6ffa7011256..2122cf34d91bb11e2c4ae94e24d028d4b34d3136 100644
--- a/src/f_finale.c
+++ b/src/f_finale.c
@@ -14,7 +14,7 @@
 #include "doomdef.h"
 #include "doomstat.h"
 #include "d_main.h"
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 #include "f_finale.h"
 #include "g_game.h"
 #include "hu_stuff.h"
diff --git a/src/filesrch.c b/src/filesrch.c
index 23b8e7f409b5c450f0d507b2075bebb611efa508..d68a7d5ed427eaa7d8b09ee305d9354c7eeb9352 100644
--- a/src/filesrch.c
+++ b/src/filesrch.c
@@ -26,7 +26,7 @@
 #include <string.h>
 
 #include "filesrch.h"
-#include "d_netfil.h"
+#include "netcode/d_netfil.h"
 #include "m_misc.h"
 #include "z_zone.h"
 #include "m_menu.h" // Addons_option_Onchange
diff --git a/src/filesrch.h b/src/filesrch.h
index 59ef5269b194f0918a14927a6fc1eaf003e1a40b..a934c48d61bc9cfa4e31f550c2001bd582908e31 100644
--- a/src/filesrch.h
+++ b/src/filesrch.h
@@ -5,7 +5,7 @@
 #define __FILESRCH_H__
 
 #include "doomdef.h"
-#include "d_netfil.h"
+#include "netcode/d_netfil.h"
 #include "m_menu.h" // MAXSTRINGLENGTH
 #include "w_wad.h"
 
diff --git a/src/g_demo.c b/src/g_demo.c
index 9099adc712635170d14f0ea61bc77aa9808a635c..6167b3a09f325222dcfa5f9a6ad74175850f3726 100644
--- a/src/g_demo.c
+++ b/src/g_demo.c
@@ -15,7 +15,7 @@
 #include "console.h"
 #include "d_main.h"
 #include "d_player.h"
-#include "d_clisrv.h"
+#include "netcode/d_clisrv.h"
 #include "p_setup.h"
 #include "i_time.h"
 #include "i_system.h"
diff --git a/src/g_game.c b/src/g_game.c
index b4a127a73149eb5e7f5cb09b087f291ae775f89e..93b8eb9364918f82cc7961978b7989ce66f3bd1c 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -15,7 +15,7 @@
 #include "console.h"
 #include "d_main.h"
 #include "d_player.h"
-#include "d_clisrv.h"
+#include "netcode/d_clisrv.h"
 #include "f_finale.h"
 #include "p_setup.h"
 #include "p_saveg.h"
diff --git a/src/g_input.c b/src/g_input.c
index 465db0316bfe726b0eafaf9fc70511031c54a6ea..5ae5ae0cfc2a80a5226e61ff074b82f248fa8e34 100644
--- a/src/g_input.c
+++ b/src/g_input.c
@@ -18,7 +18,7 @@
 #include "i_gamepad.h"
 #include "keys.h"
 #include "hu_stuff.h" // need HUFONT start & end
-#include "d_net.h"
+#include "netcode/d_net.h"
 #include "console.h"
 
 #define MAXMOUSESENSITIVITY 100 // sensitivity steps
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 3cb7275a0bde2e5e52a3930aa080cdc57aea6bfa..191ee68bb890d1a2631c80167a26db5fab8f56c7 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -29,7 +29,7 @@
 #include "../r_patch.h"
 #include "../r_picformats.h"
 #include "../r_bsp.h"
-#include "../d_clisrv.h"
+#include "../netcode/d_clisrv.h"
 #include "../w_wad.h"
 #include "../z_zone.h"
 #include "../r_splats.h"
@@ -5234,7 +5234,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
 		{
 			interpmobjstate_t casterinterp = {};
 			fixed_t groundz;
-			fixed_t floordiff; 
+			fixed_t floordiff;
 
 			if (R_UsingFrameInterpolation() && !paused)
 			{
@@ -5244,7 +5244,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
 			{
 				R_InterpolateMobjState(caster, FRACUNIT, &casterinterp);
 			}
-			
+
 			groundz = R_GetShadowZ(thing, NULL);
 			floordiff = abs(((thing->eflags & MFE_VERTICALFLIP) ? caster->height : 0) + casterinterp.z - groundz);
 
diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index 37c3f0dc398f41caa0a8f9b023056abaa23efcbf..e5cf5aeb14bd634e5b14a55fd2be568082a9002d 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -19,7 +19,7 @@
 #include "m_cond.h" // emblems
 #include "m_misc.h" // word jumping
 
-#include "d_clisrv.h"
+#include "netcode/d_clisrv.h"
 
 #include "g_game.h"
 #include "g_input.h"
diff --git a/src/i_time.c b/src/i_time.c
index c1cc9dfd44d1c20828c598b44826fdbb48fed919..9303d7be7abd504a60048fa38f52c1f36539e925 100644
--- a/src/i_time.c
+++ b/src/i_time.c
@@ -17,7 +17,7 @@
 
 #include "command.h"
 #include "doomtype.h"
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 #include "m_fixed.h"
 #include "i_system.h"
 
diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index c94e9e91ef245ff84236536e69736235addf0584..ea519be55f4d19f368ef9f40f0e1f4924a41f53a 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -27,11 +27,11 @@
 #include "y_inter.h"
 #include "hu_stuff.h"	// HU_AddChatText
 #include "console.h"
-#include "d_netcmd.h" // IsPlayerAdmin
+#include "netcode/d_netcmd.h" // IsPlayerAdmin
 #include "m_menu.h" // Player Setup menu color stuff
 #include "m_misc.h" // M_MapNumber
 #include "b_bot.h" // B_UpdateBotleader
-#include "d_clisrv.h" // CL_RemovePlayer
+#include "netcode/d_clisrv.h" // CL_RemovePlayer
 #include "i_system.h" // I_GetPreciseTime, I_GetPrecisePrecision
 
 #include "lua_script.h"
diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c
index 6506d3dc65503386249e6c733eb6801d7fe68264..e8e6ebea9f94a952447851387651d10f6375af72 100644
--- a/src/lua_hooklib.c
+++ b/src/lua_hooklib.c
@@ -25,7 +25,7 @@
 #include "lua_hud.h" // hud_running errors
 
 #include "m_perfstats.h"
-#include "d_netcmd.h" // for cv_perfstats
+#include "netcode/d_netcmd.h" // for cv_perfstats
 #include "i_system.h" // I_GetPreciseTime
 
 /* =========================================================================
diff --git a/src/lua_script.c b/src/lua_script.c
index 8d8fb295cda8cdf0df4e0bd42b31e6ae344d88cc..f1c800df5cc7ca22bcb6546a87186e117da63bbd 100644
--- a/src/lua_script.c
+++ b/src/lua_script.c
@@ -28,7 +28,7 @@
 #include "p_slopes.h" // for P_SlopeById and slopelist
 #include "p_polyobj.h" // polyobj_t, PolyObjects
 #ifdef LUA_ALLOW_BYTECODE
-#include "d_netfil.h" // for LUA_DumpFile
+#include "netcode/d_netfil.h" // for LUA_DumpFile
 #endif
 
 #include "lua_script.h"
diff --git a/src/m_cheat.c b/src/m_cheat.c
index f943774504e336914c46c9436948bef125a79d2f..36b2d19073c28b123f6f0ec4ea7a520eae58670c 100644
--- a/src/m_cheat.c
+++ b/src/m_cheat.c
@@ -19,7 +19,7 @@
 #include "r_local.h"
 #include "p_local.h"
 #include "p_setup.h"
-#include "d_net.h"
+#include "netcode/d_net.h"
 
 #include "m_cheat.h"
 #include "m_menu.h"
diff --git a/src/m_menu.c b/src/m_menu.c
index 824ae5c469d4ae91965a46ae9732db75c58e351d..d3ae4da2a97974ba37b96ea876f6ee4fa267b06b 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -20,7 +20,7 @@
 
 #include "doomdef.h"
 #include "d_main.h"
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 #include "console.h"
 #include "r_fps.h"
 #include "r_local.h"
@@ -55,8 +55,8 @@
 #include "hardware/hw_main.h"
 #endif
 
-#include "d_net.h"
-#include "mserv.h"
+#include "netcode/d_net.h"
+#include "netcode/mserv.h"
 #include "m_misc.h"
 #include "m_anigif.h"
 #include "byteptr.h"
diff --git a/src/m_menu.h b/src/m_menu.h
index 8eb1831631d3e30945a56181ecc9e287cba43972..809186a17c192961a980820ffc959326e2fdbd41 100644
--- a/src/m_menu.h
+++ b/src/m_menu.h
@@ -20,7 +20,7 @@
 #include "command.h"
 #include "f_finale.h" // for ttmode_enum
 #include "i_threads.h"
-#include "mserv.h"
+#include "netcode/mserv.h"
 #include "r_things.h" // for SKINNAMESIZE
 
 // Compatibility with old-style named NiGHTS replay files.
diff --git a/src/m_perfstats.c b/src/m_perfstats.c
index 9f65a7616abfe427eaa1abd69fe16c128d559fba..cca4c62caf062b197dbdee40d38ffd15d5e14ff7 100644
--- a/src/m_perfstats.c
+++ b/src/m_perfstats.c
@@ -12,7 +12,7 @@
 #include "m_perfstats.h"
 #include "v_video.h"
 #include "i_video.h"
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 #include "r_main.h"
 #include "i_system.h"
 #include "z_zone.h"
diff --git a/src/netcode/Sourcefile b/src/netcode/Sourcefile
new file mode 100644
index 0000000000000000000000000000000000000000..9087917d0443548ed36d4162b6c60393b70b6f80
--- /dev/null
+++ b/src/netcode/Sourcefile
@@ -0,0 +1,7 @@
+d_clisrv.c
+d_net.c
+d_netcmd.c
+d_netfil.c
+http-mserv.c
+i_tcp.c
+mserv.c
diff --git a/src/d_clisrv.c b/src/netcode/d_clisrv.c
old mode 100755
new mode 100644
similarity index 99%
rename from src/d_clisrv.c
rename to src/netcode/d_clisrv.c
index cb1ccd5398f27470687d8ee182014d07e9b3bbd3..9b11e23ff02d49d920836e4fce6534ac9917f7ee
--- a/src/d_clisrv.c
+++ b/src/netcode/d_clisrv.c
@@ -15,48 +15,48 @@
 #include <unistd.h> //for unlink
 #endif
 
-#include "i_time.h"
+#include "../i_time.h"
 #include "i_net.h"
-#include "i_system.h"
-#include "i_video.h"
+#include "../i_system.h"
+#include "../i_video.h"
 #include "d_net.h"
-#include "d_main.h"
-#include "g_game.h"
-#include "st_stuff.h"
-#include "hu_stuff.h"
-#include "keys.h"
-#include "g_input.h"
-#include "i_gamepad.h"
-#include "m_menu.h"
-#include "console.h"
+#include "../d_main.h"
+#include "../g_game.h"
+#include "../st_stuff.h"
+#include "../hu_stuff.h"
+#include "../keys.h"
+#include "../g_input.h"
+#include "../i_gamepad.h"
+#include "../m_menu.h"
+#include "../console.h"
 #include "d_netfil.h"
-#include "byteptr.h"
-#include "p_saveg.h"
-#include "z_zone.h"
-#include "p_local.h"
-#include "p_haptic.h"
-#include "m_misc.h"
-#include "am_map.h"
-#include "m_random.h"
+#include "../byteptr.h"
+#include "../p_saveg.h"
+#include "../z_zone.h"
+#include "../p_local.h"
+#include "../p_haptic.h"
+#include "../m_misc.h"
+#include "../am_map.h"
+#include "../m_random.h"
 #include "mserv.h"
-#include "y_inter.h"
-#include "r_local.h"
-#include "m_argv.h"
-#include "p_setup.h"
-#include "lzf.h"
-#include "lua_script.h"
-#include "lua_hook.h"
-#include "lua_libs.h"
-#include "md5.h"
-#include "m_perfstats.h"
+#include "../y_inter.h"
+#include "../r_local.h"
+#include "../m_argv.h"
+#include "../p_setup.h"
+#include "../lzf.h"
+#include "../lua_script.h"
+#include "../lua_hook.h"
+#include "../lua_libs.h"
+#include "../md5.h"
+#include "../m_perfstats.h"
 
 // aaaaaa
-#include "i_gamepad.h"
+#include "../i_gamepad.h"
 
 // cl loading screen
-#include "v_video.h"
-#include "f_finale.h"
-#include "snake.h"
+#include "../v_video.h"
+#include "../f_finale.h"
+#include "../snake.h"
 
 //
 // NETWORKING
diff --git a/src/d_clisrv.h b/src/netcode/d_clisrv.h
similarity index 99%
rename from src/d_clisrv.h
rename to src/netcode/d_clisrv.h
index 0d6add13a3eb8f91941fea9114de591821eb7b12..50b86e9f01700c45849f50b492b947014238ace1 100644
--- a/src/d_clisrv.h
+++ b/src/netcode/d_clisrv.h
@@ -13,12 +13,12 @@
 #ifndef __D_CLISRV__
 #define __D_CLISRV__
 
-#include "d_ticcmd.h"
+#include "../d_ticcmd.h"
 #include "d_net.h"
 #include "d_netcmd.h"
 #include "d_net.h"
-#include "tables.h"
-#include "d_player.h"
+#include "../tables.h"
+#include "../d_player.h"
 #include "mserv.h"
 
 /*
diff --git a/src/d_net.c b/src/netcode/d_net.c
similarity index 99%
rename from src/d_net.c
rename to src/netcode/d_net.c
index 9e3759d32ce4abbf31649737e230939d56ad630a..ae0605001ac5f4e119901d7e92993e345c62ee6b 100644
--- a/src/d_net.c
+++ b/src/netcode/d_net.c
@@ -16,19 +16,19 @@
 ///        This protocol uses a mix of "goback n" and "selective repeat" implementation
 ///        The NOTHING packet is sent when connection is idle to acknowledge packets
 
-#include "doomdef.h"
-#include "g_game.h"
-#include "i_time.h"
+#include "../doomdef.h"
+#include "../g_game.h"
+#include "../i_time.h"
 #include "i_net.h"
-#include "i_system.h"
-#include "m_argv.h"
+#include "../i_system.h"
+#include "../m_argv.h"
 #include "d_net.h"
-#include "w_wad.h"
+#include "../w_wad.h"
 #include "d_netfil.h"
 #include "d_clisrv.h"
-#include "z_zone.h"
+#include "../z_zone.h"
 #include "i_tcp.h"
-#include "d_main.h" // srb2home
+#include "../d_main.h" // srb2home
 
 //
 // NETWORKING
diff --git a/src/d_net.h b/src/netcode/d_net.h
similarity index 100%
rename from src/d_net.h
rename to src/netcode/d_net.h
diff --git a/src/d_netcmd.c b/src/netcode/d_netcmd.c
similarity index 99%
rename from src/d_netcmd.c
rename to src/netcode/d_netcmd.c
index 69eed90de9f20fd2d1f8863922d013546a038642..ed310805dc9b596a601be887a73144a449b6a2d4 100644
--- a/src/d_netcmd.c
+++ b/src/netcode/d_netcmd.c
@@ -12,44 +12,44 @@
 ///        commands are executed through the command buffer
 ///	       like console commands, other miscellaneous commands (at the end)
 
-#include "doomdef.h"
-
-#include "console.h"
-#include "command.h"
-#include "i_time.h"
-#include "i_system.h"
-#include "g_game.h"
-#include "hu_stuff.h"
-#include "g_input.h"
-#include "i_gamepad.h"
-#include "m_menu.h"
-#include "r_local.h"
-#include "r_skins.h"
-#include "p_local.h"
-#include "p_setup.h"
-#include "s_sound.h"
-#include "i_sound.h"
-#include "m_misc.h"
-#include "am_map.h"
-#include "byteptr.h"
+#include "../doomdef.h"
+
+#include "../console.h"
+#include "../command.h"
+#include "../i_time.h"
+#include "../i_system.h"
+#include "../g_game.h"
+#include "../hu_stuff.h"
+#include "../g_input.h"
+#include "../i_gamepad.h"
+#include "../m_menu.h"
+#include "../r_local.h"
+#include "../r_skins.h"
+#include "../p_local.h"
+#include "../p_setup.h"
+#include "../s_sound.h"
+#include "../i_sound.h"
+#include "../m_misc.h"
+#include "../am_map.h"
+#include "../byteptr.h"
 #include "d_netfil.h"
-#include "p_spec.h"
-#include "m_cheat.h"
+#include "../p_spec.h"
+#include "../m_cheat.h"
 #include "d_clisrv.h"
 #include "d_net.h"
-#include "v_video.h"
-#include "d_main.h"
-#include "m_random.h"
-#include "f_finale.h"
-#include "filesrch.h"
+#include "../v_video.h"
+#include "../d_main.h"
+#include "../m_random.h"
+#include "../f_finale.h"
+#include "../filesrch.h"
 #include "mserv.h"
-#include "z_zone.h"
-#include "lua_script.h"
-#include "lua_hook.h"
-#include "m_cond.h"
-#include "m_anigif.h"
-#include "md5.h"
-#include "m_perfstats.h"
+#include "../z_zone.h"
+#include "../lua_script.h"
+#include "../lua_hook.h"
+#include "../m_cond.h"
+#include "../m_anigif.h"
+#include "../md5.h"
+#include "../m_perfstats.h"
 
 #ifdef NETGAME_DEVMODE
 #define CV_RESTRICT CV_NETVAR
diff --git a/src/d_netcmd.h b/src/netcode/d_netcmd.h
similarity index 99%
rename from src/d_netcmd.h
rename to src/netcode/d_netcmd.h
index 47f68a17e9d8f3f73a7196062ba533791689a3cd..797a686a785b007d083875603c51dab60ef0875d 100644
--- a/src/d_netcmd.h
+++ b/src/netcode/d_netcmd.h
@@ -15,7 +15,7 @@
 #ifndef __D_NETCMD__
 #define __D_NETCMD__
 
-#include "command.h"
+#include "../command.h"
 
 // console vars
 extern consvar_t cv_playername;
diff --git a/src/d_netfil.c b/src/netcode/d_netfil.c
similarity index 99%
rename from src/d_netfil.c
rename to src/netcode/d_netfil.c
index bf3952cc92c694ea922aead26b9753ee5016d216..80fa068529cf8000f215f434242f9fb28e2473fa 100644
--- a/src/d_netfil.c
+++ b/src/netcode/d_netfil.c
@@ -31,24 +31,24 @@
 #include <sys/utime.h>
 #endif
 
-#include "doomdef.h"
-#include "doomstat.h"
-#include "d_main.h"
-#include "g_game.h"
-#include "i_time.h"
+#include "../doomdef.h"
+#include "../doomstat.h"
+#include "../d_main.h"
+#include "../g_game.h"
+#include "../i_time.h"
 #include "i_net.h"
-#include "i_system.h"
-#include "m_argv.h"
+#include "../i_system.h"
+#include "../m_argv.h"
 #include "d_net.h"
-#include "w_wad.h"
+#include "../w_wad.h"
 #include "d_netfil.h"
-#include "z_zone.h"
-#include "byteptr.h"
-#include "p_setup.h"
-#include "m_misc.h"
-#include "m_menu.h"
-#include "md5.h"
-#include "filesrch.h"
+#include "../z_zone.h"
+#include "../byteptr.h"
+#include "../p_setup.h"
+#include "../m_misc.h"
+#include "../m_menu.h"
+#include "../md5.h"
+#include "../filesrch.h"
 
 #include <errno.h>
 
diff --git a/src/d_netfil.h b/src/netcode/d_netfil.h
similarity index 99%
rename from src/d_netfil.h
rename to src/netcode/d_netfil.h
index ec53be58793b2dabc98511239f16820be73bab46..732efcd5ec7999fb87641edeb61cb0fb7ae59e5f 100644
--- a/src/d_netfil.h
+++ b/src/netcode/d_netfil.h
@@ -15,7 +15,7 @@
 
 #include "d_net.h"
 #include "d_clisrv.h"
-#include "w_wad.h"
+#include "../w_wad.h"
 
 typedef enum
 {
diff --git a/src/http-mserv.c b/src/netcode/http-mserv.c
similarity index 98%
rename from src/http-mserv.c
rename to src/netcode/http-mserv.c
index b0ef37fa169bf8857e70b4497fa769eafb652ddf..72dc1cafb2f5f398fe4a083f8de8c1eddea62dd3 100644
--- a/src/http-mserv.c
+++ b/src/netcode/http-mserv.c
@@ -18,14 +18,14 @@ Documentation available here.
 #include <curl/curl.h>
 #endif
 
-#include "doomdef.h"
+#include "../doomdef.h"
 #include "d_clisrv.h"
-#include "command.h"
-#include "m_argv.h"
-#include "m_menu.h"
+#include "../command.h"
+#include "../m_argv.h"
+#include "../m_menu.h"
 #include "mserv.h"
 #include "i_tcp.h"/* for current_port */
-#include "i_threads.h"
+#include "../i_threads.h"
 
 /* reasonable default I guess?? */
 #define DEFAULT_BUFFER_SIZE (4096)
diff --git a/src/i_addrinfo.c b/src/netcode/i_addrinfo.c
similarity index 100%
rename from src/i_addrinfo.c
rename to src/netcode/i_addrinfo.c
diff --git a/src/i_addrinfo.h b/src/netcode/i_addrinfo.h
similarity index 100%
rename from src/i_addrinfo.h
rename to src/netcode/i_addrinfo.h
diff --git a/src/i_net.h b/src/netcode/i_net.h
similarity index 98%
rename from src/i_net.h
rename to src/netcode/i_net.h
index 62b7528d59f0bcf6877f55ab467687fc7a55dad5..66126d050348ae23034ecfe9efa15c0a035c3214 100644
--- a/src/i_net.h
+++ b/src/netcode/i_net.h
@@ -18,8 +18,8 @@
 #pragma interface
 #endif
 
-#include "doomdef.h"
-#include "command.h"
+#include "../doomdef.h"
+#include "../command.h"
 
 /// \brief program net id
 #define DOOMCOM_ID (INT32)0x12345678l
diff --git a/src/i_tcp.c b/src/netcode/i_tcp.c
similarity index 99%
rename from src/i_tcp.c
rename to src/netcode/i_tcp.c
index ec3d1ae93a639edaa68d35348621dbae5677ef86..6baba6275d66fe410035e7ee3b4891ba92027e2a 100644
--- a/src/i_tcp.c
+++ b/src/netcode/i_tcp.c
@@ -36,7 +36,7 @@
 	#include <ws2tcpip.h>
 #endif
 
-#include "doomdef.h"
+#include "../doomdef.h"
 
 #ifdef USE_WINSOCK1
 	#include <winsock.h>
@@ -122,14 +122,14 @@ typedef union
 
 #define MAXBANS 100
 
-#include "i_system.h"
+#include "../i_system.h"
 #include "i_net.h"
 #include "d_net.h"
 #include "d_netfil.h"
 #include "i_tcp.h"
-#include "m_argv.h"
+#include "../m_argv.h"
 
-#include "doomstat.h"
+#include "../doomstat.h"
 
 // win32
 #ifdef USE_WINSOCK
diff --git a/src/i_tcp.h b/src/netcode/i_tcp.h
similarity index 100%
rename from src/i_tcp.h
rename to src/netcode/i_tcp.h
diff --git a/src/mserv.c b/src/netcode/mserv.c
similarity index 98%
rename from src/mserv.c
rename to src/netcode/mserv.c
index 90091d24156567937cee6c3f23212bcd02bb099b..78301f4d982bf1a532c3812b05db99c354d96e73 100644
--- a/src/mserv.c
+++ b/src/netcode/mserv.c
@@ -15,13 +15,13 @@
 #include <time.h>
 #endif
 
-#include "doomstat.h"
-#include "doomdef.h"
-#include "command.h"
-#include "i_threads.h"
+#include "../doomstat.h"
+#include "../doomdef.h"
+#include "../command.h"
+#include "../i_threads.h"
 #include "mserv.h"
-#include "m_menu.h"
-#include "z_zone.h"
+#include "../m_menu.h"
+#include "../z_zone.h"
 
 #ifdef MASTERSERVER
 
diff --git a/src/mserv.h b/src/netcode/mserv.h
similarity index 99%
rename from src/mserv.h
rename to src/netcode/mserv.h
index 23b26fbc54670fff4d5e2673dcd742c8bf0e950c..7fdf3ed1b90dfe1805b217f43fec9aa1edaf6ed6 100644
--- a/src/mserv.h
+++ b/src/netcode/mserv.h
@@ -14,7 +14,7 @@
 #ifndef _MSERV_H_
 #define _MSERV_H_
 
-#include "i_threads.h"
+#include "../i_threads.h"
 
 // lowered from 32 due to menu changes
 #define NUM_LIST_ROOMS 16
diff --git a/src/p_ceilng.c b/src/p_ceilng.c
index 66f2dd58ecfba7e346d746166f31f8edb942c77a..949eeddf2ec373f0809eb643693d0ba78b596688 100644
--- a/src/p_ceilng.c
+++ b/src/p_ceilng.c
@@ -17,7 +17,7 @@
 #include "r_main.h"
 #include "s_sound.h"
 #include "z_zone.h"
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 
 // ==========================================================================
 //                              CEILINGS
diff --git a/src/p_haptic.c b/src/p_haptic.c
index dbfa587379edbd32f9196b7501273fd6811ed596..4d22fbd777616a0b92b71e3d97aa3b78a1cbab3a 100644
--- a/src/p_haptic.c
+++ b/src/p_haptic.c
@@ -11,7 +11,7 @@
 
 #include "p_haptic.h"
 #include "g_game.h"
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 #include "i_gamepad.h"
 #include "doomstat.h"
 
diff --git a/src/p_lights.c b/src/p_lights.c
index 4c783f884edd5f322dd86e1e7270e462f757383a..a1f4de853f05ac3d894e5286980beaf74ae3fe92 100644
--- a/src/p_lights.c
+++ b/src/p_lights.c
@@ -17,7 +17,7 @@
 #include "r_state.h"
 #include "z_zone.h"
 #include "m_random.h"
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 
 /** Removes any active lighting effects in a sector.
   *
diff --git a/src/p_user.c b/src/p_user.c
index 6fd24eb13cf6df7d345d2e9f64d710e3ff3763c2..1e8dee885eaf5d34c42f0abbc32e7f274ac66431 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -18,7 +18,7 @@
 #include "doomdef.h"
 #include "i_system.h"
 #include "d_event.h"
-#include "d_net.h"
+#include "netcode/d_net.h"
 #include "g_game.h"
 #include "p_local.h"
 #include "r_fps.h"
diff --git a/src/r_segs.c b/src/r_segs.c
index 43a7f945fd37bdfde19ed0857a24f402270a7fda..704f333342a70c0170ce474e0139c9fcfc78fe48 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -20,7 +20,7 @@
 
 #include "w_wad.h"
 #include "z_zone.h"
-#include "d_netcmd.h"
+#include "netcode/d_netcmd.h"
 #include "m_misc.h"
 #include "p_local.h" // Camera...
 #include "p_slopes.h"
diff --git a/src/r_things.c b/src/r_things.c
index fed873fd6d37c3a33cfbd5a5e25022b6e5df883c..a466def7007eb26246051949410fb167de5912db 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -34,7 +34,7 @@
 #include "p_tick.h"
 #include "p_local.h"
 #include "p_slopes.h"
-#include "d_netfil.h" // blargh. for nameonly().
+#include "netcode/d_netfil.h" // blargh. for nameonly().
 #include "m_cheat.h" // objectplace
 #ifdef HWRENDER
 #include "hardware/hw_md2.h"
diff --git a/src/screen.c b/src/screen.c
index e984f9ee5617d992c3e0d1bc33eed23f21928950..00895f013b66ed584555f2d9651fdc79a09d76b4 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -27,7 +27,7 @@
 #include "hu_stuff.h"
 #include "z_zone.h"
 #include "d_main.h"
-#include "d_clisrv.h"
+#include "netcode/d_clisrv.h"
 #include "f_finale.h"
 #include "y_inter.h" // usebuffer
 #include "i_sound.h" // closed captions
diff --git a/src/sdl/i_gamepad.c b/src/sdl/i_gamepad.c
index ecde251fba5e92812a925bbfb0fd95adc2f50fc2..f27504f7667a225beccdfd15a21da4de6b03c082 100644
--- a/src/sdl/i_gamepad.c
+++ b/src/sdl/i_gamepad.c
@@ -15,7 +15,7 @@
 #include "../i_system.h"
 #include "../doomdef.h"
 #include "../d_main.h"
-#include "../d_netcmd.h"
+#include "../netcode/d_netcmd.h"
 #include "../g_game.h"
 #include "../m_argv.h"
 #include "../m_menu.h"
diff --git a/src/sdl/i_net.c b/src/sdl/i_net.c
index ee4a34c13dd8d4d10950d53d972d0cf873068943..515a855684e1e3d13dce6d35a785a2c7d07c9e93 100644
--- a/src/sdl/i_net.c
+++ b/src/sdl/i_net.c
@@ -21,16 +21,16 @@
 
 #include "../i_system.h"
 #include "../d_event.h"
-#include "../d_net.h"
+#include "../netcode/d_net.h"
 #include "../m_argv.h"
 
 #include "../doomstat.h"
 
-#include "../i_net.h"
+#include "../netcode/i_net.h"
 
 #include "../z_zone.h"
 
-#include "../i_tcp.h"
+#include "../netcode/i_tcp.h"
 
 #ifdef HAVE_SDL
 
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index d08f3ff33f3c5666a1708af476df58b5dfa78cf5..7684045fcee014e3bd36fd6773e9febfe5717c98 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -188,7 +188,7 @@ static char returnWadPath[256];
 #include "../i_gamepad.h"
 #include "../i_threads.h"
 #include "../screen.h" //vid.WndParent
-#include "../d_net.h"
+#include "../netcode/d_net.h"
 #include "../g_game.h"
 #include "../filesrch.h"
 #include "endtxt.h"
@@ -207,7 +207,7 @@ static char returnWadPath[256];
 
 #if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
 // Mumble context string
-#include "../d_clisrv.h"
+#include "../netcode/d_clisrv.h"
 #include "../byteptr.h"
 #endif
 
diff --git a/src/sdl/i_ttf.c b/src/sdl/i_ttf.c
index f2cd497eec03f24a6e3088e7e4f64e0925e16cc1..1f838e9b46267dfc5adec7f1f75541bf7765754b 100644
--- a/src/sdl/i_ttf.c
+++ b/src/sdl/i_ttf.c
@@ -21,7 +21,7 @@
 #include "SDL_ttf.h"
 #include "../doomdef.h"
 #include "../doomstat.h"
-#include "../d_netfil.h"
+#include "../netcode/d_netfil.h"
 #include "../filesrch.h"
 #include "i_ttf.h"
 
diff --git a/src/w_wad.c b/src/w_wad.c
index 42c6bf83be9e7dd8a89e67aee6aa7373d96bc53e..1e64cf09362b9717661c0b6c579c19cb63e7c2b5 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -51,8 +51,8 @@
 #include "filesrch.h"
 
 #include "d_main.h"
-#include "d_netfil.h"
-#include "d_clisrv.h"
+#include "netcode/d_netfil.h"
+#include "netcode/d_clisrv.h"
 #include "dehacked.h"
 #include "r_defs.h"
 #include "r_data.h"
diff --git a/src/y_inter.c b/src/y_inter.c
index 7faceff50ecd627011da0dd7b36d289a7ef0c4ac..de757ec7045a8cf06a1c0e376a35603f325eec60 100644
--- a/src/y_inter.c
+++ b/src/y_inter.c
@@ -15,7 +15,7 @@
 #include "f_finale.h"
 #include "g_game.h"
 #include "hu_stuff.h"
-#include "i_net.h"
+#include "netcode/i_net.h"
 #include "i_video.h"
 #include "p_tick.h"
 #include "r_defs.h"