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
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
1057a37
initial state for assignment 3
sabarrett Apr 1, 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.
44 changes: 35 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,9 +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 @@ -382,7 +398,15 @@
<ClInclude Include="Inc\TCPSocket.h" />
<ClInclude Include="Inc\RoboCatPCH.h" />
<ClInclude Include="Inc\RoboCatShared.h" />
<ClInclude Include="Inc\Timing.h" />
<ClInclude Include="Inc\TransmissionData.h" />
<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 @@ -391,12 +415,14 @@
<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">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RoboCatPCH.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="Src\Timing.cpp" />
<ClCompile Include="Src\UDPSocket.cpp" />
</ItemGroup>
<ItemGroup>
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.
36 changes: 36 additions & 0 deletions RoboCat/Inc/AckRange.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once
//typedef PacketSequenceNumber uint16_t;

class AckRange
{
public:
AckRange() : mStart( 0 ), mCount( 0 ) {}

AckRange( PacketSequenceNumber inStart ) : mStart( inStart ), mCount( 1 ) {}

//if this is the next in sequence, just extend the range
inline bool ExtendIfShould( PacketSequenceNumber inSequenceNumber );

PacketSequenceNumber GetStart() const { return mStart; }
uint32_t GetCount() const { return mCount; }

void Write( OutputMemoryBitStream& inOutputStream ) const;
void Read( InputMemoryBitStream& inInputStream );

private:
PacketSequenceNumber mStart;
uint32_t mCount;
};

inline bool AckRange::ExtendIfShould( PacketSequenceNumber inSequenceNumber )
{
if( inSequenceNumber == mStart + mCount )
{
++mCount;
return true;
}
else
{
return false;
}
}
72 changes: 72 additions & 0 deletions RoboCat/Inc/DeliveryNotificationManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#pragma once
class DeliveryNotificationManager
{
public:


DeliveryNotificationManager( bool inShouldSendAcks, bool inShouldProcessAcks );
~DeliveryNotificationManager();

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

void ProcessTimedOutPackets();

uint32_t GetDroppedPacketCount() const { return mDroppedPacketCount; }
uint32_t GetDeliveredPacketCount() const { return mDeliveredPacketCount; }
uint32_t GetDispatchedPacketCount() const { return mDispatchedPacketCount; }

const deque< InFlightPacket >& GetInFlightPackets() const { return mInFlightPackets; }

private:



InFlightPacket* WriteSequenceNumber( OutputMemoryBitStream& inOutputStream );
void WriteAckData( OutputMemoryBitStream& inOutputStream );

//returns wether to drop the packet- if sequence number is too low!
bool ProcessSequenceNumber( InputMemoryBitStream& inInputStream );
void ProcessAcks( InputMemoryBitStream& inInputStream );


void AddPendingAck( PacketSequenceNumber inSequenceNumber );
void HandlePacketDeliveryFailure( const InFlightPacket& inFlightPacket );
void HandlePacketDeliverySuccess( const InFlightPacket& inFlightPacket );

PacketSequenceNumber mNextOutgoingSequenceNumber;
PacketSequenceNumber mNextExpectedSequenceNumber;

deque< InFlightPacket > mInFlightPackets;
deque< AckRange > mPendingAcks;

bool mShouldSendAcks;
bool mShouldProcessAcks;

uint32_t mDeliveredPacketCount;
uint32_t mDroppedPacketCount;
uint32_t mDispatchedPacketCount;

};



inline InFlightPacket* DeliveryNotificationManager::WriteState( OutputMemoryBitStream& inOutputStream )
{
InFlightPacket* toRet = WriteSequenceNumber( inOutputStream );
if( mShouldSendAcks )
{
WriteAckData( inOutputStream );
}
return toRet;
}

inline bool DeliveryNotificationManager::ReadAndProcessState( InputMemoryBitStream& inInputStream )
{
bool toRet = ProcessSequenceNumber( inInputStream );
if( mShouldProcessAcks )
{
ProcessAcks( inInputStream );
}
return toRet;
}
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;
};
Loading