Aadhavan Srinivasan
89e1e8d45e
Worked on further implementation of the network side of things.
...
Specifically, I added code to send a message from the client, after the client is launched. This message is used to try to connect to the server. Once the server receives this message, it responds back. After the client receives this response, the connection has been established, and the game can begin.
I also added code to wait (on the client side) for the server to press the spacebar.
10 months ago
Aadhavan Srinivasan
acf8271126
Renamed 'math-helpers.hpp' to 'sign.hpp' and updated main.cpp to reflect the change
10 months ago
Aadhavan Srinivasan
1b1dc4a3a2
Changed include paths to relative paths, and added an agnostic struct.
...
The agnostic struct consists of a 'Mode' enum, and a 'Sock' type. The
'Sock' can be either a Server or Client, depending on the type of game.
This allows polymorphism, as I don't have to worry about whether the game
is being run in Server or Client mode, and I can call the same methods regardless.
10 months ago
Aadhavan Srinivasan
fc041539c5
Changed Sock to Sock* in GameType struct to allow it to be set to null
10 months ago
Aadhavan Srinivasan
cb0fe1af6b
Defined a 'GameType' struct that can hold both the mode, and the relevant socket, to enable polymorphism when calling socket methods
10 months ago
Aadhavan Srinivasan
4c256d8800
Added call to SockQuit at the end
11 months ago
Aadhavan Srinivasan
912435bfa3
Added new exception for invalid IP, used it if IP address is neither v4 nor v6
11 months ago
Aadhavan Srinivasan
48739f6026
Created enum to denote if game is in client or server mode, and added error checking, to check if IP address is valid
11 months ago
Aadhavan Srinivasan
05cc70412c
Added comments to better explain the code, and added code to catch more exceptions
11 months ago
Aadhavan Srinivasan
2ca17a6225
Moved server / client checking above window initialization
11 months ago
Aadhavan Srinivasan
cb958d2749
Added code to parse command-line flags, to determine whether the game was started in client or server mode, and call relevant functions to encode or decode address / key
11 months ago
Aadhavan Srinivasan
c83b347620
Changed include paths, added a cmdline argument ('server') to indicate if the game is networkded or not
11 months ago
Aadhavan Srinivasan
7557ce7cf5
Updated header file includes; Changed base speed; Started working on networking code, to send a character when the paddle is moved or stopped
11 months ago
Aadhavan Srinivasan
b5a8fd599d
Added a randomly generated multiplier to the offset, when the ball collides with a paddle
11 months ago
Aadhavan Srinivasan
2940c61314
Added code to wait until user presses SPACE, before starting the game. Also added code to show points
11 months ago
Aadhavan Srinivasan
6e78329eb5
Updated code to use variable paddle speed and keep a constant speed (magnitude of velocity); added function to determine the x and y components of ball velocity after collision with paddle
11 months ago
Aadhavan Srinivasan
6ddf6936bf
Added more comments, and fixed bug where ball would sometimes get 'stuck' inside paddle
11 months ago
Aadhavan Srinivasan
9180e55c88
First commit
11 months ago