Commit Graph

22 Commits

Author SHA1 Message Date
4b3d5387a1 Changed code to support Windows libraries and functions as well 2024-02-29 16:38:36 -05:00
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.
2024-02-28 00:00:53 -05:00
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.
2024-02-26 21:39:23 -05:00
6ad56fb9ef Started working on client-server communication; so far, I can send the position of client to server, and vice-versa 2024-02-23 11:16:21 -05:00
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.
2024-02-21 22:29:03 -05:00
acf8271126 Renamed 'math-helpers.hpp' to 'sign.hpp' and updated main.cpp to reflect the change 2024-02-15 09:46:53 -05:00
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.
2024-02-14 18:32:40 -05:00
fc041539c5 Changed Sock to Sock* in GameType struct to allow it to be set to null 2024-02-14 08:22:25 -05:00
cb0fe1af6b Defined a 'GameType' struct that can hold both the mode, and the relevant socket, to enable polymorphism when calling socket methods 2024-02-14 08:09:34 -05:00
4c256d8800 Added call to SockQuit at the end 2024-02-11 23:22:19 -05:00
912435bfa3 Added new exception for invalid IP, used it if IP address is neither v4 nor v6 2024-02-07 21:55:05 -05:00
48739f6026 Created enum to denote if game is in client or server mode, and added error checking, to check if IP address is valid 2024-02-07 21:48:43 -05:00
05cc70412c Added comments to better explain the code, and added code to catch more exceptions 2024-02-06 09:44:54 -05:00
2ca17a6225 Moved server / client checking above window initialization 2024-02-06 07:26:16 -05:00
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 2024-02-04 20:33:45 -05:00
c83b347620 Changed include paths, added a cmdline argument ('server') to indicate if the game is networkded or not 2024-01-31 21:01:11 -05:00
7557ce7cf5 Updated header file includes; Changed base speed; Started working on networking code, to send a character when the paddle is moved or stopped 2024-01-29 22:48:58 -05:00
b5a8fd599d Added a randomly generated multiplier to the offset, when the ball collides with a paddle 2024-01-24 12:19:57 -05:00
2940c61314 Added code to wait until user presses SPACE, before starting the game. Also added code to show points 2024-01-24 12:02:45 -05:00
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 2024-01-18 19:30:11 -05:00
6ddf6936bf Added more comments, and fixed bug where ball would sometimes get 'stuck' inside paddle 2024-01-17 23:40:14 -05:00
9180e55c88 First commit 2024-01-17 23:25:43 -05:00