33 Commits (3bdfdb114c816f8d3e666e290c0cdda224266480)

Author SHA1 Message Date
Aadhavan Srinivasan 986e386098 Updated Server and Client constructor calls, so that they don't pass in the IP version 10 months ago
Aadhavan Srinivasan 9a12edcdb1 Started working on better error handling, by throwing exceptions and displaying error messages in the GUI 10 months ago
Aadhavan Srinivasan 8848f0ff8c Removed debug print statements, cleared background before drawing to screen, and added client GUI implementation
I removed a print statement that printed out every position of the ball, because it was no longer necessary.
I also added code to clear the background before drawing to the screen at the start of the game, to remove
any lingering un-erased objects. Finally, and most substantially, I finished the initial implementation of
the client-side GUI. The client should now be able to specify a connect code through the GUI, and connect
to the appropriate server.
10 months ago
Aadhavan Srinivasan 352d3f26f1 Moved struct definition to separate file, and added check for displaying GUI
I moved the GameType struct (and the Mode enum) to a separate file, as I will need
to use it in the check_server and check_client functions as well. I also added the
signum function (which was previously in sign.hpp) to this file, since it was the only
function in sign.hpp. Finally, I added a check, that will only display the GUI, if the
user didn't provide any command-line arguments.
10 months ago
Aadhavan Srinivasan bc0d644399 Replaced compound literal initialization of 'Rectangle' and 'Vector2' types (which is only valid in C), with braced-initialization (valid in C++) 10 months ago
Aadhavan Srinivasan 0d1dc049b5 Worked on further implementation of game mode selection.
I added code to display a help text after the user selects a mode. Currently,
this text is only displayed in single player mode. Additionally, I added a rudimentary
'form' to input IP address and port, if the user selects server mode.
10 months ago
Aadhavan Srinivasan 0286878c70 Rudimentary support for inputting game mode through GUI instead of command-line
The only thing that 'works' right now is the skeleton GUI structure. The buttons don't
actually do anything.
10 months ago
Aadhavan Srinivasan 635d71f1c5 Slightly lowered speed, to make the game a little easier to play 10 months ago
Aadhavan Srinivasan bb4601c5bd Chenged FPS to 60 for release build 10 months ago
Aadhavan Srinivasan f961db5e58 Added code to send quit message only if game is not in single player mode 10 months ago
Aadhavan Srinivasan 91bf5e2ce1 Fixed some commenting issues; Added code to detect if game was quit by peer and, if so, quit the game locally 10 months ago
Aadhavan Srinivasan 4b3d5387a1 Changed code to support Windows libraries and functions as well 10 months ago
Aadhavan Srinivasan ba667d020d Game is mostly finished, added a ton of code for reading and applying peer position.
The most important addition is that the program now parses data in the
Serial_Data struct, and updates the positions accordingly. I also removed
the old implementation with strings, and fixed a bunch of bugs along the way.
10 months ago
Aadhavan Srinivasan 6eb02ab2ee Started working on implementing serialization code into the main game loop.
Currently, I'm trying to serialize data and send it to the peer socket, and deserialize it at the receiving end.
10 months ago
Aadhavan Srinivasan 6ad56fb9ef Started working on client-server communication; so far, I can send the position of client to server, and vice-versa 10 months ago
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