Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
499d37e
adding the code from the origin repo's updates
Vurglesplat Mar 22, 2022
bdfcf35
forgot that a lot of code was removed in update I was pulling, so pro…
Vurglesplat Mar 22, 2022
89d56d0
adding adel's allegro wrapper and folder for images
Vurglesplat Mar 22, 2022
3d4a65e
got help getting vs make allegro work
Vurglesplat Mar 22, 2022
bfdac7b
image displaying
Vurglesplat Mar 22, 2022
5fb42cc
added a bunch of images to use, got a pre-game menu set up
Vurglesplat Mar 22, 2022
73f3e22
first set up of the UDP socket, needs to be tested
Vurglesplat Mar 22, 2022
f3dd9dd
got rid of the atomic bool because they apparently just don't work on…
Vurglesplat Mar 22, 2022
54c0bdd
first pass of the listening thread implemented
Vurglesplat Mar 22, 2022
92509d2
got listening blocking and the framework for the initial connection s…
Vurglesplat Mar 23, 2022
fdc27b9
got the first connection working, need to set up sending for host and…
Vurglesplat Mar 26, 2022
3727179
got allegro working for console outside of VS
Vurglesplat Mar 27, 2022
855efde
Input system set up
Vurglesplat Mar 27, 2022
b6ef74e
got input update working and updating
Vurglesplat Mar 28, 2022
c2ebafd
added a new wrapper class around the network functions
Vurglesplat Mar 29, 2022
e74c98a
tested and cleaned up the wrapper class
Vurglesplat Mar 29, 2022
c801e4a
world state with update, basic lock object, and render
NicholasPerell Mar 29, 2022
42130c8
removed some unnecessary comments
NicholasPerell Mar 29, 2022
9163b9c
resizing and looking at Nick's stuff
Vurglesplat Mar 29, 2022
53b7d8b
read/write function for world and first gameObj written
NicholasPerell Mar 29, 2022
3dad022
started input sending
Vurglesplat Mar 29, 2022
f840aa0
took Nick's version of changes
Vurglesplat Mar 29, 2022
e0874da
fixed lock passthrough of its string
NicholasPerell Mar 29, 2022
82e619b
Merge branch 'main' of https://github.com/nicholas-hoy-champain/Socke…
Vurglesplat Mar 29, 2022
bd45ab6
merging my work on joinerInput w/ Nick's
Vurglesplat Mar 29, 2022
0e44dc9
fixed handling the wrong function
Vurglesplat Mar 29, 2022
0d5784c
input sending test set up
Vurglesplat Mar 29, 2022
060f3d9
cleared out the input buffer after sending them, also added debug mes…
Vurglesplat Mar 29, 2022
daf5d5f
World state is now sent over UDP!
NicholasPerell Mar 29, 2022
308cdca
joiners inputs are correctly sent and recieved
Vurglesplat Mar 29, 2022
6d0e4c5
objects can now be destroyed and the joiner will reflect that
NicholasPerell Mar 29, 2022
c067841
keys spawn
Vurglesplat Mar 29, 2022
c231c0d
clicking spawns locks
Vurglesplat Mar 29, 2022
a43f1d7
cleaned up the presentation, good to go
Vurglesplat Mar 29, 2022
624acbf
first draft of the merge
Vurglesplat Apr 1, 2022
bc97548
got the assignment working, there was a header wrapper missing
Vurglesplat Apr 1, 2022
7cda5e0
adding the todo list and different backgrounds for creator and joiner
Vurglesplat Apr 5, 2022
0a0c9ab
delta time for timestep
NicholasPerell Apr 8, 2022
83c6ac1
newest world input is processed first
Vurglesplat Apr 8, 2022
0a77f28
Merge branch 'devAssignment3' of https://github.com/nicholas-hoy-cham…
Vurglesplat Apr 8, 2022
5eb0917
world state reverted to a workable state
NicholasPerell Apr 8, 2022
acf4099
Merge branch 'devAssignment3' of https://github.com/nicholas-hoy-cham…
Vurglesplat Apr 8, 2022
fee9620
newest packet is used first for world state update, even if delivered…
Vurglesplat Apr 8, 2022
dd14cc9
cleaned up git remnant files, updated todo and commented out the debu…
Vurglesplat Apr 9, 2022
4628d99
joiner now disconnects after not recieving world state update for 7 s…
Vurglesplat Apr 9, 2022
22724a0
disconnecting now handled, updated the todo list
Vurglesplat Apr 12, 2022
4dcb9d0
packets now get dropped
Vurglesplat Apr 12, 2022
1460e7d
increased rate that joiner confirmatoin msgs are sent in case some drop
Vurglesplat Apr 12, 2022
1d833d8
delay on some packet sends
Vurglesplat Apr 12, 2022
7c4791b
cleaned up debug messages and updated to do list
Vurglesplat Apr 12, 2022
cc6dc50
game now closes properly via atomic variables
Vurglesplat Apr 12, 2022
4375802
isolated allegro's render causing the crash
Vurglesplat Apr 12, 2022
f3a6cc3
packet delays are implemented much better and the todo has been updated
Vurglesplat Apr 12, 2022
7168226
fixing allegro crash message
Vurglesplat Apr 12, 2022
668225c
inputs now have a method to prevent lost packets being permanently dr…
Vurglesplat Apr 13, 2022
14034ab
fixed minor spelling mistake
NicholasPerell Apr 13, 2022
e7bc4f6
removing the allegro bug
Vurglesplat Apr 29, 2022
a082f69
game loops through the items to delete backwards
Vurglesplat Apr 29, 2022
e85e6e8
fixed the issue of spawning a key from a missed packet incorrectly
Vurglesplat Apr 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions GameFiles/Coin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "RoboCatPCH.h"
#include "Coin.h"

Coin::Coin() : GameObject("coinGold.png", 70, 70)
{

}

Coin::Coin(int posX, int posY) : GameObject("coinGold.png", posX, posY, 70, 70)
{

}

Coin::~Coin()
{
}

void Coin::Update(WorldState* gameWorld, int delta)
{
//if (mGraphicsData.mX > 1500) mGraphicsData.mX = 0;
//mGraphicsData.mX++;
}
16 changes: 16 additions & 0 deletions GameFiles/Coin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once
#include "GameObject.h"
class Coin :
public GameObject
{
private:
Coin();
Coin(int posX, int posY);
~Coin();
protected:
public:
virtual void Update(WorldState* gameWorld, int delta);

CLASS_IDENTIFICATION('COIN', Coin)
};

60 changes: 60 additions & 0 deletions GameFiles/GameObject.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include "RoboCatPCH.h"
#include "..\GameFiles\GameObject.h"
#include "allegro_wrapper_functions-main/GraphicsLibrary.h"

GameObject::GameObject(std::string graphicsID, int posX, int posY, int width, int height)
{
mpGraphicsID = new std::string(graphicsID);
mGraphicsData.mX = posX;
mGraphicsData.mY = posY;
mGraphicsData.mZ = width;
mGraphicsData.mW = height;
}

GameObject::GameObject(std::string graphicsID, int width, int height)
{
mpGraphicsID = new std::string(graphicsID);
mGraphicsData.mX = 0;
mGraphicsData.mY = 0;
mGraphicsData.mZ = width;
mGraphicsData.mW = height;
}

void GameObject::Write(OutputMemoryBitStream& stream)
{
stream.Write(mGraphicsData.mX);
stream.Write(mGraphicsData.mY);
stream.Write(mGraphicsData.mZ);
stream.Write(mGraphicsData.mW);
stream.Write(*mpGraphicsID);
}

void GameObject::Read(InputMemoryBitStream& stream)
{
stream.Read(mGraphicsData.mX);
stream.Read(mGraphicsData.mY);
stream.Read(mGraphicsData.mZ);
stream.Read(mGraphicsData.mW);
stream.Read(*mpGraphicsID);
}

void GameObject::Render(GraphicsLibrary* gl)
{
gl->drawImage(*mpGraphicsID, mGraphicsData.mX - (mGraphicsData.mZ / 2.0f), mGraphicsData.mY - (mGraphicsData.mW / 2.0f));
}

void GameObject::SetPostion(int posX, int posY)
{
mGraphicsData.mX = posX;
mGraphicsData.mY = posY;
}

Vector3 GameObject::GetPosition()
{
return Vector3(mGraphicsData.mX,mGraphicsData.mY,0);
}

GameObject::~GameObject()
{
delete mpGraphicsID;
}
35 changes: 35 additions & 0 deletions GameFiles/GameObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once
#include <string>

class GraphicsLibrary;
class WorldState;

class GameObject
{
private:
protected:
GameObject(std::string graphicsID, int posX, int posY, int width, int height);
GameObject(std::string graphicsID, int width, int height);
Quaternion mGraphicsData; //X,Y Position Z,W Sizing
std::string* mpGraphicsID;
public:
enum { mClassId = 'GOBJ' };
virtual uint32_t GetClassId() const { return mClassId; }
virtual void Update(WorldState* gameWorld, int delta) = 0;
virtual void Write(OutputMemoryBitStream &stream);
virtual void Read(InputMemoryBitStream &stream);
virtual void Render(GraphicsLibrary* gl);
void SetPostion(int posX, int posY);
Vector3 GetPosition();
~GameObject();
};
struct Location
{
float x;
float y;
};
#define CLASS_IDENTIFICATION( inCode, inClass ) \
enum{ mClassId = inCode }; \
virtual uint32_t GetClassId() const { return mClassId; } \
static GameObject* CreateInstance() { return new inClass(); }\
friend WorldState;
55 changes: 55 additions & 0 deletions GameFiles/JoinerInput.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

#include "RoboCatPCH.h"
#include "JoinerInput.h"

unsigned int JoinerInput::inputIdIterator = 0;

JoinerInput::JoinerInput(InputActionIDs initalType, Location loc)
{
timeOfCreation = time(0);
inputIDType = initalType;
location = loc;

if (inputIDType == InputActionIDs::JOINER_KEY_SPAWN)
inputID = ++JoinerInput::inputIdIterator;
else
inputID = 00; //these don't need an id

}

void JoinerInput::Write(OutputMemoryBitStream& stream)
{
stream.Write(inputIDType);
stream.Write(timeOfCreation);
stream.Write(location.x);
stream.Write(location.y);
stream.Write(inputID);
}

void JoinerInput::Write(OutputMemoryBitStream& stream, vector<JoinerInput>& joinerInputs)
{
GameObject* tempObj;
stream.Write(joinerInputs.size());
for (int i = 0; i < joinerInputs.size(); i++)
{
joinerInputs[i].Write(stream);
}
}

void JoinerInput::Read(InputMemoryBitStream& stream, vector<JoinerInput>& joinerInputs)
{
int count;
stream.Read(count);
for (int i = 0; i < count; i++)
{
JoinerInput current;

stream.Read(current.inputIDType);
stream.Read(current.timeOfCreation);
stream.Read(current.location.x);
stream.Read(current.location.y);
stream.Read(current.inputID);

joinerInputs.push_back(current);
}
}
39 changes: 39 additions & 0 deletions GameFiles/JoinerInput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#pragma once
#include <stdlib.h>
#include "GameObject.h"
#include "GameFiles/WorldState.h"


class JoinerInput
{
public:


enum InputActionIDs
{
JOINER_KEY_SPAWN,
CONNECTION_CONFIRMATION_MESSAGE
};

time_t timeOfCreation;
InputActionIDs inputIDType;
Location location;

int inputID;
static unsigned int inputIdIterator;

JoinerInput(InputActionIDs initalType, Location loc);

static void Write(OutputMemoryBitStream& stream, vector<JoinerInput>& joinerInputs);

static void Read(InputMemoryBitStream& stream, vector<JoinerInput>& joinerInputs);

private:


void Write(OutputMemoryBitStream& stream);
JoinerInput()
{
;
}
};
40 changes: 40 additions & 0 deletions GameFiles/Key.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "RoboCatPCH.h"
#include "Key.h"
#include "Lock.h"
#include "Coin.h"
#include "WorldState.h"

Key::Key() : GameObject("keyBlue.png", 70, 70)
{

}

Key::Key(int posX, int posY) : GameObject("keyBlue.png", posX, posY, 70, 70)
{

}

Key::~Key()
{
}

void Key::Update(WorldState* gameWorld, int delta)
{
if (mGraphicsData.mX < 0) mGraphicsData.mX = 1500;

mGraphicsData.mX -= MOVE_SPEED * delta;

for (int i = 0; i < gameWorld->mGameObjects.size(); i++)
{
if (gameWorld->mGameObjects[i]->GetClassId() == 'LOCK'
&& (gameWorld->mGameObjects[i]->GetPosition() - GetPosition()).Length2D() < mGraphicsData.mZ)
{

gameWorld->Create<Coin>(mGraphicsData.mX,mGraphicsData.mY);
gameWorld->SetForDestroy(gameWorld->mGameObjects[i]);
gameWorld->SetForDestroy(this);
break;
}
}

}
18 changes: 18 additions & 0 deletions GameFiles/Key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#include "GameObject.h"
class Key :
public GameObject
{
private:
const float MOVE_SPEED = 0.1f;

Key();
Key(int posX, int posY);
~Key();
protected:
public:
virtual void Update(WorldState* gameWorld, int delta);

CLASS_IDENTIFICATION('KEYS', Key)
};

25 changes: 25 additions & 0 deletions GameFiles/Lock.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

#include "RoboCatPCH.h"
#include "Lock.h"


Lock::Lock() : GameObject("lock_blue.png", 70, 70)
{

}

Lock::Lock(int posX, int posY) : GameObject("lock_blue.png", posX, posY, 70, 70)
{

}

Lock::~Lock()
{
}

void Lock::Update(WorldState* gameWorld, int delta)
{
if (mGraphicsData.mX > 1500) mGraphicsData.mX = 0;

mGraphicsData.mX += MOVE_SPEED * delta;
}
17 changes: 17 additions & 0 deletions GameFiles/Lock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include "GameObject.h"

class Lock : public GameObject
{
const float MOVE_SPEED = 0.25;

private:
Lock();
Lock(int posX, int posY);
~Lock();
protected:
public:
virtual void Update(WorldState* gameWorld, int delta);

CLASS_IDENTIFICATION('LOCK', Lock)
};
Loading