diff --git a/Bin/Content/Shaders/DebugVertex.cso b/Bin/Content/Shaders/DebugVertex.cso index f89275e4..4783f8a6 100644 Binary files a/Bin/Content/Shaders/DebugVertex.cso and b/Bin/Content/Shaders/DebugVertex.cso differ diff --git a/Bin/Content/Shaders/TextureDebug.cso b/Bin/Content/Shaders/TextureDebug.cso index 8895fbc0..6a324d8d 100644 Binary files a/Bin/Content/Shaders/TextureDebug.cso and b/Bin/Content/Shaders/TextureDebug.cso differ diff --git a/Code/DanBias.sln b/Code/DanBias.sln index fec93854..315bd416 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -207,6 +207,7 @@ Global {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.ActiveCfg = Debug|Win32 + {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.Build.0 = Debug|Win32 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.ActiveCfg = Debug|x64 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.Build.0 = Debug|x64 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.ActiveCfg = Release|Win32 diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj index 8cc2896d..c4ad8f96 100644 --- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj +++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj @@ -72,7 +72,7 @@ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - $(SolutionDir)Network/NetworkAPI;$(IncludePath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath) true @@ -106,13 +106,13 @@ Disabled DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true - $(SolutionDir)Game/GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) + $(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) Windows true OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + NetworkAPI_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index e38b8cc9..1729708d 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -22,33 +22,50 @@ namespace DanBias #pragma region Game Data - struct MyRecieverObject // :public PontusRecieverObject + struct MyRecieverObject :public Oyster::Network::ProtocolRecieverObject { - Oyster::Network::NetworkClient nwClient; - - static void ProtocolRecieved(Network::CustomNetProtocol* p) - { - int pType = ((*p)[0]).value.netInt; - switch (pType) - { - case protocol_PlayerNavigation: - - break; - case protocol_PlayerPosition: - //int x = ((*p)[1]).value.netInt; - //int y = ((*p)[2]).value.netInt; - //int z = ((*p)[3]).value.netInt; - break; + Oyster::Network::NetworkClient* nwClient; + Client::GameClientState* gameClientState; + + void ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& p) override + { + + int pType = p[0].value.netInt; + Client::GameClientState::ProtocolStruct* protocol; + switch (pType) + { + case protocol_PlayerNavigation: + + break; + case protocol_PlayerPosition: + protocol = new Client::GameClientState::PlayerPos; + for(int i = 0; i< 3; i++) + { + ((Client::GameClientState::PlayerPos*)protocol)->playerPos[i] = p[i].value.netFloat; + } + gameClientState->Protocol(protocol); + delete protocol; + protocol = NULL; + break; - case protocol_ObjectPosition: - // DanBiasGame::protocolRecived(); - break; + case protocol_ObjectPosition: + protocol = new Client::GameClientState::ObjPos; + for(int i = 0; i< 16; i++) + { + ((Client::GameClientState::ObjPos*)protocol)->worldPos[i] = p[i].value.netFloat; + } + gameClientState->Protocol(protocol); + delete protocol; + protocol = NULL; + break; - default: - break; - } - } + default: + break; + } + + + } }; class DanBiasGamePrivateData { @@ -63,24 +80,17 @@ namespace DanBias } - public: - Client::GameClientState* gameClientState; - InputClass* inputObj; - GameLogic::Protocol_PlayerMovement player_move; - //Oyster::Network::NetworkClient nwClient; - MyRecieverObject r; - - // gameClient; + public: + Client::GameClientState* gameClientState; + InputClass* inputObj; + MyRecieverObject* r; } data; #pragma endregion DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData(); - void DanBiasGame::protocolRecived() - { - //m_data->gameClientState.setPos() - } + //-------------------------------------------------------------------------------------- // Interface API functions //-------------------------------------------------------------------------------------- @@ -106,6 +116,9 @@ namespace DanBias // Start in lobby state m_data->gameClientState = new Client::LobbyState(); m_data->gameClientState->Init(); + m_data->r = new MyRecieverObject; + m_data->r->nwClient = new Oyster::Network::NetworkClient(); + return DanBiasClientReturn_Sucess; } diff --git a/Code/Game/DanBiasGame/GameClientState/GameClientState.h b/Code/Game/DanBiasGame/GameClientState/GameClientState.h index 5277996d..4e0d723b 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameClientState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameClientState.h @@ -12,6 +12,26 @@ namespace Client class GameClientState { public: + struct ProtocolStruct + { + + }; + struct ObjPos :public ProtocolStruct + { + float worldPos[16]; + }; + struct PlayerPos :public ProtocolStruct + { + float playerPos[3]; + }; + struct PlayerMove :public ProtocolStruct + { + float playerPos[3]; + }; + struct PlayerName :public ProtocolStruct + { + char name[255]; + }; enum ClientState { ClientState_Lobby, @@ -26,6 +46,8 @@ public: virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0; virtual bool Render() = 0; virtual bool Release() = 0; + virtual void Protocol(ProtocolStruct* protocolStruct) = 0; + }; }; }; diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index a95b6798..64b1babb 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -2,6 +2,8 @@ #include "DllInterfaces/GFXAPI.h" #include "Obj/C_Player.h" #include "Obj/C_DynamicObj.h" +#include "NetworkClient.h" +#include "PlayerProtocols.h" using namespace DanBias::Client; @@ -12,8 +14,9 @@ struct GameState::myData Oyster::Math3D::Float4x4 proj; C_Object* object[3]; int modelCount; - //Oyster::Network::NetworkClient* nwClient; + Oyster::Network::NetworkClient* nwClient; gameStateState state; + }privData; GameState::GameState(void) @@ -33,7 +36,7 @@ bool GameState::Init() privData->state = LoadGame(); return true; } -GameState::gameStateState GameState::LoadGame() +GameState::gameStateState GameState::LoadGame() { LoadModels(L"map"); InitCamera(Oyster::Math::Float3(0,0,5.4f)); @@ -88,9 +91,14 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI // read server data // update objects // Client.send(obj); + { + GameLogic::Protocol_PlayerMovement movePlayer; + + //privData->nwClient->Send(movePlayer); if(KeyInput->IsKeyPressed(DIK_L)) privData->state = GameState::gameStateState_end; + } break; case gameStateState_end: return ClientState_Lobby; @@ -126,4 +134,21 @@ bool GameState::Release() delete privData; privData = NULL; return true; -} \ No newline at end of file +} + +void GameState::Protocol(ProtocolStruct* pos) +{ + if((ObjPos*)pos) + ObjectPosProtocol((ObjPos*)pos); + else if((PlayerPos*)pos) + PlayerPosProtocol((PlayerPos*)pos); +} +void GameState::PlayerPosProtocol(PlayerPos* pos) +{ + +} +void GameState::ObjectPosProtocol(ObjPos* pos) +{ + +} +//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 5ae6aa49..26ec0caa 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameState.h @@ -23,13 +23,18 @@ public: GameState(void); ~GameState(void); bool Init(); - GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput); - bool LoadModels(std::wstring mapFile); - bool InitCamera(Oyster::Math::Float3 startPos); + GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput) override; + bool LoadModels(std::wstring mapFile) ; + bool InitCamera(Oyster::Math::Float3 startPos) ; gameStateState LoadGame(); - bool Render(); - bool Release(); + bool Render()override; + bool Release()override; + + void Protocol(ProtocolStruct* pos)override; + void PlayerPosProtocol(PlayerPos* pos); + void ObjectPosProtocol(ObjPos* pos); + //void Protocol(LightPos pos); }; }; }; diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp index b107883f..8d54bd24 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp @@ -118,4 +118,14 @@ bool LobbyState::Release() delete privData; privData = NULL; return true; +} +void LobbyState::Protocol(ProtocolStruct* protocol) +{ + if((PlayerName*)protocol) + PlayerJoinProtocol((PlayerName*)protocol); + +} +void LobbyState::PlayerJoinProtocol(PlayerName* name) +{ + } \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.h b/Code/Game/DanBiasGame/GameClientState/LobbyState.h index 7498d448..c00a3b8f 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyState.h +++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.h @@ -32,5 +32,8 @@ public: bool Render(); bool Release(); + void Protocol(ProtocolStruct* protocol)override; + void PlayerJoinProtocol(PlayerName* name); + };};}; #endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H diff --git a/Code/Game/DanBiasGame/Include/DanBiasGame.h b/Code/Game/DanBiasGame/Include/DanBiasGame.h index 756460d4..a8d1a96f 100644 --- a/Code/Game/DanBiasGame/Include/DanBiasGame.h +++ b/Code/Game/DanBiasGame/Include/DanBiasGame.h @@ -1,6 +1,8 @@ #ifndef DANBIASGAME_DANBIASGAME_H #define DANBIASGAME_DANBIASGAME_H +#define DANBIAS_CLIENT_L + #if defined (DANBIAS_GAME_DLL_EXPORT) #define DANBIAS_GAME_DLL __declspec(dllexport) #else @@ -10,7 +12,7 @@ #define NOMINMAX #include -#define DANBIAS_CLIENT + namespace DanBias { @@ -53,7 +55,6 @@ namespace DanBias static HRESULT Render(float deltaTime); static HRESULT CleanUp(); - static void protocolRecived(); private: static __int64 cntsPerSec; static __int64 prevTimeStamp; diff --git a/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj b/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj index 0789eca9..3650d06a 100644 --- a/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj +++ b/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj @@ -110,7 +110,7 @@ Windows true - DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + DanBiasGame_$(PlatformShortName)D.dll;DanBiasServer_$(PlatformShortName)D.dll;%(DelayLoadDLLs) DanBiasGame_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;%(AdditionalDependencies) diff --git a/Code/Game/DanBiasLauncher/Launcher.cpp b/Code/Game/DanBiasLauncher/Launcher.cpp index 41859ab7..0efd5e2e 100644 --- a/Code/Game/DanBiasLauncher/Launcher.cpp +++ b/Code/Game/DanBiasLauncher/Launcher.cpp @@ -4,6 +4,8 @@ #define NOMINMAX #include #include + + #include "DanBiasServerAPI.h" //#include "DanBiasGame.h" @@ -20,7 +22,7 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh DanBias::DanBiasServerAPI::Run(); DanBias::DanBiasServerAPI::Release(); } -#elif defined(DANBIAS_CLIENT) +#elif defined(DANBIAS_CLIENT_L) if(SetDllDirectory(L"..\\DLL") == FALSE) { return cmdShow; diff --git a/Code/Game/DanBiasServer/DLLMain.cpp b/Code/Game/DanBiasServer/DLLMain.cpp index b088d800..41d71e2e 100644 --- a/Code/Game/DanBiasServer/DLLMain.cpp +++ b/Code/Game/DanBiasServer/DLLMain.cpp @@ -1,4 +1,4 @@ - +#define NOMINMAX #include BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved ) diff --git a/Code/Game/DanBiasServer/DanBiasServer.vcxproj b/Code/Game/DanBiasServer/DanBiasServer.vcxproj index 85e6b5e2..f0763732 100644 --- a/Code/Game/DanBiasServer/DanBiasServer.vcxproj +++ b/Code/Game/DanBiasServer/DanBiasServer.vcxproj @@ -73,7 +73,7 @@ $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)OysterPhysics3D\;$(IncludePath) $(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) @@ -81,7 +81,7 @@ $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)OysterPhysics3D\;$(IncludePath) $(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) @@ -89,7 +89,7 @@ $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)OysterPhysics3D\;$(IncludePath) $(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) @@ -97,7 +97,7 @@ $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)OysterPhysics3D\;$(IncludePath) $(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) @@ -114,7 +114,7 @@ Windows true GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs);NetworkAPI_$(PlatformShortName)D.dll - NetworkAPI_$(PlatformShortName)D.lib;WindowManager_$(PlatformShortName)D.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName)D.lib;WindowManager_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies) @@ -131,7 +131,7 @@ Windows true GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs);NetworkAPI_$(PlatformShortName)D.dll - NetworkAPI_$(PlatformShortName)D.lib;WindowManager_$(PlatformShortName)D.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName)D.lib;WindowManager_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies) @@ -152,7 +152,7 @@ true true GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs);NetworkAPI_$(PlatformShortName).dll - NetworkAPI_$(PlatformShortName).lib;WindowManager_$(PlatformShortName).lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName).lib;WindowManager_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies) @@ -173,7 +173,7 @@ true true GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs);NetworkAPI_$(PlatformShortName).dll - NetworkAPI_$(PlatformShortName).lib;WindowManager_$(PlatformShortName).lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName).lib;WindowManager_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies) @@ -197,9 +197,15 @@ + + {104fa3e9-94d9-4e1d-a941-28a03bc8a095} + {2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee} + + {f10cbc03-9809-4cba-95d8-327c287b18ee} + diff --git a/Code/Game/DanBiasServer/GameServer.cpp b/Code/Game/DanBiasServer/GameServer.cpp index 0a14e31f..0c4836d6 100644 --- a/Code/Game/DanBiasServer/GameServer.cpp +++ b/Code/Game/DanBiasServer/GameServer.cpp @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////// // Created by [Dennis Andersen] [2013] ///////////////////////////////////////////////////////////////////// +#define NOMINMAX #include #include #include diff --git a/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp b/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp index 1a97a73f..907b68c8 100644 --- a/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp +++ b/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp @@ -17,6 +17,15 @@ void ClientObject::SetPostbox(Oyster::PostBox* box) { this->box = box; } +GameLogic::Player* ClientObject::Logic_Object() +{ + return &this->logicPlayer; +} +Oyster::Network::NetworkClient* ClientObject::NetClient_Object() +{ + return &this->client; +} + void ClientObject::ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol) { if(!this->box) return; diff --git a/Code/Game/DanBiasServer/ServerObjects/ClientObject.h b/Code/Game/DanBiasServer/ServerObjects/ClientObject.h index b4aa42e1..c1cab669 100644 --- a/Code/Game/DanBiasServer/ServerObjects/ClientObject.h +++ b/Code/Game/DanBiasServer/ServerObjects/ClientObject.h @@ -5,6 +5,7 @@ #include "NetworkSession.h" #include "NetworkClient.h" #include +#include namespace DanBias { @@ -15,11 +16,15 @@ namespace DanBias ~ClientObject(); void SetPostbox(Oyster::PostBox* box); + + GameLogic::Player* Logic_Object(); + Oyster::Network::NetworkClient* NetClient_Object(); private: void ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol) override; private: + GameLogic::Player logicPlayer; Oyster::Network::NetworkClient client; Oyster::IPostBox* box; }; diff --git a/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp b/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp index 339408c8..24de1dfe 100644 --- a/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp +++ b/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp @@ -25,22 +25,25 @@ namespace DanBias } } this->clients.push_back(client); - } - void NetworkSession::DetachClient(Utility::DynamicMemory::SmartPointer client) - { - } void NetworkSession::DetachClient(short ID) { - + //this->clients[0]->NetClient_Object()-> + } + void NetworkSession::DetachClient() + { + for (unsigned int i = 0; i < this->clients.size(); i++) + { + this->clients[i] = 0; + } } - void NetworkSession::Kick(Utility::DynamicMemory::SmartPointer client) - { - - } void NetworkSession::Kick() { - + for (unsigned int i = 0; i < this->clients.size(); i++) + { + this->clients[i]->NetClient_Object()->Disconnect(); + this->clients[i] = 0; + } } }//End namespace DanBias \ No newline at end of file diff --git a/Code/Game/DanBiasServer/ServerObjects/NetworkSession.h b/Code/Game/DanBiasServer/ServerObjects/NetworkSession.h index 75e21090..43a7bde4 100644 --- a/Code/Game/DanBiasServer/ServerObjects/NetworkSession.h +++ b/Code/Game/DanBiasServer/ServerObjects/NetworkSession.h @@ -1,6 +1,7 @@ #ifndef DANBIASSERVER_NETWORK_SESSION_H #define DANBIASSERVER_NETWORK_SESSION_H +#define NOMINMAX #include "Utilities.h" #include #include @@ -26,10 +27,9 @@ namespace DanBias void AttachClient(Utility::DynamicMemory::SmartPointer client); - void DetachClient(Utility::DynamicMemory::SmartPointer client); void DetachClient(short ID); + void DetachClient(); - void Kick(Utility::DynamicMemory::SmartPointer client); void Kick(); void Send(Oyster::Network::CustomNetProtocol& protocol); diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.h b/Code/Game/GameLogic/AttatchmentMassDriver.h index 879938fe..2fac7be4 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.h +++ b/Code/Game/GameLogic/AttatchmentMassDriver.h @@ -1,3 +1,6 @@ +////////////////////////////////////////////////// +//Created by Erik of the GameLogic team +////////////////////////////////////////////////// #ifndef ATTATCHMENTMASSDRIVER_H #define ATTATCHMENTMASSDRIVER_H #include "IAttatchment.h" diff --git a/Code/Game/GameLogic/AttatchmentSocket.h b/Code/Game/GameLogic/AttatchmentSocket.h index f9be588b..2257dd7a 100644 --- a/Code/Game/GameLogic/AttatchmentSocket.h +++ b/Code/Game/GameLogic/AttatchmentSocket.h @@ -1,3 +1,7 @@ +////////////////////////////////////////////////// +//Created by Erik of the GameLogic team +////////////////////////////////////////////////// + #ifndef ATTATCHMENTSOCKET_H #define ATTATCHMENTSOCKET_H #include "IAttatchment.h" diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj index 13491d28..e0614e29 100644 --- a/Code/Game/GameLogic/GameLogic.vcxproj +++ b/Code/Game/GameLogic/GameLogic.vcxproj @@ -69,39 +69,39 @@ $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) + $(SolutionDir)..\Bin\DLL;$(LibraryPath) .dll $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) + $(SolutionDir)..\Bin\DLL;$(LibraryPath) $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) + $(SolutionDir)..\Bin\DLL;$(LibraryPath) $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) + $(SolutionDir)..\Bin\DLL;$(LibraryPath) Level3 Disabled true - $(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) - GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) + $(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) + DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) true - OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies) - GamePhysics_$(PlatformShortName)D.dll + GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies) + GamePhysics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -109,12 +109,13 @@ Level3 Disabled true - $(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) - GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) + $(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) + DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) true - OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies) + GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies) + GamePhysics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -124,14 +125,15 @@ true true true - $(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) - GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) + $(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) + DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) true true true - OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies) + GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies) + GamePhysics_$(PlatformShortName).dll;%(DelayLoadDLLs) @@ -141,14 +143,15 @@ true true true - $(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) - GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) + $(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) + DANBIAS_GAMELOGIC_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) true true true - OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies) + GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies) + GamePhysics_$(PlatformShortName).dll;%(DelayLoadDLLs) @@ -168,9 +171,9 @@ - + @@ -182,7 +185,6 @@ - diff --git a/Code/Game/GameLogic/GameLogicDef.h b/Code/Game/GameLogic/GameLogicDef.h new file mode 100644 index 00000000..fa6a9a82 --- /dev/null +++ b/Code/Game/GameLogic/GameLogicDef.h @@ -0,0 +1,14 @@ +#ifndef GAMELOGIC_GAMELOGICDEF_H +#define GAMELOGIC_GAMELOGICDEF_H + +#ifndef DANBIAS_GAMELOGIC + #define DANBIAS_GAMELOGIC +#endif + +#ifdef DANBIAS_GAMELOGIC_DLL_EXPORT + #define DANBIAS_GAMELOGIC_DLL __declspec(dllexport) +#else + #define DANBIAS_GAMELOGIC_DLL __declspec(dllimport) +#endif + +#endif // !GAMELOGIC_GAMELOGICDEF_H diff --git a/Code/Game/GameLogic/IAttatchment.h b/Code/Game/GameLogic/IAttatchment.h index 0b6cb061..2192ffcf 100644 --- a/Code/Game/GameLogic/IAttatchment.h +++ b/Code/Game/GameLogic/IAttatchment.h @@ -1,3 +1,7 @@ +////////////////////////////////////////////////// +//Created by Erik of the GameLogic team +////////////////////////////////////////////////// + #ifndef IATTATCHMENT_H #define IATTATCHMENT_H #include "GameLogicStates.h" diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 38865f63..835062c1 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -2,6 +2,7 @@ #include "StaticObject.h" #include "DynamicObject.h" #include "GameMode.h" +#include "Player.h" using namespace GameLogic; @@ -15,6 +16,8 @@ struct Level::PrivateData { } + Player *players; + int nrOfPlayers; StaticObject** staticObjects; int nrOfStaticObjects; @@ -37,4 +40,9 @@ Level::~Level(void) delete myData; } +void Level::InitiateLevel(std::string levelPath) +{ + +} + diff --git a/Code/Game/GameLogic/Level.h b/Code/Game/GameLogic/Level.h index 9c7adb1a..7177531b 100644 --- a/Code/Game/GameLogic/Level.h +++ b/Code/Game/GameLogic/Level.h @@ -3,6 +3,7 @@ ////////////////////////////////////////////////// #ifndef LEVEL_H #define LEVEL_H +#include namespace GameLogic { @@ -14,7 +15,7 @@ namespace GameLogic Level(void); ~Level(void); - void CreateBox(); + void InitiateLevel(std::string levelPath); private: struct PrivateData; diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h index c79c5de1..01864515 100644 --- a/Code/Game/GameLogic/Object.h +++ b/Code/Game/GameLogic/Object.h @@ -8,11 +8,12 @@ #include "PhysicsAPI.h" #include "GameLogicStates.h" +#include "GameLogicDef.h" namespace GameLogic { - class Object + class DANBIAS_GAMELOGIC_DLL Object { public: Object(); diff --git a/Code/Game/GameLogic/Player.h b/Code/Game/GameLogic/Player.h index 7cf7187b..af0bff50 100644 --- a/Code/Game/GameLogic/Player.h +++ b/Code/Game/GameLogic/Player.h @@ -6,10 +6,11 @@ #include "GameLogicStates.h" #include "OysterMath.h" #include "Object.h" +#include "GameLogicDef.h" namespace GameLogic { - class Player : public Object + class DANBIAS_GAMELOGIC_DLL Player : public Object { public: diff --git a/Code/Game/GameLogic/Weapon.cpp b/Code/Game/GameLogic/Weapon.cpp index 4bf4311c..e620e0d6 100644 --- a/Code/Game/GameLogic/Weapon.cpp +++ b/Code/Game/GameLogic/Weapon.cpp @@ -9,9 +9,10 @@ struct Weapon::PrivateData PrivateData() { weaponState = WEAPON_STATE_IDLE; - SelectedAttatchment = 0; + selectedAttatchment = 0; currentNrOfAttatchments = 0; selectedSocketID = 0; + maxNrOfSockets = 0; } ~PrivateData() @@ -21,10 +22,10 @@ struct Weapon::PrivateData WEAPON_STATE weaponState; AttatchmentSocket **attatchmentSockets; - int MaxNrOfSockets; + int maxNrOfSockets; int currentNrOfAttatchments; - IAttatchment *SelectedAttatchment; + IAttatchment *selectedAttatchment; int selectedSocketID; }myData; @@ -37,7 +38,7 @@ Weapon::Weapon() Weapon::Weapon(int MaxNrOfSockets) { myData = new PrivateData(); - myData->MaxNrOfSockets = MaxNrOfSockets; + myData->maxNrOfSockets = MaxNrOfSockets; myData->attatchmentSockets = new AttatchmentSocket*[MaxNrOfSockets]; for (int i = 0; i < MaxNrOfSockets; i++) { @@ -56,7 +57,7 @@ Weapon::~Weapon(void) ********************************************************/ void Weapon::Use(const WEAPON_FIRE &fireInput) { - myData->SelectedAttatchment->UseAttatchment(fireInput); + myData->selectedAttatchment->UseAttatchment(fireInput); } /******************************************************** @@ -83,7 +84,7 @@ bool Weapon::IsReloading() bool Weapon::IsValidSocket(int socketID) { - if(socketID < myData->MaxNrOfSockets && socketID >= 0) + if(socketID < myData->maxNrOfSockets && socketID >= 0) { if (myData->attatchmentSockets[socketID]->GetAttatchment() != 0) { @@ -100,16 +101,16 @@ int Weapon::GetCurrentSocketID() } -void Weapon::AddNewAttatchment(IAttatchment *attatchment) +void Weapon::AddNewAttatchment(IAttatchment *attatchment, Player *owner) { - if(myData->currentNrOfAttatchments < myData->MaxNrOfSockets) + if(myData->currentNrOfAttatchments < myData->maxNrOfSockets) { myData->attatchmentSockets[myData->currentNrOfAttatchments]->SetAttatchment(attatchment); myData->currentNrOfAttatchments++; } } -void Weapon::SwitchAttatchment(IAttatchment *attatchment, int socketID) +void Weapon::SwitchAttatchment(IAttatchment *attatchment, int socketID, Player *owner) { if (IsValidSocket(socketID)) { @@ -129,7 +130,7 @@ void Weapon::SelectAttatchment(int socketID) { if (IsValidSocket(socketID)) { - myData->SelectedAttatchment = myData->attatchmentSockets[socketID]->GetAttatchment(); + myData->selectedAttatchment = myData->attatchmentSockets[socketID]->GetAttatchment(); myData->selectedSocketID = socketID; } diff --git a/Code/Game/GameProtocols/ObjectProtocols.h b/Code/Game/GameProtocols/ObjectProtocols.h index 32a86259..101c5f42 100644 --- a/Code/Game/GameProtocols/ObjectProtocols.h +++ b/Code/Game/GameProtocols/ObjectProtocols.h @@ -8,7 +8,7 @@ namespace GameLogic { - struct Protocol_ObjectPosition :public Network::CustomProtocolObject + struct Protocol_ObjectPosition :public Oyster::Network::CustomProtocolObject { float worldMatrix[16]; // look at dir @@ -16,33 +16,33 @@ namespace GameLogic Protocol_ObjectPosition() { this->protocol[0].value = protocol_PlayerPosition; - this->protocol[0].type = Network::NetAttributeType_Int; - - this->protocol[1].type = Network::NetAttributeType_Float; - this->protocol[2].type = Network::NetAttributeType_Float; - this->protocol[3].type = Network::NetAttributeType_Float; - this->protocol[4].type = Network::NetAttributeType_Float; - this->protocol[5].type = Network::NetAttributeType_Float; - this->protocol[6].type = Network::NetAttributeType_Float; - this->protocol[7].type = Network::NetAttributeType_Float; - this->protocol[8].type = Network::NetAttributeType_Float; - this->protocol[9].type = Network::NetAttributeType_Float; - this->protocol[10].type = Network::NetAttributeType_Float; - this->protocol[11].type = Network::NetAttributeType_Float; - this->protocol[12].type = Network::NetAttributeType_Float; - this->protocol[13].type = Network::NetAttributeType_Float; - this->protocol[14].type = Network::NetAttributeType_Float; - this->protocol[15].type = Network::NetAttributeType_Float; - this->protocol[16].type = Network::NetAttributeType_Float; + this->protocol[0].type = Oyster::Network::NetAttributeType_Int; + + this->protocol[1].type = Oyster::Network::NetAttributeType_Float; + this->protocol[2].type = Oyster::Network::NetAttributeType_Float; + this->protocol[3].type = Oyster::Network::NetAttributeType_Float; + this->protocol[4].type = Oyster::Network::NetAttributeType_Float; + this->protocol[5].type = Oyster::Network::NetAttributeType_Float; + this->protocol[6].type = Oyster::Network::NetAttributeType_Float; + this->protocol[7].type = Oyster::Network::NetAttributeType_Float; + this->protocol[8].type = Oyster::Network::NetAttributeType_Float; + this->protocol[9].type = Oyster::Network::NetAttributeType_Float; + this->protocol[10].type = Oyster::Network::NetAttributeType_Float; + this->protocol[11].type = Oyster::Network::NetAttributeType_Float; + this->protocol[12].type = Oyster::Network::NetAttributeType_Float; + this->protocol[13].type = Oyster::Network::NetAttributeType_Float; + this->protocol[14].type = Oyster::Network::NetAttributeType_Float; + this->protocol[15].type = Oyster::Network::NetAttributeType_Float; + this->protocol[16].type = Oyster::Network::NetAttributeType_Float; } - Network::CustomNetProtocol* GetProtocol() override + Oyster::Network::CustomNetProtocol* GetProtocol() override { this->protocol[1].value = worldMatrix[0]; this->protocol[2].value = worldMatrix[1]; - this->protocol[3].value = worldMatrix[2]; - this->protocol[4].value = worldMatrix[4]; + 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]; @@ -59,7 +59,7 @@ namespace GameLogic } private: - Network::CustomNetProtocol protocol; + Oyster::Network::CustomNetProtocol protocol; }; } diff --git a/Code/Misc/Thread/OysterThread_Impl.cpp b/Code/Misc/Thread/OysterThread_Impl.cpp index 23fb0362..ab829adf 100644 --- a/Code/Misc/Thread/OysterThread_Impl.cpp +++ b/Code/Misc/Thread/OysterThread_Impl.cpp @@ -127,7 +127,7 @@ theBegining: return; } -theEnd: +//theEnd: if(w->owner) w->owner->ThreadExit(); w->state = OYSTER_THREAD_STATE_DEAD;