diff --git a/Bin/DLL/NetworkAPI_x86D.pdb b/Bin/DLL/NetworkAPI_x86D.pdb deleted file mode 100644 index 39d11475..00000000 Binary files a/Bin/DLL/NetworkAPI_x86D.pdb and /dev/null differ diff --git a/Bin/DLL/OysterGraphics_x64.pdb b/Bin/DLL/OysterGraphics_x64.pdb index bb6604e9..a7820235 100644 Binary files a/Bin/DLL/OysterGraphics_x64.pdb and b/Bin/DLL/OysterGraphics_x64.pdb differ diff --git a/Code/DanBias.sln b/Code/DanBias.sln index 894caec6..f658a0ec 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -54,122 +54,122 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Release|x64 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Build.0 = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Debug|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Debug|x64 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.Build.0 = Release|x64 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.Build.0 = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Win32.ActiveCfg = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Win32.Build.0 = Release|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|x64.ActiveCfg = Release|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|x64.Build.0 = Release|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.Build.0 = Release|x64 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.Build.0 = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Build.0 = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Debug|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Debug|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.Build.0 = Release|x64 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.Build.0 = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Win32.ActiveCfg = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Win32.Build.0 = Release|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|x64.ActiveCfg = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|x64.Build.0 = Release|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.Build.0 = Release|x64 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.Build.0 = Release|Win32 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.ActiveCfg = Debug|Win32 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.Build.0 = Debug|Win32 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.ActiveCfg = Debug|x64 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.Build.0 = Debug|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.Build.0 = Release|x64 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.Build.0 = Release|Win32 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Win32.ActiveCfg = Release|Win32 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Win32.Build.0 = Release|Win32 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|x64.ActiveCfg = Release|x64 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|x64.Build.0 = Release|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.Build.0 = Release|x64 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.Build.0 = Release|Win32 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.ActiveCfg = Debug|Win32 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.Build.0 = Debug|Win32 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.ActiveCfg = Debug|x64 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.Build.0 = Debug|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.Build.0 = Release|x64 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.Build.0 = Release|Win32 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Win32.ActiveCfg = Release|Win32 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Win32.Build.0 = Release|Win32 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|x64.ActiveCfg = Release|x64 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|x64.Build.0 = Release|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Release|x64 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Release|Win32 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.Build.0 = Debug|Win32 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Debug|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Debug|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.Build.0 = Release|x64 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.Build.0 = Release|Win32 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Win32.ActiveCfg = Release|Win32 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Win32.Build.0 = Release|Win32 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|x64.ActiveCfg = Release|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|x64.Build.0 = Release|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.Build.0 = Release|x64 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.Build.0 = Release|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.ActiveCfg = Debug|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.Build.0 = Debug|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.ActiveCfg = Debug|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.Build.0 = Debug|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.Build.0 = Release|x64 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.Build.0 = Release|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Win32.ActiveCfg = Release|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Win32.Build.0 = Release|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|x64.ActiveCfg = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|x64.Build.0 = Release|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.Build.0 = Release|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.Build.0 = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Win32.ActiveCfg = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Win32.Build.0 = Release|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|x64.ActiveCfg = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|x64.Build.0 = Release|x64 - {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.Build.0 = Release|x64 + {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Mixed Platforms.Build.0 = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.ActiveCfg = Debug|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|Win32.Build.0 = Debug|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.ActiveCfg = Debug|x64 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Debug|x64.Build.0 = Debug|x64 - {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.Build.0 = Release|x64 + {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Mixed Platforms.Build.0 = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Win32.ActiveCfg = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|Win32.Build.0 = Release|Win32 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|x64.ActiveCfg = Release|x64 {838B25C2-D19E-49FE-8CB0-9A977CA3C7E8}.Release|x64.Build.0 = Release|x64 - {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.Build.0 = Release|x64 + {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Mixed Platforms.Build.0 = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.ActiveCfg = Debug|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|Win32.Build.0 = Debug|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.ActiveCfg = Debug|x64 {6A066806-F43F-4B31-A4E3-57179674F460}.Debug|x64.Build.0 = Debug|x64 - {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.Build.0 = Release|x64 + {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Mixed Platforms.Build.0 = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Win32.ActiveCfg = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|Win32.Build.0 = Release|Win32 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|x64.ActiveCfg = Release|x64 {6A066806-F43F-4B31-A4E3-57179674F460}.Release|x64.Build.0 = Release|x64 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.Build.0 = Release|x64 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Mixed Platforms.Build.0 = Release|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.ActiveCfg = Debug|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|Win32.Build.0 = Debug|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.ActiveCfg = Debug|x64 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Debug|x64.Build.0 = Debug|x64 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.Build.0 = Release|x64 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Mixed Platforms.Build.0 = Release|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Win32.ActiveCfg = Release|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|Win32.Build.0 = Release|Win32 {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|x64.ActiveCfg = Release|x64 @@ -263,7 +263,8 @@ Global {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Mixed Platforms.Build.0 = Release|Win32 {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Win32.ActiveCfg = Release|Win32 {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Win32.Build.0 = Release|Win32 - {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|x64.ActiveCfg = Release|Win32 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|x64.ActiveCfg = Release|x64 + {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj index ff05bc23..bdec78cb 100644 --- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj +++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj @@ -71,32 +71,32 @@ $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath) + $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include true $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - $(SolutionDir)..\External\Include\;$(IncludePath) + $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(SolutionDir)..\External\Include\;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include false $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - $(SolutionDir)..\External\Include\;$(IncludePath) + $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)..\External\Include\;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include false $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - $(SolutionDir)..\External\Include\;$(IncludePath) + $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(SolutionDir)..\External\Include\;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index cd2842e6..803c97c0 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -31,33 +31,55 @@ namespace DanBias { int pType = p[0].value.netInt; - Client::GameClientState::ProtocolStruct* protocolData; + //Client::GameClientState::ProtocolStruct* protocolData; switch (pType) { - case protocol_PlayerNavigation: - - break; - case protocol_PlayerPosition: - protocolData = new Client::GameClientState::PlayerPos; - for(int i = 0; i< 3; i++) + case protocol_Gamplay_PlayerNavigation: { - ((Client::GameClientState::PlayerPos*)protocolData)->playerPos[i] = p[i].value.netFloat; + + + Client::GameClientState::KeyInput* protocolData = new Client::GameClientState::KeyInput; + for(int i = 0; i< 6; i++) + { + protocolData->key[i] = p[i+1].value.netBool; + } + + ((Client::GameState*)gameClientState)->Protocol(protocolData); + delete protocolData; + protocolData = NULL; + } + break; + case protocol_Gamplay_PlayerPosition: + { + Client::GameClientState::PlayerPos* protocolData = new Client::GameClientState::PlayerPos; + for(int i = 0; i< 3; i++) + { + protocolData->playerPos[i] = p[i].value.netFloat; + } + //if(dynamic_cast(gameClientState)) + gameClientState->Protocol(protocolData); + delete protocolData; + protocolData = NULL; } - gameClientState->Protocol(protocolData); - delete protocolData; - protocolData = NULL; break; - case protocol_ObjectPosition: - protocolData = new Client::GameClientState::ObjPos; - for(int i = 0; i< 16; i++) + case protocol_Gamplay_ObjectPosition: { - ((Client::GameClientState::ObjPos*)protocolData)->worldPos[i] = p[i].value.netFloat; + + Client::GameClientState::ObjPos* protocolData = new Client::GameClientState::ObjPos; + protocolData->object_ID = p[1].value.netInt; + for(int i = 0; i< 16; i++) + { + protocolData->worldPos[i] = p[i+2].value.netFloat; + } + + + gameClientState->Protocol(protocolData); + + delete protocolData; + protocolData = NULL; } - gameClientState->Protocol(protocolData); - delete protocolData; - protocolData = NULL; break; default: @@ -79,9 +101,9 @@ namespace DanBias } public: - Client::GameClientState* gameClientState; + //Client::GameClientState* gameClientState; InputClass* inputObj; - MyRecieverObject* r; + MyRecieverObject* recieverObj; } data; #pragma endregion @@ -110,17 +132,19 @@ namespace DanBias prevTimeStamp = 0; QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp); - m_data->r = new MyRecieverObject; - m_data->r->nwClient = new Oyster::Network::NetworkClient(); - m_data->r->nwClient->Connect(desc.port, desc.IP); - if (!m_data->r->nwClient->IsConnected()) + m_data->recieverObj = new MyRecieverObject; + + m_data->recieverObj->nwClient = new Oyster::Network::NetworkClient(m_data->recieverObj, Oyster::Network::NetworkProtocolCallbackType_Object); + m_data->recieverObj->nwClient->Connect(desc.port, desc.IP); + + if (!m_data->recieverObj->nwClient->IsConnected()) { // failed to connect return DanBiasClientReturn_Error; } // Start in lobby state - m_data->gameClientState = new Client::LobbyState(); - m_data->gameClientState->Init(m_data->r->nwClient); + m_data->recieverObj->gameClientState = new Client::LobbyState(); + m_data->recieverObj->gameClientState->Init(m_data->recieverObj->nwClient); return DanBiasClientReturn_Sucess; @@ -237,27 +261,27 @@ namespace DanBias m_data->inputObj->Update(); DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same; - state = m_data->gameClientState->Update(deltaTime, m_data->inputObj); + state = m_data->recieverObj->gameClientState->Update(deltaTime, m_data->inputObj); if(state != Client::GameClientState::ClientState_Same) { - m_data->gameClientState->Release(); - delete m_data->gameClientState; - m_data->gameClientState = NULL; + m_data->recieverObj->gameClientState->Release(); + delete m_data->recieverObj->gameClientState; + m_data->recieverObj->gameClientState = NULL; switch (state) { case Client::GameClientState::ClientState_Lobby: - m_data->gameClientState = new Client::LobbyState(); + m_data->recieverObj->gameClientState = new Client::LobbyState(); break; case Client::GameClientState::ClientState_Game: - m_data->gameClientState = new Client::GameState(); + m_data->recieverObj->gameClientState = new Client::GameState(); break; default: return E_FAIL; break; } - m_data->gameClientState->Init(m_data->r->nwClient); // send game client + m_data->recieverObj->gameClientState->Init(m_data->recieverObj->nwClient); // send game client } return S_OK; @@ -275,15 +299,18 @@ namespace DanBias swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed)); SetWindowText(g_hWnd, title); - m_data->gameClientState->Render(); + m_data->recieverObj->gameClientState->Render(); return S_OK; } HRESULT DanBiasGame::CleanUp() { - m_data->gameClientState->Release(); - delete m_data->gameClientState; + m_data->recieverObj->gameClientState->Release(); + delete m_data->recieverObj->gameClientState; + m_data->recieverObj->nwClient->Disconnect(); + delete m_data->recieverObj->nwClient; + delete m_data->recieverObj; delete m_data->inputObj; delete m_data; diff --git a/Code/Game/DanBiasGame/GameClientState/C_Object.h b/Code/Game/DanBiasGame/GameClientState/C_Object.h index 8bfecdb9..18859930 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_Object.h +++ b/Code/Game/DanBiasGame/GameClientState/C_Object.h @@ -20,7 +20,7 @@ private: public: virtual void Init(ModelInitData modelInit) = 0; - virtual void setPos() = 0; + virtual void setPos(Oyster::Math::Float4x4 world) = 0; virtual void Render() = 0; virtual void Release() = 0; diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp index 686bbca9..a4ae4840 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp @@ -26,9 +26,9 @@ void C_DynamicObj::Init(ModelInitData modelInit) privData->model->WorldMatrix = modelInit.world; privData->model->Visible = modelInit.visible; } -void C_DynamicObj::setPos() +void C_DynamicObj::setPos(Oyster::Math::Float4x4 world) { - + privData->model->WorldMatrix = world; } void C_DynamicObj::Render() diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h index ca0f3b8c..e0ad3be3 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h @@ -14,7 +14,7 @@ public: C_DynamicObj(void); virtual ~C_DynamicObj(void); void Init(ModelInitData modelInit); - void setPos(); + void setPos(Oyster::Math::Float4x4 world); void Render(); void Release(); diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp index e47d98ef..5fb06d96 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp @@ -30,9 +30,9 @@ void C_Player::Init(ModelInitData modelInit) } -void C_Player::setPos() +void C_Player::setPos(Oyster::Math::Float4x4 world) { - + privData->model->WorldMatrix = world; } void C_Player::Render() diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h index 5d9c9d59..638bd856 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h @@ -15,7 +15,7 @@ public: C_Player(void); ~C_Player(void); void Init(ModelInitData modelInit); - void setPos(); + void setPos(Oyster::Math::Float4x4 world); void Render(); void Release(); diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp index 54c36c2a..f96ea56d 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp @@ -29,9 +29,9 @@ void C_StaticObj::Init(ModelInitData modelInit) privData->model->Visible = modelInit.visible; } -void C_StaticObj::setPos() +void C_StaticObj::setPos(Oyster::Math::Float4x4 world) { - + privData->model->WorldMatrix = world; } void C_StaticObj::Render() diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h index 768344f0..84fc0599 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h @@ -14,7 +14,7 @@ public: C_StaticObj(void); virtual ~C_StaticObj(void); void Init(ModelInitData modelInit); - void setPos(); + void setPos(Oyster::Math::Float4x4 world); void Render(); void Release(); diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp index b07ec6fa..5adc3962 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp @@ -27,9 +27,9 @@ void C_UIobject::Init(ModelInitData modelInit) privData->model->Visible = modelInit.visible; } -void C_UIobject::setPos() +void C_UIobject::setPos(Oyster::Math::Float4x4 world) { - + privData->model->WorldMatrix = world; } void C_UIobject::Render() diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h index 203b5398..e82b702f 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h @@ -14,7 +14,7 @@ namespace DanBias C_UIobject(void); virtual ~C_UIobject(void); void Init(ModelInitData modelInit); - void setPos(); + void setPos(Oyster::Math::Float4x4 world); void Render(); void Release(); diff --git a/Code/Game/DanBiasGame/GameClientState/GameClientState.h b/Code/Game/DanBiasGame/GameClientState/GameClientState.h index 368fca6a..e9cda411 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameClientState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameClientState.h @@ -19,8 +19,13 @@ public: }; struct ObjPos :public ProtocolStruct { + int object_ID; float worldPos[16]; }; + struct KeyInput :public ProtocolStruct + { + bool key[6]; + }; struct PlayerPos :public ProtocolStruct { float playerPos[3]; diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 588e6ab8..40f46156 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -91,8 +91,8 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI case gameStateState_playing: // read server data // update objects - // Client.send(obj); { + bool send = false; GameLogic::Protocol_PlayerMovement movePlayer; movePlayer.bForward = false; movePlayer.bBackward = false; @@ -105,23 +105,31 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI if(KeyInput->IsKeyPressed(DIK_W)) { movePlayer.bForward = true; + send = true; } if(KeyInput->IsKeyPressed(DIK_S)) { movePlayer.bBackward = true; + send = true; } if(KeyInput->IsKeyPressed(DIK_A)) { movePlayer.bStrafeLeft = true; + send = true; } if(KeyInput->IsKeyPressed(DIK_D)) { movePlayer.bStrafeRight = true; + send = true; + } + + if (privData->nwClient->IsConnected() && send) + { + privData->nwClient->Send(movePlayer); } - - - privData->nwClient->Send(movePlayer); - + + // send event data + // if(KeyInput->IsKeyPressed(DIK_L)) privData->state = GameState::gameStateState_end; } @@ -164,17 +172,64 @@ bool GameState::Release() void GameState::Protocol(ProtocolStruct* pos) { + // move message + /* + if ((KeyInput*)pos) + { + } if((ObjPos*)pos) ObjectPosProtocol((ObjPos*)pos); else if((PlayerPos*)pos) - PlayerPosProtocol((PlayerPos*)pos); + PlayerPosProtocol((PlayerPos*)pos);*/ } + +void GameState::Protocol( PlayerPos* pos ) +{ + Oyster::Math::Float4x4 world, translate; + + world = Oyster::Math::Float4x4::identity; + translate = Oyster::Math::Float4x4::identity; + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(pos->playerPos[0],pos->playerPos[1],pos->playerPos[2])); + world = world * translate; + privData->object[0]->setPos( world ); +} + +void GameState::Protocol( ObjPos* pos ) +{ + Oyster::Math::Float4x4 world; + for(int i = 0; i<16; i++) + { + world[i] = pos->worldPos[i]; + } + privData->object[pos->object_ID]->setPos(world); +} + +void GameState::Protocol( KeyInput* pos ) +{ + bool key = false; + for (int i = 0; i < 6; i++) + { + key = pos->key[i]; + } +} + void GameState::PlayerPosProtocol(PlayerPos* pos) { + Oyster::Math::Float4x4 world, translate; + world = Oyster::Math::Float4x4::identity; + translate = Oyster::Math::Float4x4::identity; + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(pos->playerPos[0],pos->playerPos[1],pos->playerPos[2] )); + world = translate; + privData->object[0]->setPos( world ); } void GameState::ObjectPosProtocol(ObjPos* pos) { - + Oyster::Math::Float4x4 world; + for(int i = 0; i<16; i++) + { + world[i] = pos->worldPos[i]; + } + privData->object[1]->setPos(world); } //void GameState::Protocol(LightPos pos); \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.h b/Code/Game/DanBiasGame/GameClientState/GameState.h index 05f9ac3d..5ef9623d 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameState.h @@ -32,6 +32,9 @@ public: bool Release()override; void Protocol(ProtocolStruct* pos)override; + void Protocol(PlayerPos* pos); + void Protocol(ObjPos* pos); + void Protocol(KeyInput* pos); void PlayerPosProtocol(PlayerPos* pos); void ObjectPosProtocol(ObjPos* pos); //void Protocol(LightPos pos); diff --git a/Code/Game/DanBiasLauncher/Launcher.cpp b/Code/Game/DanBiasLauncher/Launcher.cpp index 8ae0f29c..a8a39eee 100644 --- a/Code/Game/DanBiasLauncher/Launcher.cpp +++ b/Code/Game/DanBiasLauncher/Launcher.cpp @@ -5,7 +5,6 @@ #include #include - //#include "DanBiasServerAPI.h" #include "DanBiasGame.h" @@ -29,8 +28,8 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh } // Game client starter code goes here DanBias::DanBiasGameDesc gameDesc; - gameDesc.port = 1; - gameDesc.IP = "10.1010.303"; + gameDesc.port = 15151; + gameDesc.IP = "193.11.186.101"; gameDesc.hinst = hinst; gameDesc.nCmdShow = cmdShow; diff --git a/Code/Game/DanBiasServer/GameServer.cpp b/Code/Game/DanBiasServer/GameServer.cpp index c0601b30..cb5a7ae3 100644 --- a/Code/Game/DanBiasServer/GameServer.cpp +++ b/Code/Game/DanBiasServer/GameServer.cpp @@ -18,7 +18,7 @@ namespace DanBias using namespace Oyster::Network; - void GameServer::ClientConnectCallback(NetworkClient& client) + void GameServer::ClientConnectCallback(NetworkClient* client) { printf("Client connected!\n"); diff --git a/Code/Game/DanBiasServer/GameServer.h b/Code/Game/DanBiasServer/GameServer.h index 4045295f..251aab7a 100644 --- a/Code/Game/DanBiasServer/GameServer.h +++ b/Code/Game/DanBiasServer/GameServer.h @@ -23,7 +23,7 @@ namespace DanBias private: //static void ClientConnectCallbackFunction(Oyster::Network::NetworkClient& connectedClient); - void ClientConnectCallback(Oyster::Network::NetworkClient& client) override; + void ClientConnectCallback(Oyster::Network::NetworkClient* client) override; bool initiated; bool running; diff --git a/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp b/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp index 638d8237..c8a259ad 100644 --- a/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp +++ b/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp @@ -2,15 +2,15 @@ using namespace DanBias; -ClientObject::ClientObject(const Oyster::Network::NetworkClient& client) +ClientObject::ClientObject(Oyster::Network::NetworkClient* client) { this->client = client; - this->client.SetRecieverObject(this, Oyster::Network::NetworkProtocolCallbackType_Object); + this->client->SetRecieverObject(this, Oyster::Network::NetworkProtocolCallbackType_Object); this->box = 0; } ClientObject::~ClientObject() { - this->client.Disconnect(); + this->client->Disconnect(); } void ClientObject::SetPostbox(Oyster::PostBox* box) @@ -23,11 +23,12 @@ GameLogic::Player* ClientObject::Logic_Object() } Oyster::Network::NetworkClient* ClientObject::NetClient_Object() { - return &this->client; + return this->client; } void ClientObject::ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol) { + //this->client->Send(&protocol); if(!this->box) return; NetworkSession::NetEvent _event; diff --git a/Code/Game/DanBiasServer/ServerObjects/ClientObject.h b/Code/Game/DanBiasServer/ServerObjects/ClientObject.h index 7a69eb94..f44e70d0 100644 --- a/Code/Game/DanBiasServer/ServerObjects/ClientObject.h +++ b/Code/Game/DanBiasServer/ServerObjects/ClientObject.h @@ -13,7 +13,7 @@ namespace DanBias :public Oyster::Network::ProtocolRecieverObject { public: - ClientObject(const Oyster::Network::NetworkClient& client); + ClientObject(Oyster::Network::NetworkClient* client); ~ClientObject(); void SetPostbox(Oyster::PostBox* box); @@ -26,7 +26,7 @@ namespace DanBias private: GameLogic::Player logicPlayer; - Oyster::Network::NetworkClient client; + Utility::DynamicMemory::SmartPointer client; Oyster::IPostBox* box; }; diff --git a/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp b/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp index c33af5e0..1e64642d 100644 --- a/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp +++ b/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp @@ -3,6 +3,8 @@ #include "NetworkSession.h" #include +static std::mutex ClientListLock; + namespace DanBias { NetworkSession::NetworkSession() @@ -16,16 +18,27 @@ namespace DanBias void NetworkSession::AttachClient(Utility::DynamicMemory::SmartPointer client) { - for (unsigned int i = 0; i < this->clients.size(); i++) + while (!ClientListLock.try_lock()); //Possible Deadlock + + int k = -1; + for (unsigned int i = 0; (k == -1) && i < this->clients.size(); i++) { if(!this->clients[i]) - { - this->clients[i] = client; - this->clients[i]->SetPostbox(&this->box); - return; - } + k = i; } - this->clients.push_back(client); + + if(k == -1) + { + this->clients.push_back(client); + this->clients[this->clients.size() - 1]->SetPostbox(&this->box); + } + else + { + this->clients[k]->SetPostbox(&this->box); + } + + ClientListLock.unlock(); + } void NetworkSession::DetachClient(Oyster::Network::NetworkClient* client) diff --git a/Code/Game/GameProtocols/GameProtocols.vcxproj b/Code/Game/GameProtocols/GameProtocols.vcxproj index 4b0d7c39..12584afb 100644 --- a/Code/Game/GameProtocols/GameProtocols.vcxproj +++ b/Code/Game/GameProtocols/GameProtocols.vcxproj @@ -154,7 +154,6 @@ - diff --git a/Code/Game/GameProtocols/ObjectProtocols.h b/Code/Game/GameProtocols/ObjectProtocols.h index 101c5f42..2d2118bb 100644 --- a/Code/Game/GameProtocols/ObjectProtocols.h +++ b/Code/Game/GameProtocols/ObjectProtocols.h @@ -10,15 +10,17 @@ namespace GameLogic { struct Protocol_ObjectPosition :public Oyster::Network::CustomProtocolObject { + int object_ID; float worldMatrix[16]; // look at dir Protocol_ObjectPosition() { - this->protocol[0].value = protocol_PlayerPosition; + this->protocol[0].value = protocol_Gamplay_ObjectPosition; this->protocol[0].type = Oyster::Network::NetAttributeType_Int; - this->protocol[1].type = Oyster::Network::NetAttributeType_Float; + this->protocol[1].type = Oyster::Network::NetAttributeType_Int; + this->protocol[2].type = Oyster::Network::NetAttributeType_Float; this->protocol[3].type = Oyster::Network::NetAttributeType_Float; this->protocol[4].type = Oyster::Network::NetAttributeType_Float; @@ -34,27 +36,29 @@ namespace GameLogic this->protocol[14].type = Oyster::Network::NetAttributeType_Float; this->protocol[15].type = Oyster::Network::NetAttributeType_Float; this->protocol[16].type = Oyster::Network::NetAttributeType_Float; + this->protocol[17].type = Oyster::Network::NetAttributeType_Float; } Oyster::Network::CustomNetProtocol* GetProtocol() override { - this->protocol[1].value = worldMatrix[0]; + this->protocol[1].value = object_ID; this->protocol[2].value = worldMatrix[1]; - this->protocol[3].value = worldMatrix[2]; //Forgot? - this->protocol[4].value = worldMatrix[4]; //Forgot? - this->protocol[5].value = worldMatrix[5]; - this->protocol[6].value = worldMatrix[6]; - this->protocol[7].value = worldMatrix[7]; - this->protocol[8].value = worldMatrix[8]; - this->protocol[9].value = worldMatrix[9]; - this->protocol[10].value = worldMatrix[10]; - this->protocol[11].value = worldMatrix[11]; - this->protocol[12].value = worldMatrix[12]; - this->protocol[13].value = worldMatrix[13]; - this->protocol[14].value = worldMatrix[14]; - this->protocol[15].value = worldMatrix[15]; - this->protocol[16].value = worldMatrix[16]; + this->protocol[3].value = worldMatrix[2]; + this->protocol[4].value = worldMatrix[3]; + this->protocol[5].value = worldMatrix[4]; + this->protocol[6].value = worldMatrix[5]; + this->protocol[7].value = worldMatrix[6]; + this->protocol[8].value = worldMatrix[7]; + this->protocol[9].value = worldMatrix[8]; + this->protocol[10].value = worldMatrix[9]; + this->protocol[11].value = worldMatrix[10]; + this->protocol[12].value = worldMatrix[11]; + this->protocol[13].value = worldMatrix[12]; + this->protocol[14].value = worldMatrix[13]; + this->protocol[15].value = worldMatrix[14]; + this->protocol[16].value = worldMatrix[15]; + this->protocol[17].value = worldMatrix[16]; return &protocol; } diff --git a/Code/Game/GameProtocols/PlayerProtocols.h b/Code/Game/GameProtocols/PlayerProtocols.h index f0464ffc..35e66127 100644 --- a/Code/Game/GameProtocols/PlayerProtocols.h +++ b/Code/Game/GameProtocols/PlayerProtocols.h @@ -15,7 +15,7 @@ namespace GameLogic { struct Protocol_PlayerMovement :public Oyster::Network::CustomProtocolObject { - int ProtocolID; + bool bForward; bool bBackward; bool bTurnLeft; @@ -25,9 +25,9 @@ namespace GameLogic Protocol_PlayerMovement() { - this->protocol[0].value = ProtocolID = protocol_Gamplay_PlayerNavigation; + this->protocol[0].value = protocol_Gamplay_PlayerNavigation; + this->protocol[0].type = Oyster::Network::NetAttributeType_Short; - this->protocol[0].type = Oyster::Network::NetAttributeType_Int; this->protocol[1].type = Oyster::Network::NetAttributeType_Bool; this->protocol[2].type = Oyster::Network::NetAttributeType_Bool; this->protocol[3].type = Oyster::Network::NetAttributeType_Bool; @@ -53,13 +53,14 @@ namespace GameLogic struct Protocol_PlayerPosition :public Oyster::Network::CustomProtocolObject { + float position[3]; // look at dir Protocol_PlayerPosition() { this->protocol[0].value = protocol_Gamplay_PlayerPosition; - this->protocol[0].type = Oyster::Network::NetAttributeType_Int; + this->protocol[0].type = Oyster::Network::NetAttributeType_Short; this->protocol[1].type = Oyster::Network::NetAttributeType_Float; this->protocol[2].type = Oyster::Network::NetAttributeType_Float; @@ -68,7 +69,6 @@ namespace GameLogic } Oyster::Network::CustomNetProtocol* GetProtocol() override { - this->protocol[1].value = position[0]; this->protocol[2].value = position[1]; this->protocol[3].value = position[2]; diff --git a/Code/Misc/Thread/OysterThread.h b/Code/Misc/Thread/OysterThread.h index 805dea3b..51f1cf6e 100644 --- a/Code/Misc/Thread/OysterThread.h +++ b/Code/Misc/Thread/OysterThread.h @@ -47,6 +47,8 @@ namespace Oyster OYSTER_THREAD_ERROR Swap(const OysterThread* other); bool IsActive(); void SetPriority(OYSTER_THREAD_PRIORITY priority); + + bool IsCreated() const; }; } } diff --git a/Code/Misc/Thread/OysterThread_Impl.cpp b/Code/Misc/Thread/OysterThread_Impl.cpp index ab829adf..cbc4b8ea 100644 --- a/Code/Misc/Thread/OysterThread_Impl.cpp +++ b/Code/Misc/Thread/OysterThread_Impl.cpp @@ -59,10 +59,12 @@ using namespace Utility::DynamicMemory; }; struct OysterThread::PrivateData { + bool isCreated; SmartPointer threadData; PrivateData() { + isCreated = false; threadData = new ThreadData(); threadData->first = true; threadData->owner = 0; @@ -73,6 +75,7 @@ using namespace Utility::DynamicMemory; } PrivateData(const PrivateData& o) { + isCreated = o.isCreated; threadData = o.threadData; } const PrivateData& operator=(const PrivateData& o) @@ -81,7 +84,13 @@ using namespace Utility::DynamicMemory; } ~PrivateData() { - threadData.Release(); + //if(threadData.Release() == 0) + //{ + // if(this->threadData->workerThread->joinable()) + // { + // this->threadData->workerThread->join(); + // } + //} } }; @@ -109,10 +118,12 @@ theBegining: std::this_thread::sleep_for(std::chrono::milliseconds(1)); break; case Oyster::Thread::OYSTER_THREAD_PRIORITY_3: - std::this_thread::yield(); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + //std::this_thread::yield(); break; } - if(w->owner) shouldContinue = w->owner->DoWork(); + if(w->owner) + shouldContinue = w->owner->DoWork(); if(w->state == OYSTER_THREAD_STATE_RESET) goto theBegining; else if(w->msec > 0) std::this_thread::sleep_for(std::chrono::milliseconds(w->msec)); @@ -122,7 +133,8 @@ theBegining: if(w->state == OYSTER_THREAD_STATE_DEAD) { - if(w->workerThread->joinable()) w->workerThread->detach(); + if(w->workerThread->joinable()) + w->workerThread->detach(); return; } @@ -156,6 +168,7 @@ OysterThread::~OysterThread() OYSTER_THREAD_ERROR OysterThread::Create(IThreadObject* worker, bool start) { if(!this->privateData) return OYSTER_THREAD_ERROR_FAILED; + if(this->IsCreated()) return OYSTER_THREAD_ERROR_FAILED; if(this->privateData->threadData->workerThread) return OYSTER_THREAD_ERROR_FAILED; this->privateData->threadData->owner = worker; @@ -172,6 +185,8 @@ OYSTER_THREAD_ERROR OysterThread::Create(IThreadObject* worker, bool start) { this->privateData->threadData->state = OYSTER_THREAD_STATE_RUNNING; } + + this->privateData->isCreated = true; return OYSTER_THREAD_ERROR_SUCCESS; } OYSTER_THREAD_ERROR OysterThread::Start() @@ -276,4 +291,7 @@ void OysterThread::SetPriority(OYSTER_THREAD_PRIORITY priority) { this->privateData->threadData->prio = priority; } - +bool OysterThread::IsCreated() const +{ + return privateData->isCreated; +} diff --git a/Code/Network/NetworkAPI/CustomNetProtocol.cpp b/Code/Network/NetworkAPI/CustomNetProtocol.cpp index 1933d907..91fb7267 100644 --- a/Code/Network/NetworkAPI/CustomNetProtocol.cpp +++ b/Code/Network/NetworkAPI/CustomNetProtocol.cpp @@ -32,7 +32,6 @@ struct CustomNetProtocol::PrivateData attributes[i->first] = i->second; } } - attributes = o.attributes; } ~PrivateData() { diff --git a/Code/Network/NetworkAPI/NetworkAPI.vcxproj b/Code/Network/NetworkAPI/NetworkAPI.vcxproj index 78e11523..fe2f5c09 100644 --- a/Code/Network/NetworkAPI/NetworkAPI.vcxproj +++ b/Code/Network/NetworkAPI/NetworkAPI.vcxproj @@ -78,7 +78,7 @@ true C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) - C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) + C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath) $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)..\Bin\DLL\ $(ProjectName)_$(PlatformShortName)D @@ -88,12 +88,16 @@ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)..\Bin\DLL\ $(ProjectName)_$(PlatformShortName) + C:\Program Files %28x86%29\Visual Leak Detector\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86); false $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)..\Bin\DLL\ $(ProjectName)_$(PlatformShortName) + C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64); + C:\Program Files %28x86%29\Visual Leak Detector\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); diff --git a/Code/Network/NetworkAPI/NetworkCallbackHelper.h b/Code/Network/NetworkAPI/NetworkCallbackHelper.h index c99f2c5f..40c66899 100644 --- a/Code/Network/NetworkAPI/NetworkCallbackHelper.h +++ b/Code/Network/NetworkAPI/NetworkCallbackHelper.h @@ -26,15 +26,16 @@ namespace Oyster class NetworkClient; class CustomNetProtocol; - typedef void (*ClientConnectCallbackMethod)(NetworkClient); + typedef void (*ClientConnectCallbackMethod)(NetworkClient*); typedef void(*ProtocolRecieverFunction)(CustomNetProtocol& protocol); struct ClientConnectedObject { - virtual void ClientConnectCallback(NetworkClient& client) = 0; + virtual void ClientConnectCallback(NetworkClient* client) = 0; }; struct ProtocolRecieverObject { virtual void ProtocolRecievedCallback(CustomNetProtocol& protocol) = 0; + virtual void DisconnectedCallback(CustomNetProtocol& protocol) { }; }; union RecieverObject diff --git a/Code/Network/NetworkAPI/NetworkClient.cpp b/Code/Network/NetworkAPI/NetworkClient.cpp index e99ab502..4019e50e 100644 --- a/Code/Network/NetworkAPI/NetworkClient.cpp +++ b/Code/Network/NetworkAPI/NetworkClient.cpp @@ -48,8 +48,9 @@ struct ClientDataContainer InitWinSock(); callbackType = NetworkProtocolCallbackType_Unknown; sendPostBox = new PostBox(); - connection.SetBlockingMode(false); connection.InitiateClient(); + connection.SetBlockingMode(false); + } ClientDataContainer(IThreadObject* o, unsigned int socket ) :connection(socket), ID(currID++) @@ -85,10 +86,10 @@ struct NetworkClient::PrivateData : public IThreadObject { if(!this->data)return true; if(!this->data->connection.IsConnected()) return true; - + Send(); Recv(); - + return true; } @@ -122,32 +123,30 @@ struct NetworkClient::PrivateData : public IThreadObject { int errorCode = -1; - if(this->data->callbackType == NetworkProtocolCallbackType_Function) - { - OysterByte temp = OysterByte(); - errorCode = this->data->connection.Recieve(temp); - - if(errorCode == 0) - { - CustomNetProtocol protocol; - bool ok = this->data->translator.Unpack(protocol, temp); + OysterByte temp = OysterByte(); + errorCode = this->data->connection.Recieve(temp); - //Check if the protocol was unpacked correctly - if(ok) + if(errorCode == 0 && temp.GetSize()) + { + CustomNetProtocol protocol; + bool ok = this->data->translator.Unpack(protocol, temp); + + //Check if the protocol was unpacked correctly + if(ok) + { + this->data->recvObjMutex.lock(); + if(this->data->callbackType == NetworkProtocolCallbackType_Function) { - this->data->recvObjMutex.lock(); - if(this->data->callbackType == NetworkProtocolCallbackType_Function) - { - this->data->recvObj.protocolRecieverFnc(protocol); - } - else if(this->data->callbackType == NetworkProtocolCallbackType_Object) - { - this->data->recvObj.protocolRecievedObject->ProtocolRecievedCallback(protocol); - } - this->data->recvObjMutex.unlock(); + this->data->recvObj.protocolRecieverFnc(protocol); } + else if(this->data->callbackType == NetworkProtocolCallbackType_Object) + { + this->data->recvObj.protocolRecievedObject->ProtocolRecievedCallback(protocol); + } + this->data->recvObjMutex.unlock(); } } + return errorCode; } @@ -166,19 +165,22 @@ NetworkClient::NetworkClient() NetworkClient::NetworkClient(unsigned int socket) { privateData = new PrivateData(socket); + this->privateData->data->thread.Create(this->privateData, true); } NetworkClient::NetworkClient(RecieverObject recvObj, NetworkProtocolCallbackType type) { privateData = new PrivateData(); - this->privateData->data->recvObj = SmartPointer(&recvObj);; + this->privateData->data->callbackType = type; + this->privateData->data->recvObj = recvObj; } NetworkClient::NetworkClient(RecieverObject recvObj, NetworkProtocolCallbackType type, unsigned int socket) { privateData = new PrivateData(socket); - this->privateData->data->recvObj = SmartPointer(&recvObj); + this->privateData->data->recvObj = recvObj; this->privateData->data->callbackType = type; + this->privateData->data->thread.Create(this->privateData, true); } NetworkClient::NetworkClient(const NetworkClient& obj) @@ -204,16 +206,20 @@ NetworkClient::~NetworkClient() bool NetworkClient::Connect(unsigned short port, const char serverIP[]) { + privateData->data->connection.SetBlockingMode(true); int result = this->privateData->data->connection.Connect(port, serverIP); //Connect has succeeded if(result == 0) { - privateData->data->thread.Start(); + if(this->privateData->data->thread.IsCreated()) return false; + + this->privateData->data->thread.Create(this->privateData, true); + privateData->data->connection.SetBlockingMode(false); return true; } - privateData->data->connection.SetBlockingMode(false); + //Connect has failed return false; @@ -234,9 +240,14 @@ void NetworkClient::Send(CustomProtocolObject& protocol) this->privateData->Send(protocol.GetProtocol()); } +void NetworkClient::Send(CustomNetProtocol* protocol) +{ + this->privateData->Send(protocol); +} + void NetworkClient::SetRecieverObject(RecieverObject recvObj, NetworkProtocolCallbackType type) { - if (type == NetworkProtocolCallbackType_Unknown) return; + if (type == NetworkProtocolCallbackType_Unknown) return; //It should probably still be set even if it is unknown. privateData->data->recvObjMutex.lock(); privateData->data->recvObj = recvObj; diff --git a/Code/Network/NetworkAPI/NetworkClient.h b/Code/Network/NetworkAPI/NetworkClient.h index e77667a8..533ff23e 100644 --- a/Code/Network/NetworkAPI/NetworkClient.h +++ b/Code/Network/NetworkAPI/NetworkClient.h @@ -40,6 +40,7 @@ namespace Oyster //Adds the protocol to the queue of protocols to be sent. void Send(CustomProtocolObject& protocol); + void Send(CustomNetProtocol* protocol); void SetRecieverObject(RecieverObject recvObj, NetworkProtocolCallbackType type); diff --git a/Code/Network/NetworkAPI/NetworkServer.cpp b/Code/Network/NetworkAPI/NetworkServer.cpp index e7570281..5a02d767 100644 --- a/Code/Network/NetworkAPI/NetworkServer.cpp +++ b/Code/Network/NetworkAPI/NetworkServer.cpp @@ -156,12 +156,12 @@ void NetworkServer::PrivateData::CheckForNewClient() //Create client and Proc function if the pointer is not NULL if(initDesc.callbackType == NetworkClientCallbackType_Function) { - Oyster::Network::NetworkClient client(clientSocketNum); + Oyster::Network::NetworkClient *client = new Oyster::Network::NetworkClient(clientSocketNum); initDesc.recvObj.clientConnectFnc(client); } else if(initDesc.callbackType == NetworkClientCallbackType_Object) { - Oyster::Network::NetworkClient client(clientSocketNum); + Oyster::Network::NetworkClient *client = new Oyster::Network::NetworkClient(clientSocketNum); initDesc.recvObj.clientConnectObject->ClientConnectCallback(client); } } diff --git a/Code/Network/NetworkAPI/Translator.cpp b/Code/Network/NetworkAPI/Translator.cpp index 75598b75..0829913e 100644 --- a/Code/Network/NetworkAPI/Translator.cpp +++ b/Code/Network/NetworkAPI/Translator.cpp @@ -35,6 +35,7 @@ struct Translator::PrivateData auto end = ((MyCastingStruct*)protocol.privateData)->attributes.end(); size = 4; //size(int) + message.SetSize(0); message.PackInt(size, bytes); //Find all the data types @@ -43,7 +44,7 @@ struct Translator::PrivateData headerString.push_back(it->second.type); } - message.PackShort(size, bytes); + message.PackShort(headerString.size(), bytes); size += 2; for(int i = 0; i < (int)headerString.size(); i++) @@ -220,6 +221,8 @@ void Translator::Pack(OysterByte &bytes, CustomNetProtocol& protocol) bool Translator::Unpack(CustomNetProtocol& protocol, OysterByte &bytes) { + this->privateData->headerString.clear(); + if(!privateData->UnpackHeader(protocol, bytes)) { return false; diff --git a/Code/Network/NetworkDependencies/Connection.cpp b/Code/Network/NetworkDependencies/Connection.cpp index 84a0cbcc..6b1e72bd 100644 --- a/Code/Network/NetworkDependencies/Connection.cpp +++ b/Code/Network/NetworkDependencies/Connection.cpp @@ -7,23 +7,37 @@ using namespace Oyster::Network; +int CloseSocket(int &socket) +{ + if(socket == -1) return 0; + + if(closesocket( socket ) == SOCKET_ERROR) + { + return WSAGetLastError(); + } + + socket = -1; + + return 0; +} + Connection::Connection() { this->socket = -1; - bool stillSending = false; - bool closed = true; + this->stillSending = false; + this->closed = true; } Connection::Connection(int socket) { this->socket = socket; - bool stillSending = false; - bool closed = true; + this->stillSending = true; + this->closed = false; } Connection::~Connection() { - closesocket( this->socket ); + CloseSocket( this->socket ); } int Connection::Connect(unsigned short port , const char serverName[]) @@ -68,7 +82,7 @@ int Connection::InitiateServer(unsigned short port) if(bind(this->socket, (sockaddr*)&server, sizeof(server)) == SOCKET_ERROR) { errorCode = WSAGetLastError(); - closesocket(this->socket); + CloseSocket(this->socket); return errorCode; } @@ -76,7 +90,7 @@ int Connection::InitiateServer(unsigned short port) if(listen(this->socket, 5) == SOCKET_ERROR) { errorCode = WSAGetLastError(); - closesocket(this->socket); + CloseSocket(this->socket); return errorCode; } @@ -94,14 +108,7 @@ int Connection::InitiateClient() int Connection::Disconnect() { - int result = closesocket(this->socket); - - if(result == SOCKET_ERROR) - { - return WSAGetLastError(); - } - - return 0; + return CloseSocket(this->socket); } int Connection::Send(OysterByte &bytes) @@ -186,6 +193,8 @@ int Connection::SetBlockingMode(bool blocking) /////////////////////////////////////// int Connection::InitiateSocket() { + if(this->socket != -1) return 0; + this->socket = (int)::socket(AF_INET, SOCK_STREAM, 0); if(this->socket == SOCKET_ERROR) { diff --git a/Code/Network/NetworkDependencies/OysterByte.cpp b/Code/Network/NetworkDependencies/OysterByte.cpp index 99c88d44..ac6923a2 100644 --- a/Code/Network/NetworkDependencies/OysterByte.cpp +++ b/Code/Network/NetworkDependencies/OysterByte.cpp @@ -44,6 +44,7 @@ void OysterByte::Resize(unsigned int cap) { delete[] byteArray; byteArray = new unsigned char[cap]; + capacity = cap; } } @@ -59,13 +60,14 @@ unsigned char* OysterByte::GetByteArray() void OysterByte::AddSize(unsigned int size) { - int oldSize = this->size; - this->size += size; + int newCapacity = this->size + size; - if(this->size >= capacity) + if(newCapacity >= capacity) { - IncreaseCapacity(oldSize); + IncreaseCapacity(newCapacity); } + + this->size += size; } void OysterByte::SetBytes(unsigned char* bytes) @@ -109,16 +111,35 @@ OysterByte::operator unsigned char*() return byteArray; } +OysterByte& OysterByte::operator +=(const OysterByte& obj) +{ + int newSize = this->size + obj.size; + + if(newSize >= (int)capacity) + { + IncreaseCapacity(newSize); + } + + for(int i = size, j = 0; i < newSize; i++, j++) + { + this->byteArray[i] = obj.byteArray[j]; + } + + this->size = newSize; + + return *this; +} + ///////////// // Private // ///////////// -void OysterByte::IncreaseCapacity(unsigned int oldSize) +void OysterByte::IncreaseCapacity(unsigned int newCapacity) { - capacity = size * 2; + capacity = newCapacity * 2; unsigned char* temp = new unsigned char[capacity]; - for(int i = 0; i < (int)oldSize; i++) + for(int i = 0; i < (int)this->size; i++) { temp[i] = byteArray[i]; } diff --git a/Code/Network/NetworkDependencies/OysterByte.h b/Code/Network/NetworkDependencies/OysterByte.h index e525095b..4f6f4557 100644 --- a/Code/Network/NetworkDependencies/OysterByte.h +++ b/Code/Network/NetworkDependencies/OysterByte.h @@ -40,6 +40,8 @@ namespace Oyster operator const char*(); operator unsigned char*(); + OysterByte& operator +=(const OysterByte& obj); + private: //Expands the byteArray void IncreaseCapacity(unsigned int cap); diff --git a/Code/Network/NetworkDependencies/Packing.cpp b/Code/Network/NetworkDependencies/Packing.cpp index b6903a0a..41d059a3 100644 --- a/Code/Network/NetworkDependencies/Packing.cpp +++ b/Code/Network/NetworkDependencies/Packing.cpp @@ -169,7 +169,7 @@ namespace Oyster //bool (1-bit) bool Unpackb(unsigned char buffer[]) { - return buffer; + return *buffer; } //char (8-bit) @@ -282,7 +282,7 @@ namespace Oyster char* UnpackCStr(unsigned char buffer[]) { short len = UnpackS(buffer); - char* str = new char[len]; + char* str = new char[len+1]; buffer += 2; for(int i = 0; i < len; i++) @@ -290,6 +290,8 @@ namespace Oyster str[i] = buffer[i]; } + str[len] = '\0'; + return str; } diff --git a/Code/Network/OysterNetworkClient/ClientMain.cpp b/Code/Network/OysterNetworkClient/ClientMain.cpp index 31e499cc..7f8c9cf5 100644 --- a/Code/Network/OysterNetworkClient/ClientMain.cpp +++ b/Code/Network/OysterNetworkClient/ClientMain.cpp @@ -1,22 +1,16 @@ #include -#include #include #include "../NetworkDependencies/WinsockFunctions.h" #include "..\NetworkDependencies\Protocols.h" #include "../NetworkDependencies/OysterByte.h" -#include "../../Misc/ThreadSafeQueue.h" -#include "../NetworkDependencies/ThreadedClient.h" #include "../../Misc/WinTimer.h" #include "../../Misc/Utilities.h" #include "../NetworkAPI/NetworkClient.h" -#pragma comment(lib, "ws2_32.lib") +#include "..\..\Game\GameProtocols\PlayerProtocols.h" using namespace std; -using namespace Oyster::Network::Protocols; using namespace Oyster::Network; -using namespace Utility; -using namespace Utility::DynamicMemory; void proc(CustomNetProtocol& protocol) { @@ -25,6 +19,7 @@ void proc(CustomNetProtocol& protocol) int main() { + SetDllDirectory("..\\DLL\\"); int errorCode; char msgRecv[255] = "\0"; @@ -41,6 +36,8 @@ int main() errorCode = client.Connect(15151, "127.0.0.1"); client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function); + + if(errorCode != 1) { printf("%d", errorCode); @@ -48,11 +45,14 @@ int main() } //client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function); - cout << "Done" << endl; + std::cout << "Done" << endl; + GameLogic::Protocol_PlayerMovement p; while(1) { - + std::cout << ". "; + client.Send(p); + Sleep(100000); } ShutdownWinSock(); diff --git a/Code/Network/OysterNetworkClient/OysterNetworkClient.vcxproj b/Code/Network/OysterNetworkClient/OysterNetworkClient.vcxproj index bc491966..508cd9a2 100644 --- a/Code/Network/OysterNetworkClient/OysterNetworkClient.vcxproj +++ b/Code/Network/OysterNetworkClient/OysterNetworkClient.vcxproj @@ -69,28 +69,28 @@ $(SolutionDir)..\Bin\Executable\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) - $(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\NetworkAPI;$(SolutionDir)..\Bin\DLL;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(OutDir)..\DLL\ + C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Network\NetworkAPI\;$(IncludePath) + $(LibraryPath);$(SolutionDir)..\External\Lib\NetworkAPI;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(OutDir)..\DLL\ $(SolutionDir)..\Bin\Executable\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath);$(OutDir)..\DLL\ + C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Network\NetworkAPI\;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath);$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32 $(SolutionDir)..\Bin\Executable\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) + C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Network\NetworkAPI\;$(IncludePath) C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\ $(SolutionDir)..\Bin\Executable\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) + C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Network\NetworkAPI\;$(IncludePath) C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\ @@ -99,12 +99,13 @@ Disabled true %(AdditionalIncludeDirectories) + _MBCS;%(PreprocessorDefinitions) true - - - NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;%(AdditionalDependencies) + Console @@ -116,7 +117,9 @@ true - NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);delayimp.lib + NetworkAPI_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + Console @@ -132,7 +135,9 @@ true true true - NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName).lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);delayimp.lib + NetworkAPI_$(PlatformShortName).dll;%(DelayLoadDLLs) + Console @@ -148,10 +153,20 @@ true true true - NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName).lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);delayimp.lib + NetworkAPI_$(PlatformShortName).dll;%(DelayLoadDLLs) + Console + + {da2aa800-ed64-4649-8b3b-e7f1e3968b78} + false + true + false + true + true + {2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee} diff --git a/Code/Network/OysterNetworkServer/OysterNetworkServer.vcxproj b/Code/Network/OysterNetworkServer/OysterNetworkServer.vcxproj index 089427f7..30d88dc0 100644 --- a/Code/Network/OysterNetworkServer/OysterNetworkServer.vcxproj +++ b/Code/Network/OysterNetworkServer/OysterNetworkServer.vcxproj @@ -102,8 +102,7 @@ true - - + NetworkAPI_$(PlatformShortName)D.dll NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) @@ -116,6 +115,8 @@ true + NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName)D.dll @@ -131,6 +132,8 @@ true true true + NetworkAPI_$(PlatformShortName).dll + NetworkAPI_$(PlatformShortName).lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) @@ -146,6 +149,8 @@ true true true + NetworkAPI_$(PlatformShortName).lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName).dll diff --git a/Code/Network/OysterNetworkServer/ServerMain.cpp b/Code/Network/OysterNetworkServer/ServerMain.cpp index 7f78bc78..a2a65d13 100644 --- a/Code/Network/OysterNetworkServer/ServerMain.cpp +++ b/Code/Network/OysterNetworkServer/ServerMain.cpp @@ -1,24 +1,35 @@ #include #include #include +#include #include "../NetworkDependencies/WinsockFunctions.h" #include "../NetworkAPI/NetworkServer.h" +#include "../NetworkAPI/CustomNetProtocol.h" +#include "../NetworkAPI/NetworkCallbackHelper.h" using namespace Oyster::Network; using namespace std; +std::mutex m; +vector clients; + void proc(NetworkClient client) { cout << "Hej" << endl; + m.lock(); + clients.push_back(client); + m.unlock(); } int main() { + SetDllDirectory("..\\DLL\\"); + NetworkServer server; Oyster::Network::NetworkServer::INIT_DESC desc; desc.port = 15151; desc.callbackType = NetworkClientCallbackType_Function; - desc.recvObj = proc; + //desc.recvObj = proc; if(!server.Init(desc)) { @@ -36,9 +47,13 @@ int main() while(1) { - + Sleep(1000); + m.lock(); + cout << clients.size() << endl; + m.unlock(); } + server.Stop(); system("pause");