GameServer - Merged with other half of GameLogic
This commit is contained in:
commit
eb9360377d
|
@ -1,4 +1,334 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<diagram program="umlet" version="12.2">
|
||||
<diagram program="umlet" version="12.1">
|
||||
<zoom_level>10</zoom_level>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>390</x>
|
||||
<y>120</y>
|
||||
<w>100</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>/C_Object/
|
||||
</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>320</x>
|
||||
<y>0</y>
|
||||
<w>100</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>C_Player</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>440</x>
|
||||
<y>0</y>
|
||||
<w>100</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>C_StaticObj</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>200</x>
|
||||
<y>0</y>
|
||||
<w>100</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>C_DynamicObj</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>240</x>
|
||||
<y>0</y>
|
||||
<w>200</w>
|
||||
<h>140</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<-</panel_attributes>
|
||||
<additional_attributes>30;30;30;120;180;120</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>370</x>
|
||||
<y>0</y>
|
||||
<w>50</w>
|
||||
<h>140</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<-</panel_attributes>
|
||||
<additional_attributes>30;30;30;120</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>450</x>
|
||||
<y>0</y>
|
||||
<w>50</w>
|
||||
<h>140</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<-</panel_attributes>
|
||||
<additional_attributes>30;30;30;120</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>210</x>
|
||||
<y>220</y>
|
||||
<w>100</w>
|
||||
<h>100</h>
|
||||
</coordinates>
|
||||
<panel_attributes>GameState
|
||||
--
|
||||
C_Object*
|
||||
GameState
|
||||
Camera
|
||||
Client*</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>360</x>
|
||||
<y>330</y>
|
||||
<w>160</w>
|
||||
<h>50</h>
|
||||
</coordinates>
|
||||
<panel_attributes>/GameClientState/
|
||||
Is eighter game or lobby </panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>570</x>
|
||||
<y>220</y>
|
||||
<w>100</w>
|
||||
<h>100</h>
|
||||
</coordinates>
|
||||
<panel_attributes>LobbyState
|
||||
--
|
||||
C_Object*
|
||||
Camera
|
||||
Client*</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>380</x>
|
||||
<y>440</y>
|
||||
<w>120</w>
|
||||
<h>120</h>
|
||||
</coordinates>
|
||||
<panel_attributes>DanBiasGame
|
||||
--
|
||||
Client
|
||||
Input
|
||||
GameClientState
|
||||
Window</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>400</x>
|
||||
<y>350</y>
|
||||
<w>50</w>
|
||||
<h>110</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<<<-</panel_attributes>
|
||||
<additional_attributes>30;90;30;30</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>230</x>
|
||||
<y>290</y>
|
||||
<w>150</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<-</panel_attributes>
|
||||
<additional_attributes>30;30;30;60;130;60</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>490</x>
|
||||
<y>290</y>
|
||||
<w>150</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<-</panel_attributes>
|
||||
<additional_attributes>130;30;130;60;30;60</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>560</x>
|
||||
<y>0</y>
|
||||
<w>100</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>C_UiObject</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>410</x>
|
||||
<y>0</y>
|
||||
<w>210</w>
|
||||
<h>140</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<-</panel_attributes>
|
||||
<additional_attributes>190;30;190;120;30;120</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>410</x>
|
||||
<y>120</y>
|
||||
<w>180</w>
|
||||
<h>120</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<<-</panel_attributes>
|
||||
<additional_attributes>160;100;30;100;30;30</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>280</x>
|
||||
<y>120</y>
|
||||
<w>170</w>
|
||||
<h>120</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<<-</panel_attributes>
|
||||
<additional_attributes>30;100;150;100;150;30</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>620</x>
|
||||
<y>120</y>
|
||||
<w>100</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Light</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>340</x>
|
||||
<y>640</y>
|
||||
<w>100</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>NetworkAPI
|
||||
--</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>230</x>
|
||||
<y>640</y>
|
||||
<w>100</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>GraphicsAPI
|
||||
--
|
||||
</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>230</x>
|
||||
<y>530</y>
|
||||
<w>170</w>
|
||||
<h>130</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<.</panel_attributes>
|
||||
<additional_attributes>30;110;30;30;150;30</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>360</x>
|
||||
<y>530</y>
|
||||
<w>50</w>
|
||||
<h>130</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<.</panel_attributes>
|
||||
<additional_attributes>30;110;30;30</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>460</x>
|
||||
<y>640</y>
|
||||
<w>100</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Input
|
||||
--</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>460</x>
|
||||
<y>530</y>
|
||||
<w>50</w>
|
||||
<h>130</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<.</panel_attributes>
|
||||
<additional_attributes>30;110;30;30</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>120</x>
|
||||
<y>520</y>
|
||||
<w>110</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>DanBiasLancher
|
||||
--</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Class</type>
|
||||
<coordinates>
|
||||
<x>580</x>
|
||||
<y>640</y>
|
||||
<w>110</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>WindowManager
|
||||
--</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<type>com.umlet.element.Relation</type>
|
||||
<coordinates>
|
||||
<x>470</x>
|
||||
<y>530</y>
|
||||
<w>190</w>
|
||||
<h>130</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<.</panel_attributes>
|
||||
<additional_attributes>170;110;170;30;30;30</additional_attributes>
|
||||
</element>
|
||||
</diagram>
|
||||
|
|
|
@ -70,6 +70,7 @@ namespace DanBias
|
|||
|
||||
Client::GameClientState::NewObj* protocolData = new Client::GameClientState::NewObj;
|
||||
protocolData->object_ID = p[1].value.netInt;
|
||||
char k = p[2].value.netChar;
|
||||
protocolData->path = p[2].value.netCharPtr;
|
||||
for(int i = 0; i< 16; i++)
|
||||
{
|
||||
|
@ -152,6 +153,7 @@ namespace DanBias
|
|||
|
||||
|
||||
DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
|
||||
float DanBiasGame::capFrame = 0;
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Interface API functions
|
||||
|
@ -196,10 +198,16 @@ namespace DanBias
|
|||
float dt = (float)m_data->timer->getElapsedSeconds();
|
||||
m_data->timer->reset();
|
||||
|
||||
if(Update(dt) != S_OK)
|
||||
return DanBiasClientReturn_Error;
|
||||
if(Render(dt) != S_OK)
|
||||
return DanBiasClientReturn_Error;
|
||||
capFrame += dt;
|
||||
if(capFrame > 0.03)
|
||||
{
|
||||
if(Update(dt) != S_OK)
|
||||
return DanBiasClientReturn_Error;
|
||||
if(Render(dt) != S_OK)
|
||||
return DanBiasClientReturn_Error;
|
||||
capFrame = 0;
|
||||
}
|
||||
|
||||
}
|
||||
return DanBiasClientReturn_Sucess;
|
||||
}
|
||||
|
|
|
@ -18,10 +18,16 @@ struct GameState::myData
|
|||
Oyster::Network::NetworkClient* nwClient;
|
||||
gameStateState state;
|
||||
|
||||
|
||||
|
||||
}privData;
|
||||
|
||||
GameState::GameState(void)
|
||||
{
|
||||
key_forward = false;
|
||||
key_backward = false;
|
||||
key_strafeRight = false;
|
||||
key_strafeLeft = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,24 +127,53 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI
|
|||
|
||||
if(KeyInput->IsKeyPressed(DIK_W))
|
||||
{
|
||||
movePlayer.bForward = true;
|
||||
send = true;
|
||||
|
||||
if(!key_forward)
|
||||
{
|
||||
movePlayer.bForward = true;
|
||||
send = true;
|
||||
key_forward = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
key_forward = false;
|
||||
|
||||
if(KeyInput->IsKeyPressed(DIK_S))
|
||||
{
|
||||
movePlayer.bBackward = true;
|
||||
send = true;
|
||||
if(!key_backward)
|
||||
{
|
||||
movePlayer.bBackward = true;
|
||||
send = true;
|
||||
key_backward = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
key_backward = false;
|
||||
|
||||
if(KeyInput->IsKeyPressed(DIK_A))
|
||||
{
|
||||
movePlayer.bStrafeLeft = true;
|
||||
send = true;
|
||||
if(!key_strafeLeft)
|
||||
{
|
||||
movePlayer.bStrafeLeft = true;
|
||||
send = true;
|
||||
key_strafeLeft = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
key_strafeLeft = false;
|
||||
|
||||
if(KeyInput->IsKeyPressed(DIK_D))
|
||||
{
|
||||
movePlayer.bStrafeRight = true;
|
||||
send = true;
|
||||
if(!key_strafeRight)
|
||||
{
|
||||
movePlayer.bStrafeRight = true;
|
||||
send = true;
|
||||
key_strafeRight = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
key_strafeRight = false;
|
||||
|
||||
|
||||
if (privData->nwClient->IsConnected() && send)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,11 @@ class GameState : public GameClientState
|
|||
};
|
||||
private:
|
||||
|
||||
bool key_forward;
|
||||
bool key_backward;
|
||||
bool key_strafeRight;
|
||||
bool key_strafeLeft;
|
||||
|
||||
struct myData;
|
||||
myData* privData;
|
||||
public:
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace DanBias
|
|||
static HRESULT Render(float deltaTime);
|
||||
static HRESULT CleanUp();
|
||||
|
||||
static float capFrame;
|
||||
|
||||
private:
|
||||
static DanBiasGamePrivateData* m_data;
|
||||
|
||||
|
|
|
@ -58,12 +58,7 @@ void Game::GetAllPlayerPos()
|
|||
|
||||
Game::PlayerData Game::CreatePlayer()
|
||||
{
|
||||
PlayerData data;
|
||||
//Yo mammma
|
||||
data.playerID = GID();
|
||||
data.teamID = -1;
|
||||
|
||||
return data;
|
||||
return PlayerData();
|
||||
}
|
||||
|
||||
void Game::CreateTeam()
|
||||
|
|
|
@ -28,27 +28,46 @@ namespace GameLogic
|
|||
this->protocol[i].type = Oyster::Network::NetAttributeType_Float;
|
||||
}
|
||||
}
|
||||
Protocol_CreateObject(float m[16], int id, char *path)
|
||||
{
|
||||
this->protocol[protocol_INDEX_ID].value = protocol_Gameplay_CreateObject;
|
||||
this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Int;
|
||||
|
||||
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
||||
|
||||
for (int i = 2; i <= 17; i++)
|
||||
{
|
||||
this->protocol[i].type = Oyster::Network::NetAttributeType_Float;
|
||||
}
|
||||
|
||||
object_ID = id;
|
||||
this->path = path;
|
||||
memcpy(&worldMatrix[0], &m[0], sizeof(float)*16);
|
||||
}
|
||||
Oyster::Network::CustomNetProtocol* GetProtocol() override
|
||||
{
|
||||
|
||||
this->protocol[1].value = object_ID;
|
||||
this->protocol[2].value = path;
|
||||
this->protocol[3].value = worldMatrix[1];
|
||||
this->protocol[4].value = worldMatrix[2];
|
||||
this->protocol[5].value = worldMatrix[3];
|
||||
this->protocol[6].value = worldMatrix[4];
|
||||
this->protocol[7].value = worldMatrix[5];
|
||||
this->protocol[8].value = worldMatrix[6];
|
||||
this->protocol[9].value = worldMatrix[7];
|
||||
this->protocol[10].value = worldMatrix[8];
|
||||
this->protocol[11].value = worldMatrix[9];
|
||||
this->protocol[12].value = worldMatrix[10];
|
||||
this->protocol[13].value = worldMatrix[11];
|
||||
this->protocol[14].value = worldMatrix[12];
|
||||
this->protocol[15].value = worldMatrix[13];
|
||||
this->protocol[16].value = worldMatrix[14];
|
||||
this->protocol[17].value = worldMatrix[15];
|
||||
this->protocol[18].value = worldMatrix[16];
|
||||
this->protocol[3].value = worldMatrix[0];
|
||||
this->protocol[4].value = worldMatrix[1];
|
||||
this->protocol[5].value = worldMatrix[2];
|
||||
this->protocol[6].value = worldMatrix[3];
|
||||
this->protocol[7].value = worldMatrix[4];
|
||||
this->protocol[8].value = worldMatrix[5];
|
||||
this->protocol[9].value = worldMatrix[6];
|
||||
this->protocol[10].value = worldMatrix[7];
|
||||
this->protocol[11].value = worldMatrix[8];
|
||||
this->protocol[12].value = worldMatrix[9];
|
||||
this->protocol[13].value = worldMatrix[10];
|
||||
this->protocol[14].value = worldMatrix[11];
|
||||
this->protocol[15].value = worldMatrix[12];
|
||||
this->protocol[16].value = worldMatrix[13];
|
||||
this->protocol[17].value = worldMatrix[14];
|
||||
this->protocol[18].value = worldMatrix[15];
|
||||
|
||||
|
||||
|
||||
|
||||
return &protocol;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue