diff --git a/Bin/Content/Shaders/DebugVertex.cso b/Bin/Content/Shaders/DebugVertex.cso
deleted file mode 100644
index 4783f8a6..00000000
Binary files a/Bin/Content/Shaders/DebugVertex.cso and /dev/null differ
diff --git a/Bin/Content/Shaders/TextureDebug.cso b/Bin/Content/Shaders/TextureDebug.cso
deleted file mode 100644
index 6a324d8d..00000000
Binary files a/Bin/Content/Shaders/TextureDebug.cso and /dev/null differ
diff --git a/Code/DanBias.sln b/Code/DanBias.sln
index 315bd416..894caec6 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 c4ad8f96..ff05bc23 100644
--- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj
+++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj
@@ -192,26 +192,26 @@
-
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
index 1729708d..15e799bf 100644
--- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
+++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
@@ -30,41 +30,39 @@ namespace DanBias
void ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& p) override
{
- int pType = p[0].value.netInt;
- Client::GameClientState::ProtocolStruct* protocol;
- switch (pType)
- {
- case protocol_PlayerNavigation:
+ int pType = p[0].value.netInt;
+ Client::GameClientState::ProtocolStruct* protocolData;
+ 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;
+ break;
+ case protocol_PlayerPosition:
+ protocolData = new Client::GameClientState::PlayerPos;
+ for(int i = 0; i< 3; i++)
+ {
+ ((Client::GameClientState::PlayerPos*)protocolData)->playerPos[i] = p[i].value.netFloat;
+ }
+ gameClientState->Protocol(protocolData);
+ delete protocolData;
+ protocolData = NULL;
+ 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;
- }
-
+ case protocol_ObjectPosition:
+ protocolData = new Client::GameClientState::ObjPos;
+ for(int i = 0; i< 16; i++)
+ {
+ ((Client::GameClientState::ObjPos*)protocolData)->worldPos[i] = p[i].value.netFloat;
+ }
+ gameClientState->Protocol(protocolData);
+ delete protocolData;
+ protocolData = NULL;
+ break;
+ default:
+ break;
+ }
}
};
class DanBiasGamePrivateData
@@ -112,12 +110,18 @@ namespace DanBias
prevTimeStamp = 0;
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
-
- // 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();
+ m_data->r->nwClient->Connect(desc.port, desc.IP);
+ if (!m_data->r->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);
+
return DanBiasClientReturn_Sucess;
}
@@ -253,7 +257,7 @@ namespace DanBias
return E_FAIL;
break;
}
- m_data->gameClientState->Init(); // send game client
+ m_data->gameClientState->Init(m_data->r->nwClient); // send game client
}
return S_OK;
diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp
new file mode 100644
index 00000000..686bbca9
--- /dev/null
+++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp
@@ -0,0 +1,42 @@
+#include "C_DynamicObj.h"
+#include "DllInterfaces/GFXAPI.h"
+using namespace DanBias::Client;
+struct C_DynamicObj::myData
+{
+ myData(){}
+ Oyster::Graphics::Model::Model *model;
+ // light
+ // sound
+ // effect
+}privData;
+C_DynamicObj::C_DynamicObj(void)
+{
+}
+
+
+C_DynamicObj::~C_DynamicObj(void)
+{
+
+}
+void C_DynamicObj::Init(ModelInitData modelInit)
+{
+ // load models
+ privData = new myData();
+ privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
+ privData->model->WorldMatrix = modelInit.world;
+ privData->model->Visible = modelInit.visible;
+}
+void C_DynamicObj::setPos()
+{
+
+}
+
+void C_DynamicObj::Render()
+{
+ Oyster::Graphics::API::RenderModel(*(privData->model));
+}
+void C_DynamicObj::Release()
+{
+ Oyster::Graphics::API::DeleteModel(privData->model);
+ delete privData;
+}
\ No newline at end of file
diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h
new file mode 100644
index 00000000..ca0f3b8c
--- /dev/null
+++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h
@@ -0,0 +1,22 @@
+#ifndef DANBIAS_CLIENT_CDYNAMICOBJECT_H
+#define DANBIAS_CLIENT_CDYNAMICOBJECT_H
+#include "../C_Object.h"
+namespace DanBias
+{
+ namespace Client
+ {
+class C_DynamicObj : public C_Object
+{
+private:
+ struct myData;
+ myData* privData;
+public:
+ C_DynamicObj(void);
+ virtual ~C_DynamicObj(void);
+ void Init(ModelInitData modelInit);
+ void setPos();
+
+ void Render();
+ void Release();
+};};};
+#endif
diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp
new file mode 100644
index 00000000..e47d98ef
--- /dev/null
+++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp
@@ -0,0 +1,46 @@
+#include "C_Player.h"
+#include "DllInterfaces/GFXAPI.h"
+using namespace DanBias::Client;
+
+struct C_Player::myData
+{
+ myData(){}
+ Oyster::Math3D::Float4x4 view;
+ Oyster::Math3D::Float4x4 proj;
+ Oyster::Graphics::Model::Model *model;
+}privData;
+
+C_Player::C_Player(void)
+{
+}
+
+
+C_Player::~C_Player(void)
+{
+
+}
+
+void C_Player::Init(ModelInitData modelInit)
+{
+ // load models
+ privData = new myData();
+ privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
+ privData->model->WorldMatrix = modelInit.world;
+ privData->model->Visible = modelInit.visible;
+
+
+}
+void C_Player::setPos()
+{
+
+}
+
+void C_Player::Render()
+{
+ Oyster::Graphics::API::RenderModel(*(privData->model));
+}
+void C_Player::Release()
+{
+ Oyster::Graphics::API::DeleteModel(privData->model);
+ delete privData;
+}
diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h
new file mode 100644
index 00000000..5d9c9d59
--- /dev/null
+++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h
@@ -0,0 +1,25 @@
+#ifndef DANBIAS_CLIENT_CPLAYER_H
+#define DANBIAS_CLIENT_CPLAYER_H
+#include "../C_Object.h"
+namespace DanBias
+{
+ namespace Client
+ {
+class C_Player : public C_Object
+{
+private:
+ struct myData;
+ myData* privData;
+ //Oyster::Graphics:: LIght
+public:
+ C_Player(void);
+ ~C_Player(void);
+ void Init(ModelInitData modelInit);
+ void setPos();
+
+ void Render();
+ void Release();
+
+};};};
+#endif
+
diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp
new file mode 100644
index 00000000..54c36c2a
--- /dev/null
+++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp
@@ -0,0 +1,45 @@
+
+#include "C_StaticObj.h"
+#include "DllInterfaces/GFXAPI.h"
+using namespace DanBias::Client;
+
+struct C_StaticObj::myData
+{
+ myData(){}
+ Oyster::Graphics::Model::Model *model;
+ // light
+ // sound
+ // effect
+}privData;
+C_StaticObj::C_StaticObj(void)
+{
+}
+
+
+C_StaticObj::~C_StaticObj(void)
+{
+
+}
+void C_StaticObj::Init(ModelInitData modelInit)
+{
+ // load models
+ privData = new myData();
+ privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
+ privData->model->WorldMatrix = modelInit.world;
+ privData->model->Visible = modelInit.visible;
+
+}
+void C_StaticObj::setPos()
+{
+
+}
+
+void C_StaticObj::Render()
+{
+ Oyster::Graphics::API::RenderModel(*(privData->model));
+}
+void C_StaticObj::Release()
+{
+ Oyster::Graphics::API::DeleteModel(privData->model);
+ delete privData;
+}
\ No newline at end of file
diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h
new file mode 100644
index 00000000..768344f0
--- /dev/null
+++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h
@@ -0,0 +1,22 @@
+#ifndef DANBIAS_CLIENT_CSTATICOBJECT_H
+#define DANBIAS_CLIENT_CSTATICOBJECT_H
+#include "../C_Object.h"
+namespace DanBias
+{
+ namespace Client
+ {
+class C_StaticObj : public C_Object
+{
+private:
+ struct myData;
+ myData* privData;
+public:
+ C_StaticObj(void);
+ virtual ~C_StaticObj(void);
+ void Init(ModelInitData modelInit);
+ void setPos();
+
+ void Render();
+ void Release();
+};};};
+#endif
\ No newline at end of file
diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp
new file mode 100644
index 00000000..b07ec6fa
--- /dev/null
+++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp
@@ -0,0 +1,43 @@
+#include "C_UIobject.h"
+#include "DllInterfaces/GFXAPI.h"
+using namespace DanBias::Client;
+
+struct C_UIobject::myData
+{
+ myData(){}
+ Oyster::Math3D::Float4x4 view;
+ Oyster::Math3D::Float4x4 proj;
+ Oyster::Graphics::Model::Model *model;
+}privData;
+
+C_UIobject::C_UIobject(void)
+{
+}
+
+
+C_UIobject::~C_UIobject(void)
+{
+}
+void C_UIobject::Init(ModelInitData modelInit)
+{
+ // load models
+ privData = new myData();
+ privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
+ privData->model->WorldMatrix = modelInit.world;
+ privData->model->Visible = modelInit.visible;
+
+}
+void C_UIobject::setPos()
+{
+
+}
+
+void C_UIobject::Render()
+{
+ Oyster::Graphics::API::RenderModel(*(privData->model));
+}
+void C_UIobject::Release()
+{
+ Oyster::Graphics::API::DeleteModel(privData->model);
+ delete privData;
+}
\ No newline at end of file
diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h
new file mode 100644
index 00000000..203b5398
--- /dev/null
+++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h
@@ -0,0 +1,22 @@
+#ifndef DANBIAS_CLIENT_CUIOBJECT_H
+#define DANBIAS_CLIENT_CUIOBJECT_H
+#include "../C_Object.h"
+namespace DanBias
+{
+ namespace Client
+ {
+ class C_UIobject : public C_Object
+ {
+ private:
+ struct myData;
+ myData* privData;
+ public:
+ C_UIobject(void);
+ virtual ~C_UIobject(void);
+ void Init(ModelInitData modelInit);
+ void setPos();
+
+ void Render();
+ void Release();
+};};};
+#endif
\ No newline at end of file
diff --git a/Code/Game/DanBiasGame/GameClientState/GameClientState.h b/Code/Game/DanBiasGame/GameClientState/GameClientState.h
index 4e0d723b..368fca6a 100644
--- a/Code/Game/DanBiasGame/GameClientState/GameClientState.h
+++ b/Code/Game/DanBiasGame/GameClientState/GameClientState.h
@@ -3,6 +3,7 @@
#define NOMINMAX
#include "L_inputClass.h"
+#include "NetworkClient.h"
namespace DanBias
{
@@ -42,7 +43,7 @@ public:
public:
GameClientState(void);
virtual ~GameClientState(void);
- virtual bool Init() = 0;
+ virtual bool Init(Oyster::Network::NetworkClient* nwClient) = 0;
virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0;
virtual bool Render() = 0;
virtual bool Release() = 0;
diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp
index 64b1babb..588e6ab8 100644
--- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp
+++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp
@@ -1,7 +1,7 @@
#include "GameState.h"
#include "DllInterfaces/GFXAPI.h"
-#include "Obj/C_Player.h"
-#include "Obj/C_DynamicObj.h"
+#include "C_obj/C_Player.h"
+#include "C_obj/C_DynamicObj.h"
#include "NetworkClient.h"
#include "PlayerProtocols.h"
@@ -28,11 +28,12 @@ GameState::~GameState(void)
{
}
-bool GameState::Init()
+bool GameState::Init(Oyster::Network::NetworkClient* nwClient)
{
// load models
privData = new myData();
privData->state = gameStateState_loading;
+ privData->nwClient = nwClient;
privData->state = LoadGame();
return true;
}
@@ -92,12 +93,37 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI
// update objects
// Client.send(obj);
{
- GameLogic::Protocol_PlayerMovement movePlayer;
-
- //privData->nwClient->Send(movePlayer);
+ GameLogic::Protocol_PlayerMovement movePlayer;
+ movePlayer.bForward = false;
+ movePlayer.bBackward = false;
+ movePlayer.bStrafeLeft = false;
+ movePlayer.bStrafeRight = false;
+ movePlayer.bTurnLeft = false;
+ movePlayer.bTurnRight = false;
- if(KeyInput->IsKeyPressed(DIK_L))
- privData->state = GameState::gameStateState_end;
+
+ if(KeyInput->IsKeyPressed(DIK_W))
+ {
+ movePlayer.bForward = true;
+ }
+ if(KeyInput->IsKeyPressed(DIK_S))
+ {
+ movePlayer.bBackward = true;
+ }
+ if(KeyInput->IsKeyPressed(DIK_A))
+ {
+ movePlayer.bStrafeLeft = true;
+ }
+ if(KeyInput->IsKeyPressed(DIK_D))
+ {
+ movePlayer.bStrafeRight = true;
+ }
+
+
+ privData->nwClient->Send(movePlayer);
+
+ if(KeyInput->IsKeyPressed(DIK_L))
+ privData->state = GameState::gameStateState_end;
}
break;
case gameStateState_end:
diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.h b/Code/Game/DanBiasGame/GameClientState/GameState.h
index 26ec0caa..05f9ac3d 100644
--- a/Code/Game/DanBiasGame/GameClientState/GameState.h
+++ b/Code/Game/DanBiasGame/GameClientState/GameState.h
@@ -22,7 +22,7 @@ private:
public:
GameState(void);
~GameState(void);
- bool Init();
+ bool Init(Oyster::Network::NetworkClient* nwClient);
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput) override;
bool LoadModels(std::wstring mapFile) ;
bool InitCamera(Oyster::Math::Float3 startPos) ;
diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp
index 8d54bd24..2c07c27f 100644
--- a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp
+++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp
@@ -1,9 +1,9 @@
#include "LobbyState.h"
#include "DllInterfaces/GFXAPI.h"
#include "OysterMath.h"
-#include "Obj/C_Player.h"
-#include "Obj/C_StaticObj.h"
-#include "Obj/C_DynamicObj.h"
+#include "C_obj/C_Player.h"
+#include "C_obj/C_StaticObj.h"
+#include "C_obj/C_DynamicObj.h"
using namespace DanBias::Client;
@@ -28,7 +28,7 @@ LobbyState::~LobbyState(void)
}
-bool LobbyState::Init()
+bool LobbyState::Init(Oyster::Network::NetworkClient* nwClient)
{
privData = new myData();
diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.h b/Code/Game/DanBiasGame/GameClientState/LobbyState.h
index c00a3b8f..e7cb7b8c 100644
--- a/Code/Game/DanBiasGame/GameClientState/LobbyState.h
+++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.h
@@ -17,7 +17,7 @@ private:
public:
LobbyState(void);
~LobbyState(void);
- bool Init();
+ bool Init(Oyster::Network::NetworkClient* nwClient);
bool LoadModels(std::wstring file);
bool InitCamera(Oyster::Math::Float3 startPos);
ClientState Update(float deltaTime, InputClass* KeyInput);
diff --git a/Code/Game/DanBiasGame/Include/DanBiasGame.h b/Code/Game/DanBiasGame/Include/DanBiasGame.h
index a8d1a96f..f146f343 100644
--- a/Code/Game/DanBiasGame/Include/DanBiasGame.h
+++ b/Code/Game/DanBiasGame/Include/DanBiasGame.h
@@ -1,7 +1,7 @@
#ifndef DANBIASGAME_DANBIASGAME_H
#define DANBIASGAME_DANBIASGAME_H
-#define DANBIAS_CLIENT_L
+#define DANBIAS_CLIENT
#if defined (DANBIAS_GAME_DLL_EXPORT)
#define DANBIAS_GAME_DLL __declspec(dllexport)
@@ -29,6 +29,7 @@ namespace DanBias
{
//Stuff goes here...
int port;
+ const char* IP;
HINSTANCE hinst;
int nCmdShow;
diff --git a/Code/Game/DanBiasLauncher/Launcher.cpp b/Code/Game/DanBiasLauncher/Launcher.cpp
index 0efd5e2e..8ae0f29c 100644
--- a/Code/Game/DanBiasLauncher/Launcher.cpp
+++ b/Code/Game/DanBiasLauncher/Launcher.cpp
@@ -6,8 +6,8 @@
#include
-#include "DanBiasServerAPI.h"
-//#include "DanBiasGame.h"
+//#include "DanBiasServerAPI.h"
+#include "DanBiasGame.h"
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow)
@@ -22,7 +22,7 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
DanBias::DanBiasServerAPI::Run();
DanBias::DanBiasServerAPI::Release();
}
-#elif defined(DANBIAS_CLIENT_L)
+#elif defined(DANBIAS_CLIENT)
if(SetDllDirectory(L"..\\DLL") == FALSE)
{
return cmdShow;
@@ -30,6 +30,7 @@ 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.hinst = hinst;
gameDesc.nCmdShow = cmdShow;