GL - started using network and protocols for sending/recieveing
This commit is contained in:
parent
bb789faa67
commit
22665bc44b
|
@ -163,6 +163,7 @@ Global
|
|||
{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|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
|
||||
|
@ -240,6 +241,7 @@ Global
|
|||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.Build.0 = Debug|x64
|
||||
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(SolutionDir)Network/NetworkAPI;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
|
@ -106,7 +106,7 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Game/GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -123,12 +123,12 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>GameProtocols_$(PlatformShortName)D.lib;OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
@ -142,14 +142,14 @@
|
|||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>GameProtocols_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>OysterGraphics_x86.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
@ -163,14 +163,14 @@
|
|||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>GameProtocols_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>OysterGraphics_x86.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
@ -181,6 +181,9 @@
|
|||
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
|
||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Network\NetworkAPI\NetworkAPI.vcxproj">
|
||||
<Project>{460d625f-2ac9-4559-b809-0ba89ceaedf4}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\OysterGraphics\OysterGraphics.vcxproj">
|
||||
<Project>{0ec83e64-230e-48ef-b08c-6ac9651b4f82}</Project>
|
||||
</ProjectReference>
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#include "GameClientState/GameClientState.h"
|
||||
#include "GameClientState\GameState.h"
|
||||
#include "GameClientState\LobbyState.h"
|
||||
|
||||
#include "PlayerProtocols.h"
|
||||
#include "NetworkClient.h"
|
||||
|
||||
#include "L_inputClass.h"
|
||||
#include "vld.h"
|
||||
|
@ -19,6 +20,36 @@ namespace DanBias
|
|||
HWND DanBiasGame::g_hWnd = NULL;
|
||||
|
||||
#pragma region Game Data
|
||||
|
||||
|
||||
struct MyRecieverObject // :public PontusRecieverObject
|
||||
{
|
||||
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;
|
||||
|
||||
|
||||
case protocol_ObjectPosition:
|
||||
// DanBiasGame::protocolRecived();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
class DanBiasGamePrivateData
|
||||
{
|
||||
|
||||
|
@ -35,12 +66,21 @@ namespace DanBias
|
|||
public:
|
||||
Client::GameClientState* gameClientState;
|
||||
InputClass* inputObj;
|
||||
GameLogic::Protocol_PlayerMovement player_move;
|
||||
//Oyster::Network::NetworkClient nwClient;
|
||||
MyRecieverObject r;
|
||||
|
||||
// gameClient;
|
||||
|
||||
} data;
|
||||
#pragma endregion
|
||||
DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
|
||||
|
||||
|
||||
DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
|
||||
void DanBiasGame::protocolRecived()
|
||||
{
|
||||
//m_data->gameClientState.setPos()
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Interface API functions
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -12,6 +12,7 @@ struct GameState::myData
|
|||
Oyster::Math3D::Float4x4 proj;
|
||||
C_Object* object[3];
|
||||
int modelCount;
|
||||
//Oyster::Network::NetworkClient* nwClient;
|
||||
gameStateState state;
|
||||
}privData;
|
||||
|
||||
|
@ -86,6 +87,8 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI
|
|||
case gameStateState_playing:
|
||||
// read server data
|
||||
// update objects
|
||||
// Client.send(obj);
|
||||
|
||||
if(KeyInput->IsKeyPressed(DIK_L))
|
||||
privData->state = GameState::gameStateState_end;
|
||||
break;
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace DanBias
|
|||
static HRESULT Update(float deltaTime);
|
||||
static HRESULT Render(float deltaTime);
|
||||
static HRESULT CleanUp();
|
||||
|
||||
static void protocolRecived();
|
||||
private:
|
||||
static __int64 cntsPerSec;
|
||||
static __int64 prevTimeStamp;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
|
||||
#define DANBIAS_SERVER
|
||||
//#define DANBIAS_CLIENT
|
||||
//#define DANBIAS_SERVER
|
||||
#define DANBIAS_CLIENT
|
||||
|
||||
|
||||
#if defined(DANBIAS_SERVER)
|
||||
|
|
|
@ -154,6 +154,7 @@
|
|||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ObjectProtocols.h" />
|
||||
<ClInclude Include="PlayerProtocols.h" />
|
||||
<ClInclude Include="ProtocolIdentificationID.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
#ifndef GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||
#define GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||
|
||||
#include <CustomNetProtocol.h>
|
||||
#include "ProtocolIdentificationID.h"
|
||||
|
||||
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
struct Protocol_ObjectPosition :public Network::CustomProtocolObject
|
||||
{
|
||||
float worldMatrix[16];
|
||||
// look at dir
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
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[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];
|
||||
return &protocol;
|
||||
}
|
||||
|
||||
private:
|
||||
Network::CustomNetProtocol protocol;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||
#define GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||
|
||||
#include "CustomNetProtocol.h"
|
||||
#include <CustomNetProtocol.h>
|
||||
#include "ProtocolIdentificationID.h"
|
||||
|
||||
|
||||
|
@ -20,24 +20,24 @@ namespace GameLogic
|
|||
|
||||
Protocol_PlayerMovement()
|
||||
{
|
||||
protocol[0]->value = ProtocolID = protocol_PlayerNavigation;
|
||||
this->protocol[0].value = ProtocolID = protocol_PlayerNavigation;
|
||||
|
||||
protocol[0]->type = Network::NetAttributeType_Int;
|
||||
protocol[1]->type = Network::NetAttributeType_Bool;
|
||||
protocol[2]->type = Network::NetAttributeType_Bool;
|
||||
protocol[3]->type = Network::NetAttributeType_Bool;
|
||||
protocol[4]->type = Network::NetAttributeType_Bool;
|
||||
protocol[5]->type = Network::NetAttributeType_Bool;
|
||||
protocol[6]->type = Network::NetAttributeType_Bool;
|
||||
this->protocol[0].type = Network::NetAttributeType_Int;
|
||||
this->protocol[1].type = Network::NetAttributeType_Bool;
|
||||
this->protocol[2].type = Network::NetAttributeType_Bool;
|
||||
this->protocol[3].type = Network::NetAttributeType_Bool;
|
||||
this->protocol[4].type = Network::NetAttributeType_Bool;
|
||||
this->protocol[5].type = Network::NetAttributeType_Bool;
|
||||
this->protocol[6].type = Network::NetAttributeType_Bool;
|
||||
}
|
||||
Network::CustomNetProtocol* GetProtocol() override
|
||||
{
|
||||
protocol[1]->value = bForward;
|
||||
protocol[2]->value = bBackward;
|
||||
protocol[3]->value = bTurnLeft;
|
||||
protocol[4]->value = bTurnRight;
|
||||
protocol[5]->value = bStrafeRight;
|
||||
protocol[6]->value = bStrafeRight;
|
||||
this->protocol[1].value = bForward;
|
||||
this->protocol[2].value = bBackward;
|
||||
this->protocol[3].value = bTurnLeft;
|
||||
this->protocol[4].value = bTurnRight;
|
||||
this->protocol[5].value = bStrafeRight;
|
||||
this->protocol[6].value = bStrafeRight;
|
||||
|
||||
return &protocol;
|
||||
}
|
||||
|
@ -45,6 +45,35 @@ namespace GameLogic
|
|||
private:
|
||||
Network::CustomNetProtocol protocol;
|
||||
};
|
||||
|
||||
struct Protocol_PlayerPosition :public Network::CustomProtocolObject
|
||||
{
|
||||
float position[3];
|
||||
// look at dir
|
||||
|
||||
Protocol_PlayerPosition()
|
||||
{
|
||||
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;
|
||||
|
||||
}
|
||||
Network::CustomNetProtocol* GetProtocol() override
|
||||
{
|
||||
|
||||
this->protocol[1].value = position[0];
|
||||
this->protocol[2].value = position[1];
|
||||
this->protocol[3].value = position[2];
|
||||
return &protocol;
|
||||
}
|
||||
|
||||
private:
|
||||
Network::CustomNetProtocol protocol;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
|
||||
|
||||
#define protocol_PlayerNavigation 0;
|
||||
#define protocol_PlayerNavigation 0
|
||||
#define protocol_PlayerPosition 1
|
||||
#define protocol_ObjectPosition 2
|
||||
|
||||
#endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H
|
||||
|
|
Loading…
Reference in New Issue