From 7817003db8683b503f3c848b00c5cc6f5aa2f4ad Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Fri, 13 Dec 2013 11:06:03 +0100 Subject: [PATCH 1/3] updated h.files description, started with level concept --- Code/Game/GameLogic/AttatchmentMassDriver.h | 3 +++ Code/Game/GameLogic/AttatchmentSocket.h | 4 ++++ Code/Game/GameLogic/GameLogic.vcxproj | 2 -- Code/Game/GameLogic/IAttatchment.h | 4 ++++ Code/Game/GameLogic/Level.cpp | 8 ++++++++ Code/Game/GameLogic/Level.h | 2 +- Code/Game/GameLogic/Weapon.cpp | 21 +++++++++++---------- 7 files changed, 31 insertions(+), 13 deletions(-) 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..291d2cd0 100644 --- a/Code/Game/GameLogic/GameLogic.vcxproj +++ b/Code/Game/GameLogic/GameLogic.vcxproj @@ -168,7 +168,6 @@ - @@ -182,7 +181,6 @@ - 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..89f13af2 100644 --- a/Code/Game/GameLogic/Level.h +++ b/Code/Game/GameLogic/Level.h @@ -14,7 +14,7 @@ namespace GameLogic Level(void); ~Level(void); - void CreateBox(); + void InitiateLevel(std::string levelPath); private: struct PrivateData; 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; } From f1f9f4d20a1bc6d027d21a8dceb756952e54afb5 Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Fri, 13 Dec 2013 11:11:51 +0100 Subject: [PATCH 2/3] added include string in level.h --- Code/Game/GameLogic/Level.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Code/Game/GameLogic/Level.h b/Code/Game/GameLogic/Level.h index 89f13af2..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 { From 7c1d19946d6f0a7c1a0f72fb6c6a9cb0a9fc9608 Mon Sep 17 00:00:00 2001 From: Linda Andersson Date: Fri, 13 Dec 2013 12:02:49 +0100 Subject: [PATCH 3/3] GL - Connection to network in clinet --- Bin/Content/Shaders/DebugVertex.cso | Bin 12292 -> 0 bytes Bin/Content/Shaders/TextureDebug.cso | Bin 14560 -> 0 bytes Code/DanBias.sln | 1 + Code/Game/DanBiasGame/DanBiasGame.vcxproj | 6 +- Code/Game/DanBiasGame/DanBiasGame_Impl.cpp | 83 ++++++++++-------- .../GameClientState/GameClientState.h | 22 +++++ .../DanBiasGame/GameClientState/GameState.cpp | 31 ++++++- .../DanBiasGame/GameClientState/GameState.h | 15 ++-- .../GameClientState/LobbyState.cpp | 10 +++ .../DanBiasGame/GameClientState/LobbyState.h | 3 + Code/Game/DanBiasGame/Include/DanBiasGame.h | 5 +- .../DanBiasLauncher/DanBiasLauncher.vcxproj | 2 +- Code/Game/DanBiasLauncher/Launcher.cpp | 6 +- Code/Game/GameProtocols/ObjectProtocols.h | 42 ++++----- 14 files changed, 153 insertions(+), 73 deletions(-) delete mode 100644 Bin/Content/Shaders/DebugVertex.cso delete mode 100644 Bin/Content/Shaders/TextureDebug.cso diff --git a/Bin/Content/Shaders/DebugVertex.cso b/Bin/Content/Shaders/DebugVertex.cso deleted file mode 100644 index 4e8292c6b9d3cd124bebd03c7ec3fd0a25ae8a33..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12292 zcmeHNU2GIp6h5;p*e-3^MG6HXnJ6aZ$K5SIwNxa94y8>BZMqdnm{_*E)9uRsWoH*k z)Yzzr`17C%4?b!%z7!MVgBV{V^5%ol7p-qj|oXt1q z-gAG>x##Ykx%bRyNB4J6ezW(ee{kFS~slZuGcMnsl_cK{y(mw*-&90&dc zhO`4cdC1(fhnZ!wbIVZ9^pMupM&1IbKr65bXaGouQt?90%#9V*)}hU6Z-2C3jgH3> zMnUb)W%8*s61zh?BB9;eBau*B`;LyCGSwG7cz7GyLWR@;D&SB}Ik9r3$lySFAM>8_lA<2aa|@HV91t@Tbp+GJ@(e0p>)KaM6rvr`by3s*xzl7ZL&>imHx>Y?C?NJ{MMIw#< z^;(n-ppZJ(0xvNST4OWsdKY-$!kkCL%^)(Kg&G2 zyFK9Sf$r{6dZW9Q2hN7tlpnr(e~A0g_y^aU-Z&o^I9D19K5*{JD^44h&EKc)dvp7I zkyG8{caR6P9a^+k80GS1Q_aLu*;cij$>&V9Q+2{2>SknI;gLrFGmZZGf>A6LvMQ=R*64q3AsW59)#QQM z%d?mHAV0%Pcc=b@X%tLdyZGYg?`85aEtS-@T)dPqvPDxrm@4*`Ms+Qg9Zkhdy*rmM z^nuf6(I^}&#PZ{*xT)JQJe~18J(|ko(}re@me2{WM~p(zm zr7Hnli5t3-sp2?vCCa+u)RnVzB^_O+6))7;oo-sX5|%FOdeWuKHLRr_)FLgW`!E%p z4tPm2z%;PWwcA?EbJ>O;Bg!QDZ_m#5y?p&k#ia()e<#*we9+-+L7N%xW#7lwe7w8| zX_h97I%r?qzW*g=6ZSx_L^BXMSh^K*oa%}ar{XaeRbM3VGYfs{%O<#-5 zK;8?G6#TlZ6uo7~h3I$02`0m=WU#K4^90cgWb5KA2|wS3XYFD=b%$p2K6 z)CIUk)-uNqJ*o;1xaZ%RWLULg-uzdEp`H;-;sM6{*Vl)ya&6aPBWG;`7DA~XodAgsGX6jO0Lw^>`aB45e@k-STQhFqk$tXL;RwcvxXz!4Lp#7ppCCO6 z&iL&()>sQTiE$tmdEOgV1N0?1?jLeL&;-;2oCo@S1<(L+Za6Qzzwo)U3a~aG;2zx` O4>aE%wVu{0@xWil@gIi( diff --git a/Bin/Content/Shaders/TextureDebug.cso b/Bin/Content/Shaders/TextureDebug.cso deleted file mode 100644 index 23c9aa238f2caca3ef27eaef75cc83f52464c37c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14560 zcmeHOT}&L;6+Q#ThBfOfcEBWdt*PTy;5f@J5ZiH`2!{omioY;G>}VxemH{?dcDJ)j zjO94B)IL~sBe|+ys=oBmE|L0}v}z@{iK?`flD<@GU#hC=&r{{%wn-XQrr&pGE*WgV zsf!~ZbI{p)?|09fd+wP#XYRdoNt}MR{rg+~bM5j}?a=!pU%CG0Gatqc5&6SWk*!FP z$cNx70N(~5FBADKcp%Zy`6h5pfaEv}6$=X$koy|41BrN?SUuPTH-Ha-tHGpKz~w5p z^aqy<`Kw^+tpINUFMyD!x-e2JE+uQaoaK5^V5Y) z7MZ7_EwSiR&9PWCez@gmtIW-HSton1KnL|!f~UYFwySM=2>B90kBF;!WG-kBDRJ7l z4g7VmCgNo3v4%(b`>d|PuD)Iw>^R-t*Ef)m-oAmJ6Wy{{F*i5Y2fGeIp6$>s6Re54 zNS?mI69XqZ2GJMmRLAK8@P6=K@Qatkc!5oiMo7u$zwMPr?wT<5EV!OVEb$8A?PkgKSPDqOf=?3z^`EaPpu}d>f&cs?VYNe(NS-ZiCAIjtk z(V^kSFNH%FBt14WF@a@bzwLB7scG9hW;*s{rdYC_hOt;Ra>s_yx`lO5L=7E8`dx?~R94s7k4 zDY*^1Et&oKA{6=7k&9L|n?u8>(#y(4yv6LzJJTt)@2)f#Yg*0c3rd|{deQ=LIJCrs zuAI+;7W1x4TqmsDeD1F1*@*DLOMyqh`XPJ7TR7eTR_}oYFXg)We(7vcqzMb^mL8E` zKP_?{3;KQCBHze~eB@xU3&jTV-#&=7;*7{|z9@2@n*rW(_kP^sL7|4AoRn98J!Np~+f$$jOd zmErV3MUtc!Kt2vDBI#qv@t2kUN$7Vz)<5p)Pg8$h>7Ug4i)ybr$-tB>D*fY(R7r#- z1}IffVQX#8_u0LsX8Y`253zU8A7jSrxb=;HdEwRFAG~Ym`Nk(5sGOGY8v(D=Ye~*e z8c?S0U;W^3ALUTKf$}I=&s~sJl)|r;t^4a+|GI`Ub&Y~q7tn+C0PkI|9IuJc=|+|8 zlfOT9qg9C>mirjU+Y$vG#SAgE3r zlt>LTZ+dgxm_kLEZo_=D4XGjDQ}PGpnVK!Ysss}XPj028PWo#M?<<+BgBnFNz6B## z5tvNJZmZ>>tSp=<@86JO5f z#Fz6q@jHE9h8@a(!UFb}LpNgl?uXy~&Y#jBOcl4iVO@T0*Du_d6EW)E{r!7qe>#2U zm0cHpVxD>X=OVWte+o=8@Ky^C}-^2D{+z?JaZ`rRKpU7;Cwpq!kWwxp?o?m? zacf@VWxy+4yxEWQ9Z~J#EyO#ed}p{8DB8vs+I&%N&9iKv9Fd`6%CKC9a=p0gb&c_w z1HzTM%zs zIAa*l2KK;eaa+F|HgNX>)9>K{-s7`XakcNa1Ls>Gk~iMsnCJ$ZV6I``0c)y5<`G@+ zQqC1f1+aO?T(JzRtsi@@w(Sy5)q12hb8`6{ktco>onKv7nL0zvNJYD;f^AlM z`ZdPXP%XI?BanH(Tia`@-naEEdVgN|MLUNbXD3|>`|_;$pJ=u7A2*??sXLQIE=%kybY@Qz<%jVNBxxfUDkr$iRbff(4{e9K+18B*&CC?*oAuv6yx48Iz zqxJGxraZBavSob z2JlflUW^Y3F!yyB8xTX(8iHr=wPSdmfsUf{s=@r<1Ui&)hVAbJbH8jCIG|701G_)n T=7QD&4+I_vJP>$bop|8COhD`t diff --git a/Code/DanBias.sln b/Code/DanBias.sln index fec93854..a5d83ac9 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -196,6 +196,7 @@ Global {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32 + {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.Build.0 = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.ActiveCfg = Debug|x64 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.Build.0 = Debug|x64 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.ActiveCfg = Release|Win32 diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj index 76a7554e..fe1d05b0 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_CLIENT;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 7eacfd89..23ff7ffc 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 1d42d16e..af99f874 100644 --- a/Code/Game/DanBiasLauncher/Launcher.cpp +++ b/Code/Game/DanBiasLauncher/Launcher.cpp @@ -4,8 +4,8 @@ #define NOMINMAX #include -#include "DanBiasServerAPI.h" -//#include "DanBiasGame.h" +//#include "DanBiasServerAPI.h" +#include "DanBiasGame.h" int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow) @@ -20,7 +20,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/GameProtocols/ObjectProtocols.h b/Code/Game/GameProtocols/ObjectProtocols.h index 32a86259..3f305a11 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,27 +16,27 @@ 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]; @@ -59,7 +59,7 @@ namespace GameLogic } private: - Network::CustomNetProtocol protocol; + Oyster::Network::CustomNetProtocol protocol; }; }