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

Chat message should only appear for user's who are "close" to hear it #27

Open
naknode opened this issue Mar 6, 2018 · 2 comments
Open
Labels
backend Node.js-related or anything to do in the server bug "Hey, that's not suppose to happen." easy Issue/feature that is easy to fix or implement. Good for 1st-time contributors. good first issue Easy issues that are excellent for people wanting to get in meat of the code. Hacktoberfest help wanted Issues that we need multiple opinions on. medium priority It would be awesome if this was done, but not very critical. player Features/issues relating to the player of Delaford. web socket WebSocket issues and discussion.
Milestone

Comments

@naknode
Copy link
Member

naknode commented Mar 6, 2018

Do you want to request a feature or report a bug?

bug

What is the current behavior?

When a user types on chat, everyone in the map can see it.

If the current behavior is a bug, please provide the exact steps to reproduce.

  • Player 1 logs in. Goes to (24, 20).
  • Player 2 logs in. Goes to (243, 93).
  • Player 1 says "Hello world."
  • Player 2 sees "Player 1: Hello world."

What is the expected behavior?

Player 2 should only see a message from the player who is saying a message if they are theoretically in their viewport. So 15x11 tiles should be their chat range.

@naknode naknode added bug "Hey, that's not suppose to happen." help wanted Issues that we need multiple opinions on. good first issue Easy issues that are excellent for people wanting to get in meat of the code. player Features/issues relating to the player of Delaford. easy Issue/feature that is easy to fix or implement. Good for 1st-time contributors. medium priority It would be awesome if this was done, but not very critical. backend Node.js-related or anything to do in the server web socket WebSocket issues and discussion. labels Mar 6, 2018
@naknode naknode added this to the v0.0.1 milestone Mar 6, 2018
@naknode naknode added this to To Do in Networking via automation Mar 6, 2018
@naknode naknode added this to To Do in Player Engine via automation Mar 6, 2018
@naknode naknode pinned this issue Dec 31, 2018
@naknode
Copy link
Member Author

naknode commented Jan 1, 2019

It seems like a re-work of the Socket class is in order. We can extend this to the Player class so that way we don't need to statically call it and already have some vital information (like player's socket ID, x, y, etc.)

For example, player.emit to send back to only player's client and player.broadcast to send to all (in viewport).

The socket_id will really help de-clutter the current Socket.emit method that we currently do at the moment. Because right now it's like:

Socket.emit('CHAT:MESSAGE', {
  data: { type: 'normal', text: data.item.examine },
  player: {
    socket_id: this.player.socket_id,
  },
});

And then every time we do Socket.broadcast, to only have to broadcasted to those in the viewport. Because we are not going really broadcast to every single player.

@naknode naknode unpinned this issue Feb 26, 2019
@erickcelio
Copy link

I can work on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Node.js-related or anything to do in the server bug "Hey, that's not suppose to happen." easy Issue/feature that is easy to fix or implement. Good for 1st-time contributors. good first issue Easy issues that are excellent for people wanting to get in meat of the code. Hacktoberfest help wanted Issues that we need multiple opinions on. medium priority It would be awesome if this was done, but not very critical. player Features/issues relating to the player of Delaford. web socket WebSocket issues and discussion.
Projects
Networking
  
To Do
Player Engine
  
To Do
Development

No branches or pull requests

2 participants