Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6db7fe2
adding work from class in main
olli-machina Feb 25, 2022
4bede67
Work done with Allegro in class, may be temporary
olli-machina Mar 11, 2022
cc57a67
Added Adel's allegro because mine wasn't working too well, fixed bug …
olli-machina Apr 1, 2022
74ac154
Work in class, got allegro to play nice, building game systems
olli-machina Apr 1, 2022
cb337dd
Adding work so far- issue from color resolved, working on connecting
olli-machina Apr 3, 2022
447865e
They are connecting, working on error in send function
olli-machina Apr 3, 2022
297ead0
I've got a boulder!
olli-machina Apr 4, 2022
493bb77
Bubbles!
olli-machina Apr 4, 2022
c66500d
BEES!
olli-machina Apr 4, 2022
e518854
Add readme
olli-machina Apr 4, 2022
5b7f12c
potentially get help on last bug, straggler scripts
olli-machina Apr 4, 2022
c91289d
Destroy the Boulders!
olli-machina Apr 4, 2022
24c41c2
New Assignment Branch
olli-machina Apr 8, 2022
7b251b8
Starting dropping odds logic
olli-machina Apr 20, 2022
91a3f51
issues with recovering from dropped packet, working on it
olli-machina Apr 21, 2022
978f675
work in class
olli-machina Apr 22, 2022
b6861fe
Still working through catching thr drops, fixed bugs I accidentally c…
olli-machina Apr 25, 2022
f0dd1f5
starting over on some pieces, very rough work in progress but getting…
olli-machina Apr 26, 2022
a882bab
Brief work in class
olli-machina Apr 26, 2022
3afb729
issue with client in main update function
olli-machina Apr 28, 2022
8651416
Work for tonight
olli-machina Apr 29, 2022
a3ab305
Just need position to make it for the boulder at least
olli-machina May 2, 2022
643c463
fix quick variable type
olli-machina May 2, 2022
85f0e9f
position fix, getting resend packets to work
olli-machina May 4, 2022
87b1825
Issue with resending packets- not seeming to read create packet type
olli-machina May 4, 2022
283942f
Client can spawn objects confirmed, changed pending packets vector to…
olli-machina May 5, 2022
625c71c
class help
olli-machina May 5, 2022
1cff04c
implemented memcpy
olli-machina May 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
*.pdb

Debug/
packages/
1 change: 1 addition & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New Assignment, TBD
29 changes: 29 additions & 0 deletions RoboCat/Chapter3.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,17 @@
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<OutDir>Bin\$(Configuration)\</OutDir>
<Allegro_AddonImage>true</Allegro_AddonImage>
<Allegro_AddonTTF>true</Allegro_AddonTTF>
<Allegro_AddonFont>true</Allegro_AddonFont>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<Allegro_AddonImage>true</Allegro_AddonImage>
<Allegro_AddonTTF>true</Allegro_AddonTTF>
<Allegro_AddonFont>true</Allegro_AddonFont>
<Allegro_AddonColor>true</Allegro_AddonColor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
Expand Down Expand Up @@ -372,11 +379,23 @@
<ItemGroup>
<ClInclude Include="Inc\AckRange.h" />
<ClInclude Include="Inc\ByteSwap.h" />
<ClInclude Include="Inc\Colour.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="Inc\DeliveryNotificationManager.h" />
<ClInclude Include="Inc\GameObjects.h" />
<ClInclude Include="Inc\GraphicsLibrary.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="Inc\InFlightPacket.h" />
<ClInclude Include="Inc\InputSystem.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="Inc\LinkingContext.h" />
<ClInclude Include="Inc\MemoryBitStream.h" />
<ClInclude Include="Inc\NetworkManager.h" />
<ClInclude Include="Inc\OutputWindow.h" />
<ClInclude Include="Inc\PlayerController.h" />
<ClInclude Include="Inc\RoboMath.h" />
<ClInclude Include="Inc\SocketAddress.h" />
<ClInclude Include="Inc\SocketAddressFactory.h" />
Expand All @@ -389,11 +408,21 @@
<ClInclude Include="Inc\TransmissionData.h" />
<ClInclude Include="Inc\UDPSocket.h" />
<ClCompile Include="Src\AckRange.cpp" />
<ClCompile Include="Src\Colour.cpp" />
<ClCompile Include="Src\DeliveryNotificationManager.cpp" />
<ClCompile Include="Src\GameObjects.cpp" />
<ClCompile Include="Src\GraphicsLibrary.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="Src\InFlightPacket.cpp" />
<ClCompile Include="Src\InputSystem.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="Src\Main.cpp" />
<ClCompile Include="Src\MemoryBitStream.cpp" />
<ClCompile Include="Src\NetworkManager.cpp" />
<ClCompile Include="Src\OutputWindow.cpp" />
<ClCompile Include="Src\PlayerController.cpp" />
<ClCompile Include="Src\SocketAddress.cpp" />
<ClCompile Include="Src\SocketAddressFactory.cpp" />
<ClCompile Include="Src\SocketUtil.cpp" />
Expand Down
Binary file added RoboCat/Graphics/bee-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RoboCat/Graphics/boulder-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RoboCat/Graphics/bubble-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RoboCat/Graphics/field-bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions RoboCat/Inc/Colour.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once

/*
Allegro Wrapper Functions
Written by Adel Talhouk in FA21
Colour.h

File information:
This file contains data used for colours.
*/

class Colour
{
//-------------------------Private data-------------------------

//Red channel
unsigned __int8 mR;

//Green channel
unsigned __int8 mG;

//Blue channel
unsigned __int8 mB;

//Alpha channel
unsigned __int8 mA;

//-------------------------Public data-------------------------
public:

//Constructor(s)
Colour(unsigned __int8 r, unsigned __int8 g, unsigned __int8 b);
Colour(unsigned __int8 r, unsigned __int8 g, unsigned __int8 b, unsigned __int8 a);
Colour() { mR = 0; mG = 0; mB = 0; mA = 0; };

//Destructor
~Colour();

//Accessor(s)
unsigned __int8 getR() { return mR; };
unsigned __int8 getG() { return mG; };
unsigned __int8 getB() { return mB; };
unsigned __int8 getA() { return mA; };
};
8 changes: 8 additions & 0 deletions RoboCat/Inc/DeliveryNotificationManager.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#pragma once
class NetworkManager;

typedef uint16_t PacketSequenceNum;
class DeliveryNotificationManager
{
public:


DeliveryNotificationManager( bool inShouldSendAcks, bool inShouldProcessAcks );
DeliveryNotificationManager(bool inShouldSendAcks, bool inShouldProcessAcks, NetworkManager* netManager) {};
~DeliveryNotificationManager();

inline InFlightPacket* WriteState( OutputMemoryBitStream& inOutputStream );
inline bool ReadAndProcessState( InputMemoryBitStream& inInputStream );

void ProcessTimedOutPackets();

void ResendPacket(const int ID, const PacketSequenceNumber packetSeqNum);

uint32_t GetDroppedPacketCount() const { return mDroppedPacketCount; }
uint32_t GetDeliveredPacketCount() const { return mDeliveredPacketCount; }
uint32_t GetDispatchedPacketCount() const { return mDispatchedPacketCount; }
Expand Down Expand Up @@ -46,6 +52,8 @@ class DeliveryNotificationManager
uint32_t mDeliveredPacketCount;
uint32_t mDroppedPacketCount;
uint32_t mDispatchedPacketCount;

NetworkManager* mpNetworkManager;

};

Expand Down
32 changes: 32 additions & 0 deletions RoboCat/Inc/GameController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//#pragma once
//#include <string>
//#include "Colour.h"
//#include "InputSystem.h"
//
////makeshift game manager
//class GameController
//{
//
//public:
//
// GameController();
// GameController(Colour p1, Colour p2);
// ~GameController() {};
//
// void dropBoulder(float posX, float posY);
// void sendBees(char direction);
// void makeBubble(int playerID);
// void sendDart();
//
//private:
//
// std::string player1ID;
// std::string player2ID;
//
// Colour p1Color;
// Colour p2Color;
//
// int p1Score;
// int p2Score;
//
//};
127 changes: 127 additions & 0 deletions RoboCat/Inc/GameObjects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#pragma once

#include <string>
#include <utility>
#include "GraphicsLibrary.h"
#include "Colour.h"

using std::pair;

enum GameObjType
{
BOULDER,
BUBBLE,
BEE,
PLAYER,
INVALID
};

class GameObjects
{
public:
GameObjects() {};
GameObjects(GameObjType type, GraphicsLibrary* gLib, const int networkID);
GameObjects(GameObjType type, GraphicsLibrary* gLib, const int networkID, float posX, float posY, const std::string imgID = "");
GameObjects(GameObjType type, GraphicsLibrary* gLib, const int networkID, float posX, float posY, const std::string imgID, int playerID);

virtual ~GameObjects();

const GameObjType getObjType() { return mObjType; }
const int getNetworkID() { return mNetworkID; }
const pair<float, float> getPosition() { return pair<float, float>(mPosX, mPosY); }

void setPosition(float posX, float posY) { mPosX = posX; mPosY = posY; }
void setPosX(float posX) { mPosX = posX; }
void setPosY(float posY) { mPosY = posY; }
std::string getImageID() { return mIMG_ID; }

int getPlayerID() { return mPlayerID; }
void setPlayerID(int ID) { mPlayerID = ID; }

int getNum() { return mObjNum; }

virtual void update() {};
virtual void draw() {};

protected:

GameObjType mObjType;
const std::string mIMG_ID;
int mNetworkID;
float mPosX;
float mPosY;
int mPlayerID;

int mObjNum;

GraphicsLibrary* mGraphicsLib;
};


class Boulder : public GameObjects
{
public:

Boulder(GraphicsLibrary* gLib, const int networkID);
Boulder(GraphicsLibrary* gLib, const int networkID, const std::string imgID, float posX, float posY);
~Boulder() {};
void spawn(int posX, int posY) {};
void drop() {};

void update() {};
void draw();

private:

std::string mImageFileBoulder;
int mXLoc;
int mYLoc;
int mBoulderSpeed;

};

class Bees : public GameObjects
{
public:

Bees(GraphicsLibrary* gLib, const int networkID, const std::string imgID, float posX, float posY, int num);
~Bees() {};
void move() {};

void setQuantity(int num) { mObjNum = num; }
int getQuantity() { return mObjNum; }


void update();
void draw();

private:

std::string mImageFileBee;
int mBeeSpeed = 1;

};

class Bubble : public GameObjects
{
public:

Bubble(GraphicsLibrary* gLib, const int networkID, const std::string imgID, float posX, float posY, int playerID);
~Bubble() {};
void spawn(std::string playerID) {};
void pop() {};
void move() {};

void setPlayerColor(Colour color) { mBubbleColor = color; }
Colour getPlayerColor() { return mBubbleColor; }

void update();
void draw();

private:

std::string mImageFileBubble;
Colour mBubbleColor;
float mBubbleSpeed = 0.15;

};
70 changes: 70 additions & 0 deletions RoboCat/Inc/GraphicsLibrary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#pragma once


/*
Allegro Wrapper Functions
Written by Adel Talhouk in FA21
GraphicsLibrary.h

File information:
This file contains function abstractions from Allegro 5, wrapped up in my Graphics Library. This will
be used to render images and text to the screen.

Source I am consulting: Allegro 5.0.10 Manual - http://cdn.allegro.cc/file/library/allegro/5.0.10/allegro-5.0.10-manual.pdf
*/

#include <string>
#include <vector>

#include "Colour.h"

//https://github.com/liballeg/allegro_wiki/wiki/Allegro-in-Visual-Studio#using-nuget-within-visual-studio
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_acodec.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_primitives.h>

class GraphicsLibrary
{
//-------------------------Private data-------------------------

//Screen data
float mScreenSizeX;
float mScreenSizeY;

//Allegro display
ALLEGRO_DISPLAY* mpDisplay;

//Other images to draw
std::vector<std::pair<std::string, ALLEGRO_BITMAP*>> mBitmapPointersVector;

friend class InputSystem;

//-------------------------Public data-------------------------
public:

//Constructor(s)
GraphicsLibrary(float screenSizeX, float screenSizeY);

//Destructor
~GraphicsLibrary();

//Accessor(s)
float getScreenSizeX() { return mScreenSizeX; };
float getScreenSizeY() { return mScreenSizeY; };

//Mutator(s)

//Functions
bool init();
void render();
void loadImage(std::string imageFilePath, std::string imageIdentifier);

//Drawing functions
void drawImage(std::string imageIdentifier, float posX, float posY);
void drawScaledImage(std::string imageIdentifier, float posX, float posY, float scaleX, float scaleY);
void drawTintedImage(std::string imageIdentifier, float posX, float posY, Colour col);
void drawTintedScaledImage(std::string imageIdentifier, float posX, float posY, Colour col, float scaleX, float scaleY);
};
Loading