Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dd9e165
Added section 2 notes
sabarrett Jan 28, 2022
8fc161f
Add notes on threads
sabarrett Feb 4, 2022
32fcbd4
Merge branch 'tut3-section1-notes'
charliekowalski Feb 15, 2022
f8ed3ff
Revert "Merge branch 'tut3-section1-notes'"
charliekowalski Feb 15, 2022
627fa79
completed the very basics, C worthy
charliekowalski Feb 16, 2022
cd87e01
finished proj
charliekowalski Feb 18, 2022
99f3681
Merge branch 'sbarrettCC:main' into main
charliekowalski Mar 28, 2022
35413b8
Merge branch 'assignment2'
charliekowalski Mar 28, 2022
fada357
added work
charliekowalski Mar 28, 2022
b7a4abe
added graphics function
charliekowalski Mar 31, 2022
dcd9fad
merge
charliekowalski Apr 8, 2022
f288290
now just does nothing
charliekowalski Apr 11, 2022
4f4f854
- receive function broke
Apr 12, 2022
dd4d50b
fixed send/receive issue
charliekowalski Apr 12, 2022
ebe9462
"finished" Project two
charliekowalski Apr 14, 2022
888e44b
Merge remote-tracking branch 'upstream/assignment3'
charliekowalski Apr 15, 2022
d55b9ac
added base functions for reliability layer
charliekowalski Apr 15, 2022
35fc818
added workflows
charliekowalski Apr 15, 2022
c91c37a
made changes to assignment two, started work for assignment 3
charliekowalski Apr 15, 2022
df5eb41
ASSIGNMENT 2 DONE
Apr 16, 2022
e1704e8
start a3
Apr 17, 2022
1f48fff
added pragmas
charliekowalski Apr 18, 2022
b200a84
FINISH A2 FOR REAL THIS TIME WE SWEAR
Apr 18, 2022
0283ce1
scott help
charliekowalski Apr 18, 2022
eab3e6f
project 3 work
charliekowalski Apr 25, 2022
fa9835b
implemented jitter, need a way to test
charliekowalski Apr 25, 2022
97d4fb1
added movement
charliekowalski Apr 28, 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
  •  
  •  
  •  
Binary file added RoboCat/Bin/Debug/SocketDemo.exe
Binary file not shown.
Binary file added RoboCat/Bin/Debug/SocketDemo.pdb
Binary file not shown.
Binary file added RoboCat/Bin/Debug/allegro-5.2.dll
Binary file not shown.
Binary file added RoboCat/Bin/Debug/allegro_color-5.2.dll
Binary file not shown.
Binary file added RoboCat/Bin/Debug/allegro_image-5.2.dll
Binary file not shown.
35 changes: 26 additions & 9 deletions RoboCat/Chapter3.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,36 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|X64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
Expand All @@ -92,10 +92,15 @@
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<OutDir>Bin\$(Configuration)\</OutDir>
<LibraryPath>$(LibraryPath)</LibraryPath>
<Allegro_AddonImage>true</Allegro_AddonImage>
<Allegro_AddonColor>true</Allegro_AddonColor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<IncludePath>C:\Users\Charlie\Desktop\College\NetworkingProj1\SDL"C:\Users\Charlie\Desktop\College\NetworkingProj1\SDL\include;$(IncludePath)</IncludePath>
<LibraryPath>"C:\Users\Charlie\Desktop\College\NetworkingProj1\SDL\lib\win\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
Expand Down Expand Up @@ -127,9 +132,10 @@
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<AdditionalIncludeDirectories>..\SDL\include;Inc;..\</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<AdditionalIncludeDirectories>inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>RoboCatPCH.h</PrecompiledHeaderFile>
<SDLCheck>false</SDLCheck>
</ClCompile>
<Link>
<AdditionalDependencies>d3d11.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies);Ws2_32.lib</AdditionalDependencies>
Expand Down Expand Up @@ -175,7 +181,7 @@
</ClCompile>
<Link>
<AdditionalOptions> %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>d3d11.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>d3d11.lib;dxguid.lib;winmm.lib;comctl32.lib;SDL.lib;SDLmain.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<LargeAddressAware>true</LargeAddressAware>
Expand Down Expand Up @@ -370,12 +376,19 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="LagSimulator.cpp" />
<ClCompile Include="Src\Network.cpp" />
<ClCompile Include="TransmissionData.cpp" />
<ClInclude Include="Inc\AckRange.h" />
<ClInclude Include="Inc\ByteSwap.h" />
<ClInclude Include="Inc\DeliveryNotificationManager.h" />
<ClInclude Include="Inc\GameObjects.h" />
<ClInclude Include="Inc\GraphicsSystems.h" />
<ClInclude Include="Inc\InFlightPacket.h" />
<ClInclude Include="Inc\InputSystem.h" />
<ClInclude Include="Inc\LinkingContext.h" />
<ClInclude Include="Inc\MemoryBitStream.h" />
<ClInclude Include="Inc\Network.h" />
<ClInclude Include="Inc\OutputWindow.h" />
<ClInclude Include="Inc\RoboMath.h" />
<ClInclude Include="Inc\SocketAddress.h" />
Expand All @@ -390,7 +403,10 @@
<ClInclude Include="Inc\UDPSocket.h" />
<ClCompile Include="Src\AckRange.cpp" />
<ClCompile Include="Src\DeliveryNotificationManager.cpp" />
<ClCompile Include="Src\GameObjects.cpp" />
<ClCompile Include="Src\GraphicsSystems.cpp" />
<ClCompile Include="Src\InFlightPacket.cpp" />
<ClCompile Include="Src\InputSystem.cpp" />
<ClCompile Include="Src\Main.cpp" />
<ClCompile Include="Src\MemoryBitStream.cpp" />
<ClCompile Include="Src\OutputWindow.cpp" />
Expand All @@ -399,6 +415,7 @@
<ClCompile Include="Src\SocketUtil.cpp" />
<ClCompile Include="Src\StringUtils.cpp" />
<ClCompile Include="Src\TCPSocket.cpp" />
<ClInclude Include="LagSimulator.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Src\RoboCatPCH.cpp">
Expand Down
4 changes: 4 additions & 0 deletions RoboCat/Chapter3.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
1 change: 1 addition & 0 deletions RoboCat/Debug/Chapter3.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
 Chapter3.vcxproj -> E:\GitProjects\College\SocketDemo\RoboCat\Bin\Debug\SocketDemo.exe
Binary file added RoboCat/Debug/GameObjects.obj
Binary file not shown.
Binary file added RoboCat/Debug/GraphicsSystems.obj
Binary file not shown.
Binary file added RoboCat/Debug/InputSystem.obj
Binary file not shown.
Binary file added RoboCat/Debug/Main.obj
Binary file not shown.
Binary file added RoboCat/Debug/MemoryBitStream.obj
Binary file not shown.
Binary file added RoboCat/Debug/Network.obj
Binary file not shown.
Binary file added RoboCat/Debug/OutputWindow.obj
Binary file not shown.
Binary file added RoboCat/Debug/RoboCatPCH.obj
Binary file not shown.
Binary file added RoboCat/Debug/SocketAddress.obj
Binary file not shown.
Binary file added RoboCat/Debug/SocketAddressFactory.obj
Binary file not shown.
11 changes: 11 additions & 0 deletions RoboCat/Debug/SocketDemo.exe.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>E:\GitProjects\College\SocketDemo\RoboCat\Bin\Debug\SocketDemo.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>
Binary file added RoboCat/Debug/SocketDemo.ilk
Binary file not shown.
Binary file added RoboCat/Debug/SocketDemo.pch
Binary file not shown.
Binary file added RoboCat/Debug/SocketDemo.tlog/CL.command.1.tlog
Binary file not shown.
Binary file added RoboCat/Debug/SocketDemo.tlog/CL.read.1.tlog
Binary file not shown.
Binary file added RoboCat/Debug/SocketDemo.tlog/CL.write.1.tlog
Binary file not shown.
2 changes: 2 additions & 0 deletions RoboCat/Debug/SocketDemo.tlog/SocketDemo.lastbuildstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.31.31103:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|E:\GitProjects\College\SocketDemo\|
Binary file added RoboCat/Debug/SocketDemo.tlog/link.command.1.tlog
Binary file not shown.
Binary file added RoboCat/Debug/SocketDemo.tlog/link.read.1.tlog
Binary file not shown.
Binary file added RoboCat/Debug/SocketDemo.tlog/link.write.1.tlog
Binary file not shown.
Binary file added RoboCat/Debug/SocketUtil.obj
Binary file not shown.
Binary file added RoboCat/Debug/StringUtils.obj
Binary file not shown.
Binary file added RoboCat/Debug/TCPSocket.obj
Binary file not shown.
Binary file added RoboCat/Debug/UDPSocket.obj
Binary file not shown.
Binary file added RoboCat/Debug/vc143.pdb
Binary file not shown.
Binary file added RoboCat/Images/SCOTT.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/Images/amongUs.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/Images/dean_spritesCropped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions RoboCat/Inc/AckRange.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
//typedef PacketSequenceNumber uint16_t;

class AckRange
Expand Down
2 changes: 1 addition & 1 deletion RoboCat/Inc/DeliveryNotificationManager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#pragma once
class DeliveryNotificationManager
{
public:
Expand Down
67 changes: 67 additions & 0 deletions RoboCat/Inc/GameObjects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#pragma once
#include <GraphicsSystems.h>

#include <vector>
#include <string>
#include <map>
#include <utility>

using std::vector;
using std::pair;
using std::string;
using std::map;

enum ClassId
{
DEFAULT = 'AAAA',
DEANSPRITE = 'RJGH',
AMONGUS = 'JJGD',
SCOTTSPRITE = 'LJDE',
};

class GameObject
{
public:

GameObject() {};
virtual ~GameObject();
virtual void Draw();

int getNetworkId() { return mNetworkId; };
void setNetworkId(int newNetworkId) { mNetworkId = newNetworkId; };

std::pair<float, float> getPosition() { return mPosition; };
void setPosition(float positionX, float positionY) { mPosition.first = positionX; mPosition.second = positionY; };

ClassId getClassId() { return mId; };
GraphicsSystems* getGraphics() { return mGraphics; };

ALLEGRO_BITMAP* getmpBitmap() { return mpBitmap; };
protected:
GameObject(int networkId, std::pair<float, float> position, GraphicsSystems* graphics, std::string imageFilePath, ClassId id = DEFAULT);
private:
int mNetworkId;
std::pair<float, float> mPosition;
ClassId mId;
GraphicsSystems* mGraphics;
ALLEGRO_BITMAP* mpBitmap;

};

class DeanSprite : public GameObject
{
public:
DeanSprite(int networkId, std::pair<float, float> position, std::string imageFilePath, GraphicsSystems* graphics);
};

class AmongUs : public GameObject
{
public:
AmongUs(int networkId, std::pair<float, float> position, std::string imageFilePath, GraphicsSystems* graphics);
};

class ScottSprite : public GameObject
{
public:
ScottSprite(int networkId, std::pair<float, float> position, std::string imageFilePath, GraphicsSystems* graphics);
};
39 changes: 39 additions & 0 deletions RoboCat/Inc/GraphicsSystems.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#pragma once
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
#include <vector>
#include <string>
#include <map>
#include <utility>

using std::vector;
using std::pair;
using std::string;
using std::map;

class GraphicsSystems
{
public:

GraphicsSystems(); //constructor
~GraphicsSystems(); //destructor


bool Init(int mWidth, int mHeight);
void Draw(int locX, int locY, ALLEGRO_BITMAP* bitmap); //Draw to current backbuffer


void Flip() { al_flip_display(); };//flips display

int getmScreenHeight() { return mScreenHeight; };
int getmScreenWidth() { return mScreenWidth; };
ALLEGRO_DISPLAY* getmpDisplay() { return mpDisplay; };

private:

int mScreenWidth;

int mScreenHeight;

ALLEGRO_DISPLAY* mpDisplay;
};
4 changes: 4 additions & 0 deletions RoboCat/Inc/InFlightPacket.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
class DeliveryNotificationManager;

//in case we decide to change the type of the sequence number to use fewer or more bits
Expand All @@ -11,6 +12,8 @@ class InFlightPacket

PacketSequenceNumber GetSequenceNumber() const { return mSequenceNumber; }
float GetTimeDispatched() const { return mTimeDispatched; }
float GetReceivedTime() const { return mTimeDispatched; }
void SetReceivedTime(float timeReceived) { mTimeReceived = timeReceived; }

void SetTransmissionData( int inKey, TransmissionDataPtr inTransmissionData )
{
Expand All @@ -28,6 +31,7 @@ class InFlightPacket
private:
PacketSequenceNumber mSequenceNumber;
float mTimeDispatched;
float mTimeReceived;

unordered_map< int, TransmissionDataPtr > mTransmissionDataMap;
};
48 changes: 48 additions & 0 deletions RoboCat/Inc/InputSystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#pragma once
#include <allegro5/allegro.h>
#include "GraphicsSystems.h"

#include <vector>
#include <string>
#include <map>
#include <utility>

using std::vector;
using std::pair;
using std::string;
using std::map;

enum KEYCODES
{
D = ALLEGRO_KEY_D,
S = ALLEGRO_KEY_S,
Esc = ALLEGRO_KEY_ESCAPE,
UP_ARROW = ALLEGRO_KEY_UP,
DOWN_ARROW = ALLEGRO_KEY_DOWN,
LEFT_ARROW = ALLEGRO_KEY_LEFT,
RIGHT_ARROW = ALLEGRO_KEY_RIGHT
};

class InputSystem
{
ALLEGRO_EVENT_QUEUE* mpKeyboardEvents;

public:

InputSystem();
~InputSystem();

bool InitInputSystem(GraphicsSystems* mpGraphicsSystem);

void KeyUpdate();

bool getKeyState(int keycode);

private:

ALLEGRO_KEYBOARD_STATE* mpKeyboardState;

int mMousePosY = 0, mMousePosX = 0;

friend class GraphicSystems;
};
17 changes: 17 additions & 0 deletions RoboCat/Inc/MemoryBitStream.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
#pragma once

#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include "Windows.h"
#include "WinSock2.h"
#include "Ws2tcpip.h"
#include <memory>
typedef int socklen_t;

#include "RoboMath.h"

#include <cstdint>
#include <cstdlib>
#include <string>
#include <iostream>

//using std::vector;
//using std::shared_ptr;

using namespace std;

class GameObject;

inline uint32_t ConvertToFixed( float inNumber, float inMin, float inPrecision )
Expand Down Expand Up @@ -34,6 +50,7 @@ class OutputMemoryBitStream
void WriteBits( const void* inData, uint32_t inBitCount );

const char* GetBufferPtr() const { return mBuffer; }
char* GetBufferPtr() { return mBuffer; } // ADDED THIS FROM RECEIVE IN NETWORK
uint32_t GetBitLength() const { return mBitHead; }
uint32_t GetByteLength() const { return ( mBitHead + 7 ) >> 3; }

Expand Down
Loading