GameClient Correct scaling on drawn RB

This commit is contained in:
lindaandersson 2014-02-20 08:56:36 +01:00
commit 0c0fde51b0
18 changed files with 313 additions and 102 deletions

View File

@ -47,6 +47,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "Misc\Utilities
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LevelLoader", "Game\LevelLoader\LevelLoader.vcxproj", "{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LevelLoader", "Game\LevelLoader\LevelLoader.vcxproj", "{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameServerDebugEnvironment", "Game\LanServer\GameServerDebugEnvironment\GameServerDebugEnvironment.vcxproj", "{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -715,6 +717,40 @@ Global
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|Any CPU.ActiveCfg = Debug|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|Win32.ActiveCfg = Debug|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|Win32.Build.0 = Debug|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|x64.ActiveCfg = Debug|x64
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|x64.Build.0 = Debug|x64
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|x86.ActiveCfg = Debug|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|x86.Build.0 = Debug|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Any CPU.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Mixed Platforms.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Win32.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Win32.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x64.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x86.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x86.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|Any CPU.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|Mixed Platforms.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|Win32.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|Win32.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|x64.ActiveCfg = Release|x64
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|x64.Build.0 = Release|x64
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|x86.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|x86.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Mixed Platforms.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Win32.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x64.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -737,5 +773,6 @@ Global
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE} = {1322B12B-5E37-448A-AAAF-F637460DCB23} {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE} = {1322B12B-5E37-448A-AAAF-F637460DCB23}
{604A12A7-07BF-4482-BDF3-7101C811F121} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} {604A12A7-07BF-4482-BDF3-7101C811F121} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012}
{C8CBA520-5D7D-4D61-A8DA-6E05FD132BCB} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} {C8CBA520-5D7D-4D61-A8DA-6E05FD132BCB} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012}
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -154,7 +154,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
{ {
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position; RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position;
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size; RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2;
RBData.type = RB_Type_Cube; RBData.type = RB_Type_Cube;
staticObject->InitRB( RBData ); staticObject->InitRB( RBData );
} }
@ -163,7 +163,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
{ {
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position; RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position;
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius; RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2;
RBData.type = RB_Type_Sphere; RBData.type = RB_Type_Sphere;
staticObject->InitRB( RBData ); staticObject->InitRB( RBData );
} }
@ -198,7 +198,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
{ {
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position; RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position;
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size; RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2;
RBData.type = RB_Type_Cube; RBData.type = RB_Type_Cube;
dynamicObject->InitRB( RBData ); dynamicObject->InitRB( RBData );
} }
@ -207,7 +207,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
{ {
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position; RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position;
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius; RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2;
RBData.type = RB_Type_Sphere; RBData.type = RB_Type_Sphere;
dynamicObject->InitRB( RBData ); dynamicObject->InitRB( RBData );
} }

View File

@ -125,7 +125,6 @@ bool Game::NewFrame()
{ {
if(this->players[i] && this->players[i]->player) this->players[i]->player->EndFrame(); if(this->players[i] && this->players[i]->player) this->players[i]->player->EndFrame();
} }
return true; return true;
} }

View File

@ -5,27 +5,7 @@ using namespace GameLogic;
Game::PlayerData::PlayerData() Game::PlayerData::PlayerData()
{ {
//set some stats that are appropriate to a player Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,250,0);
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0);
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,2.0f,0.5f);
Oyster::Math::Float mass = 60;
Oyster::Math::Float restitutionCoeff = 0.5f;
Oyster::Math::Float frictionCoeff_Static = 0.4f;
Oyster::Math::Float frictionCoeff_Dynamic = 0.3f;
//sbDesc.quaternion = Oyster::Math::Float3(0, Oyster::Math::pi, 0);
//create rigid body
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
rigidBody->SetAngularFactor(0.0f);
//create player with this rigid body
this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,0,0);
}
Game::PlayerData::PlayerData(int playerID,int teamID)
{
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0);
Oyster::Math::Float height = 2.0f; Oyster::Math::Float height = 2.0f;
Oyster::Math::Float radius = 0.5f; Oyster::Math::Float radius = 0.5f;
Oyster::Math::Float mass = 40; Oyster::Math::Float mass = 40;
@ -34,7 +14,28 @@ Game::PlayerData::PlayerData(int playerID,int teamID)
Oyster::Math::Float frictionCoeff_Dynamic = 0.3f; Oyster::Math::Float frictionCoeff_Dynamic = 0.3f;
//create rigid body //create rigid body
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCharacter(height, radius, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, restitutionCoeff, frictionCoeff_Static, frictionCoeff_Dynamic ); Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCharacter( height, radius, Oyster::Math::Float4(0, 0, 0, 1),
centerPosition, mass, restitutionCoeff,
frictionCoeff_Static, frictionCoeff_Dynamic );
rigidBody->SetAngularFactor(0.0f);
//create player with this rigid body
this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player, 0, 0);
}
Game::PlayerData::PlayerData(int playerID,int teamID)
{
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,250,0);
Oyster::Math::Float height = 2.0f;
Oyster::Math::Float radius = 0.5f;
Oyster::Math::Float mass = 40;
Oyster::Math::Float restitutionCoeff = 0.5f;
Oyster::Math::Float frictionCoeff_Static = 0.4f;
Oyster::Math::Float frictionCoeff_Dynamic = 0.3f;
//create rigid body
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCharacter( height, radius, Oyster::Math::Float4(0, 0, 0, 1),
centerPosition, mass, restitutionCoeff,
frictionCoeff_Static, frictionCoeff_Dynamic );
rigidBody->SetAngularFactor(0.0f); rigidBody->SetAngularFactor(0.0f);
//create player with this rigid body //create player with this rigid body
this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,playerID,teamID); this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,playerID,teamID);

View File

@ -4,6 +4,7 @@
#include "JumpPad.h" #include "JumpPad.h"
#include "ExplosiveCrate.h" #include "ExplosiveCrate.h"
#include "Portal.h" #include "Portal.h"
#include <Resource\OResource.h>
//Conversion from wstring to string //Conversion from wstring to string
#include <codecvt> #include <codecvt>
@ -22,7 +23,7 @@ Level::~Level(void)
delete this->levelObj; delete this->levelObj;
this->levelObj = NULL; this->levelObj = NULL;
} }
Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody) Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
{ {
Object* gameObj = NULL; Object* gameObj = NULL;
@ -55,6 +56,7 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
{ {
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
} }
break;
case ObjectSpecialType_Stone: case ObjectSpecialType_Stone:
{ {
gameObj = new DynamicObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); gameObj = new DynamicObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
@ -261,7 +263,7 @@ bool Level::InitiateLevel(std::wstring levelPath)
if(rigidBody_Static != NULL) if(rigidBody_Static != NULL)
{ {
// create game object // create game object
Object* staticGameObj = createGameObj(staticObjData, rigidBody_Static); Object* staticGameObj = CreateGameObj(staticObjData, rigidBody_Static);
if(staticGameObj != NULL) if(staticGameObj != NULL)
{ {
this->staticObjects.Push((StaticObject*)staticGameObj); this->staticObjects.Push((StaticObject*)staticGameObj);
@ -295,7 +297,7 @@ bool Level::InitiateLevel(std::wstring levelPath)
if(rigidBody_Dynamic != NULL) if(rigidBody_Dynamic != NULL)
{ {
// create game object // create game object
Object* dynamicGameObj = createGameObj(dynamicObjData, rigidBody_Dynamic); Object* dynamicGameObj = CreateGameObj(dynamicObjData, rigidBody_Dynamic);
if (dynamicGameObj != NULL) if (dynamicGameObj != NULL)
{ {
this->dynamicObjects.Push((DynamicObject*)dynamicGameObj); this->dynamicObjects.Push((DynamicObject*)dynamicGameObj);

View File

@ -35,7 +35,7 @@ namespace GameLogic
Oyster::Physics::ICustomBody* InitRigidBodyCube( const ObjectHeader* obj); Oyster::Physics::ICustomBody* InitRigidBodyCube( const ObjectHeader* obj);
Oyster::Physics::ICustomBody* InitRigidBodySphere( const ObjectHeader* obj); Oyster::Physics::ICustomBody* InitRigidBodySphere( const ObjectHeader* obj);
Object* createGameObj(ObjectHeader* obj, Oyster::Physics::ICustomBody* rigidBody); Object* CreateGameObj(ObjectHeader* obj, Oyster::Physics::ICustomBody* rigidBody);
/******************************************************** /********************************************************
* Creates a team in the level * Creates a team in the level
* @param teamSize: The size of the team you want to create * @param teamSize: The size of the team you want to create

View File

@ -22,6 +22,7 @@ namespace DanBias
{ {
ClientState_CreatingGame, ClientState_CreatingGame,
ClientState_Ready, ClientState_Ready,
ClientState_Invalid,
}; };
public: public:
@ -41,6 +42,7 @@ namespace DanBias
inline GameLogic::IPlayerData* GetPlayer() const { return this->player; } inline GameLogic::IPlayerData* GetPlayer() const { return this->player; }
Oyster::Network::NetClient GetClient() const { return this->client; } Oyster::Network::NetClient GetClient() const { return this->client; }
ClientState GetState() const { return this->state; } ClientState GetState() const { return this->state; }
int GetFailedProtocolCount() const { return this->failedPackagesCount; }
void SetPlayer(GameLogic::IPlayerData* player); void SetPlayer(GameLogic::IPlayerData* player);
@ -53,6 +55,10 @@ namespace DanBias
GameLogic::IPlayerData* ReleasePlayer(); GameLogic::IPlayerData* ReleasePlayer();
Oyster::Network::NetClient ReleaseClient(); Oyster::Network::NetClient ReleaseClient();
void Invalidate();
int IncrementFailedProtocol();
void ResetFailedProtocolCount();
//NetworkSpecific //NetworkSpecific
void SetOwner(Oyster::Network::NetworkSession* owner); void SetOwner(Oyster::Network::NetworkSession* owner);
void UpdateClient(); void UpdateClient();
@ -62,7 +68,9 @@ namespace DanBias
Oyster::Network::NetClient client; Oyster::Network::NetClient client;
bool isReady; bool isReady;
bool isInvalid;
float secondsSinceLastResponse; float secondsSinceLastResponse;
int failedPackagesCount;
std::wstring alias; std::wstring alias;
std::wstring character; std::wstring character;

View File

@ -198,6 +198,9 @@
<ClInclude Include="GameSession.h" /> <ClInclude Include="GameSession.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Misc\OysterMath\OysterMath.vcxproj">
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
</ProjectReference>
<ProjectReference Include="..\..\Misc\Utilities\Utilities.vcxproj"> <ProjectReference Include="..\..\Misc\Utilities\Utilities.vcxproj">
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project> <Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
</ProjectReference> </ProjectReference>

View File

@ -6,6 +6,5 @@
BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved ) BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved )
{ {
return TRUE; return TRUE;
} }

View File

@ -14,6 +14,8 @@ using namespace GameLogic;
GameClient::GameClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> nwClient) GameClient::GameClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> nwClient)
{ {
this->isInvalid = false;
this->failedPackagesCount = 0;
this->client = nwClient; this->client = nwClient;
this->player = 0; this->player = 0;
isReady = false; isReady = false;
@ -23,6 +25,7 @@ GameClient::GameClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::Net
} }
GameClient::~GameClient() GameClient::~GameClient()
{ {
this->client = 0;
this->player = 0; this->player = 0;
this->isReady = false; this->isReady = false;
this->character = L"crate_colonists.dan"; this->character = L"crate_colonists.dan";
@ -55,6 +58,22 @@ void GameClient::SetState(ClientState state)
this->state = state; this->state = state;
} }
void GameClient::Invalidate()
{
this->isInvalid = true;
this->isReady = false;
this->state = ClientState_Invalid;
this->client->Disconnect();
}
int GameClient::IncrementFailedProtocol()
{
this->failedPackagesCount++;
return this->failedPackagesCount;
}
void GameClient::ResetFailedProtocolCount()
{
this->failedPackagesCount = 0;
}
void GameClient::SetOwner(Oyster::Network::NetworkSession* owner) void GameClient::SetOwner(Oyster::Network::NetworkSession* owner)
{ {

View File

@ -61,12 +61,15 @@ using namespace DanBias;
switch (e.args.type) switch (e.args.type)
{ {
case NetworkClient::ClientEventArgs::EventType_Disconnect: case NetworkClient::ClientEventArgs::EventType_Disconnect:
//printf("\t(%i : %s) - EventType_Disconnect\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str());
this->gClients[temp]->Invalidate();
break; break;
case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToRecieve: case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToRecieve:
break; break;
case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend: case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend:
printf("\t(%i : %s) - EventType_ProtocolFailedToSend\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str()); //printf("\t(%i : %s) - EventType_ProtocolFailedToSend\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str());
//this->Detach(e.sender); if(this->gClients[temp]->IncrementFailedProtocol() >= 5/*client->threshold*/)
this->gClients[temp]->Invalidate();
break; break;
case NetworkClient::ClientEventArgs::EventType_ProtocolRecieved: case NetworkClient::ClientEventArgs::EventType_ProtocolRecieved:
//printf("\t(%i : %s) - EventType_ProtocolRecieved\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str()); //printf("\t(%i : %s) - EventType_ProtocolRecieved\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str());
@ -128,6 +131,12 @@ using namespace DanBias;
int id = movedObject->GetID(); int id = movedObject->GetID();
//Protocol_ObjectPosition p(movedObject->GetPosition(), id); //Protocol_ObjectPosition p(movedObject->GetPosition(), id);
Protocol_ObjectPositionRotation p(movedObject->GetPosition(), movedObject->GetRotation(), id); Protocol_ObjectPositionRotation p(movedObject->GetPosition(), movedObject->GetRotation(), id);
Oyster::Math::Float3 temp = movedObject->GetPosition();
if(temp.x < -300)
id = 0;
GameSession::gameSession->Send(p.GetProtocol()); GameSession::gameSession->Send(p.GetProtocol());
//} //}
} }

View File

@ -19,35 +19,36 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{104FA3E9-94D9-4E1D-A941-28A03BC8A095}</ProjectGuid> <ProjectGuid>{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}</ProjectGuid>
<RootNamespace>GamePhysics</RootNamespace> <Keyword>Win32Proj</Keyword>
<RootNamespace>GameServerDebugEnvironment</RootNamespace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
@ -66,104 +67,115 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir> <LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)_$(Configuration)</TargetName>
</PropertyGroup> <IncludePath>$(SolutionDir)Game\GameServer\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Misc\WindowManager;$(IncludePath)</IncludePath>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir> <LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)_$(Configuration)</TargetName>
<IncludePath>$(SolutionDir)Game\GameServer\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Misc\WindowManager;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)_$(Configuration)</TargetName>
<IncludePath>$(SolutionDir)Game\GameServer\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Misc\WindowManager;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)_$(Configuration)</TargetName>
<IncludePath>$(SolutionDir)Game\GameServer\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Misc\WindowManager;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)Physics\Bullet Source\</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <SDLCheck>true</SDLCheck>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile> <DelayLoadDLLs>GameServer_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</ModuleDefinitionFile>
<AdditionalDependencies>$(SolutionDir)Physics/lib/debug/BulletCollision_Debug.lib;$(SolutionDir)Physics/lib/debug/BulletDynamics_Debug.lib;$(SolutionDir)Physics/lib/debug/LinearMath_Debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)Physics\Bullet Source\</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <SDLCheck>true</SDLCheck>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile> <DelayLoadDLLs>GameServer_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</ModuleDefinitionFile>
<AdditionalDependencies>$(SolutionDir)Physics/lib/debug/BulletCollision_Debugx64.lib;$(SolutionDir)Physics/lib/debug/BulletDynamics_Debugx64.lib;$(SolutionDir)Physics/lib/debug/LinearMath_Debugx64.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)Physics\Bullet Source\</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <SDLCheck>true</SDLCheck>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile> <DelayLoadDLLs>GameServer_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</ModuleDefinitionFile>
<AdditionalDependencies>$(SolutionDir)Physics/lib/release/BulletCollision.lib;$(SolutionDir)Physics/lib/release/BulletDynamics.lib;$(SolutionDir)Physics/lib/release/LinearMath.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)Physics\Bullet Source\</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_WINDLL;PHYSICS_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <SDLCheck>true</SDLCheck>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile> <DelayLoadDLLs>GameServer_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</ModuleDefinitionFile>
<AdditionalDependencies>$(SolutionDir)Physics/lib/release/BulletCollisionx64.lib;$(SolutionDir)Physics/lib/release/BulletDynamicsx64.lib;$(SolutionDir)Physics/lib/release/LinearMathx64.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Implementation\PhysicsAPI_Impl.h" /> <ProjectReference Include="..\..\..\Misc\WindowManager\WindowManager.vcxproj">
<ClInclude Include="Implementation\SimpleRigidBody.h" /> <Project>{35aea3c0-e0a7-4e1e-88cd-514aa5a442b1}</Project>
<ClInclude Include="PhysicsAPI.h" /> </ProjectReference>
<ClInclude Include="PhysicsStructs-Impl.h" /> <ProjectReference Include="..\..\GameServer\GameServer.vcxproj">
<ClInclude Include="PhysicsStructs.h" /> <Project>{143bd516-20a1-4890-a3e4-f8bfd02220e7}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Implementation\DLLMain.cpp" /> <ClCompile Include="Source.cpp" />
<ClCompile Include="Implementation\PhysicsAPI_Impl.cpp" />
<ClCompile Include="Implementation\SimpleRigidBody.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////
// Launcher to launch Danbias server or client //
/////////////////////////////////////////////////
#define NOMINMAX
#include <Windows.h>
#include <vld.h>
#include <GameServerAPI.h>
#include <WindowShell.h>
using namespace DanBias;
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow)
{
if(SetDllDirectory(L"..\\DLL") == FALSE)
{
return cmdShow;
}
WindowShell::CreateConsoleWindow();
GameServerAPI::ServerInitDesc desc;
desc.listenPort = 15151;
desc.serverName = L"bla";
if(GameServerAPI::ServerInitiate(desc) == DanBiasServerReturn_Sucess)
{
GameServerAPI::ServerStart();
GameServerAPI::GameSetGameMode(L"free-for-all");
GameServerAPI::GameSetGameName(L"DebugServer");
GameServerAPI::GameSetGameTime(15);
GameServerAPI::GameSetMapName(L"2ofAll.bias");
GameServerAPI::GameSetMaxClients(10);
if(GameServerAPI::GameStart(true))
{
int Q = 0x51;
while ( GetAsyncKeyState(Q) == 0)
{
GameServerAPI::ServerUpdate();
}
}
GameServerAPI::ServerStop();
}
return 0;
}

View File

@ -482,7 +482,7 @@
this.tableLayoutPanel1.ColumnCount = 3; this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35.29412F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35.29412F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 64.70588F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 64.70588F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 112F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 114F));
this.tableLayoutPanel1.Controls.Add(this.label6, 0, 0); this.tableLayoutPanel1.Controls.Add(this.label6, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label7, 1, 0); this.tableLayoutPanel1.Controls.Add(this.label7, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label8, 2, 0); this.tableLayoutPanel1.Controls.Add(this.label8, 2, 0);
@ -507,7 +507,7 @@
// label7 // label7
// //
this.label7.AutoSize = true; this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(46, 1); this.label7.Location = new System.Drawing.Point(45, 1);
this.label7.Name = "label7"; this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(31, 13); this.label7.Size = new System.Drawing.Size(31, 13);
this.label7.TabIndex = 8; this.label7.TabIndex = 8;
@ -516,7 +516,7 @@
// label8 // label8
// //
this.label8.AutoSize = true; this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(122, 1); this.label8.Location = new System.Drawing.Point(120, 1);
this.label8.Name = "label8"; this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(34, 13); this.label8.Size = new System.Drawing.Size(34, 13);
this.label8.TabIndex = 8; this.label8.TabIndex = 8;

View File

@ -4,6 +4,7 @@
#include "LevelLoader.h" #include "LevelLoader.h"
#include "LevelParser.h" #include "LevelParser.h"
#include <Resource\OysterResource.h>
using namespace GameLogic; using namespace GameLogic;
using namespace GameLogic::LevelFileLoader; using namespace GameLogic::LevelFileLoader;
@ -29,6 +30,7 @@ LevelLoader::LevelLoader(std::string folderPath)
LevelLoader::~LevelLoader() LevelLoader::~LevelLoader()
{ {
Oyster::Resource::OysterResource::Clean();
} }
std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> LevelLoader::LoadLevel(std::string fileName) std::vector<Utility::DynamicMemory::SmartPointer<ObjectTypeHeader>> LevelLoader::LoadLevel(std::string fileName)

View File

@ -48,6 +48,7 @@ struct NetworkClient::PrivateData : public IThreadObject
Connection connection; Connection connection;
Translator translator; Translator translator;
OysterThread thread; OysterThread thread;
bool outputEvent;
OysterByte recieveBuffer; OysterByte recieveBuffer;
@ -63,6 +64,7 @@ struct NetworkClient::PrivateData : public IThreadObject
: ID(currID++) : ID(currID++)
, parent(0) , parent(0)
, owner(0) , owner(0)
, outputEvent(1)
{ {
InitWinSock(); InitWinSock();
this->thread.Create(this, false); this->thread.Create(this, false);
@ -97,19 +99,42 @@ struct NetworkClient::PrivateData : public IThreadObject
OysterByte temp; OysterByte temp;
CustomNetProtocol p = this->sendQueue.Pop(); CustomNetProtocol p = this->sendQueue.Pop();
if(p[0].value.netShort == 304)
int i = 0;
this->translator.Pack(temp, p); this->translator.Pack(temp, p);
errorCode = this->connection.Send(temp); errorCode = this->connection.Send(temp);
if(errorCode != 0 && errorCode != WSAEWOULDBLOCK) if(errorCode != 0 && errorCode != WSAEWOULDBLOCK)
{
if( errorCode == WSAECONNABORTED || errorCode == WSAENOTCONN)
{
CEA parg;
parg.type = CEA::EventType_Disconnect;
parg.data.protocol = p;
NetEvent<NetworkClient*, CEA> e = { this->parent, parg };
this->recieveQueue.Push(e);
if(this->outputEvent)
{
printf("\t(ID: %i | IP: %s | Protocol: %i) - EventType_Disconnect && EventType_ProtocolFailedToSend \n", this->ID, this->connection.GetIpAddress().c_str(), p[0].value.netShort);
}
}
else
{ {
CEA parg; CEA parg;
parg.type = CEA::EventType_ProtocolFailedToSend; parg.type = CEA::EventType_ProtocolFailedToSend;
parg.data.protocol = p; parg.data.protocol = p;
NetEvent<NetworkClient*, CEA> e = { this->parent, parg }; NetEvent<NetworkClient*, CEA> e = { this->parent, parg };
this->recieveQueue.Push(e); this->recieveQueue.Push(e);
if(this->outputEvent)
{
printf("\t(ID: %i | IP: %s | Protocol: %i) - EventType_ProtocolFailedToSend\n", this->ID, this->connection.GetIpAddress().c_str(), p[0].value.netShort);
}
}
}
if(this->outputEvent)
{
printf("\t(ID: %i | IP: %s | Protocol: %i) Message sent!\n", this->ID, this->connection.GetIpAddress().c_str(), p[0].value.netShort);
} }
} }
@ -225,6 +250,18 @@ struct NetworkClient::PrivateData : public IThreadObject
e.args.type = parg.type; e.args.type = parg.type;
this->recieveQueue.Push(e); this->recieveQueue.Push(e);
if(this->outputEvent)
{
printf("\t(ID: %i | IP: %s | Protocol: %i) Message recieved!\n", this->ID, this->connection.GetIpAddress().c_str(), protocol[0].value.netShort);
}
}
else
{
if(this->outputEvent)
{
printf("\t(ID: %i | IP: %s) Failed to unpack CustomNetProtocol!\n", this->ID, this->connection.GetIpAddress().c_str());
}
} }
} }
}; };
@ -266,7 +303,6 @@ void NetworkClient::Update()
NetEvent<NetworkClient*, ClientEventArgs> temp = this->privateData->recieveQueue.Pop(); NetEvent<NetworkClient*, ClientEventArgs> temp = this->privateData->recieveQueue.Pop();
this->DataRecieved(temp); this->DataRecieved(temp);
} }
} }
@ -401,10 +437,11 @@ void NetworkClient::DataRecieved(NetEvent<NetworkClient*, ClientEventArgs> e)
} }
} }
//void NetworkClient::NetworkCallback(Oyster::Network::CustomNetProtocol& p)
//{}
std::string NetworkClient::GetIpAddress() std::string NetworkClient::GetIpAddress()
{ {
return this->privateData->connection.GetIpAddress(); return this->privateData->connection.GetIpAddress();
} }
void NetworkClient::OutputEventData(bool output)
{
this->privateData->outputEvent;
}

View File

@ -138,8 +138,21 @@ namespace Oyster
*/ */
virtual void DataRecieved(NetEvent<NetworkClient*, ClientEventArgs> e); virtual void DataRecieved(NetEvent<NetworkClient*, ClientEventArgs> e);
/**
*
*/
std::string GetIpAddress(); std::string GetIpAddress();
/** Dumps all activity to std::io
*
*/
void OutputEventData(bool output);
/** Dumps all activity to std::io
*
*/
void SetOutputEventDataStream(FILE out);
private: private:
NetworkClient(const NetworkClient& obj); NetworkClient(const NetworkClient& obj);
NetworkClient& operator =(const NetworkClient& obj); NetworkClient& operator =(const NetworkClient& obj);