Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big Tetris Parties #30

Merged
merged 2 commits into from
Jan 15, 2021
Merged

Big Tetris Parties #30

merged 2 commits into from
Jan 15, 2021

Conversation

bitoffdev
Copy link
Collaborator

TL;DR This patch allows more than the previous 2 players to compete, and
makes many minor improvements.

Peek 2021-01-01 23-55


  • Add magic number to all messages to help catch any network issues
  • Add message_type field to message wire header, and remove the message_type
    from the body of many messages
  • Define new method, message_type_to_str, to print a human-readable message
    type for logging
  • Create new helper method message_blob
  • Declare a macro name "PLAYER_NAME_MAX_CHARS", and use it consistently to
    validate the player names.
  • Refactor StringArray to take a max length and define the StringArray
    serialized header bytes using a struct
  • Bump MAXMSG up to 2048
  • Refactor serialize_state to use no more bytes that necessary, rather than
    using MAXMSG as before
  • Server now sends reply to user registration to indicate success
  • Remove unnecessary and barely-utilized Player->io_lock, since all writes are
    done with a single call, which POSIX guarantees to be thread-safe.
  • Add additional safety checks to renderer so that the program doesn't throw
    nasty errors (segfault) when the renderer has not been properly initialized
  • Fix bug in read_from_client that referenced the buffer rather than the cursor

TL;DR This patch allows more than the previous 2 players to compete, and
makes many minor improvements.

- Add magic number to all messages to help catch any network issues
- Add message_type field to message wire header, and remove the message_type
  from the body of many messages
- Define new method, message_type_to_str, to print a human-readable message
  type for logging
- Create new helper method message_blob
- Declare a macro name "PLAYER_NAME_MAX_CHARS", and use it consistently to
  validate the player names.
- Refactor StringArray to take a max length and define the StringArray
  serialized header bytes using a struct
- Bump MAXMSG up to 2048
- Refactor serialize_state to use no more bytes that necessary, rather than
  using MAXMSG as before
- Server now sends reply to user registration to indicate success
- Remove unnecessary and barely-utilized Player->io_lock, since all writes are
  done with a single call, which POSIX guarantees to be thread-safe.
- Add additional safety checks to renderer so that the program doesn't throw
  nasty errors (segfault) when the renderer has not been properly initialized
- Fix bug in read_from_client that referenced the buffer rather than the cursor
@bitoffdev bitoffdev requested a review from Nitepone January 2, 2021 05:22
@bitoffdev bitoffdev self-assigned this Jan 2, 2021
Copy link
Owner

@Nitepone Nitepone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions before approving this for merge. But, I don't see anything urgent to change.

src/client_conn.c Outdated Show resolved Hide resolved
src/client_conn.c Outdated Show resolved Hide resolved
src/event.h Show resolved Hide resolved
src/event.h Show resolved Hide resolved
src/client.c Show resolved Hide resolved
src/client.c Show resolved Hide resolved
src/client_conn.c Show resolved Hide resolved
src/generic.c Show resolved Hide resolved
- Add TODO for controls menu
- Use unsigned int for string length in read_game_view_data
- Replace unnecessary empty string in client_conn.c with NULL
@bitoffdev
Copy link
Collaborator Author

Thanks for taking a look at my giant diff @Nitepone! 🙌 😍

I think this latest commit should address your comments.

Copy link
Owner

@Nitepone Nitepone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bitoffdev bitoffdev merged commit cae96e5 into master Jan 15, 2021
@bitoffdev bitoffdev deleted the feature/big-parties branch January 15, 2021 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants