Private event?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Private event?

      How does one send an event to a specific listener? I do not want to put an event in the queue where anyone can register to receive it.

      An example would be a card game, like bridge or poker. What kind of event(s) does one create to take care of distributing the cards? You cannot use the same event for everybody since anyone can listen for that event and know what cards everyone else has.

      My thought was to create another function in the event manager to queue events to be sent to specific listeners.

      This seems like a common kind of action in a game. Wondering if anyone else has encountered this or has a suggestion.
      DaveK
    • Hi kalkwarf,

      Can you go into more detail on the information that is stored in this event that you intend to keep private?

      If your objective is network security (not having the other players see your cards), then the solution would be to have two types of card distribution events:
      1. One event that contains the card identifiers plus seat number.
      2. Another event that contains blank cards plus seat number


      Let's assume this is a table of 4 for card games. That means the server code will be responsible for delegating only one card distribution event with identifiers per client... and each client receives 3 card distribution events with blank values for the cards, thereby indicating to the client that these should be shown face down.

      This allows card distribution events to be handled in a hackproof manner... even packet sniffers on the client side would not be able to get any useful information out of the card data being passed through the network.

      I made the assumption that hackproofing is the reason you'd want to make an event private... and in that area, it is safe to assume that a hacker can potentially have access to your source code. So arranging code architecture to make certain data transfers (such as event broadcasts) "private" still assumes trust on the part of the person who is changing the source code. Making an event "private" offers no more protection from hacking than simply not registering for an event or not handling the event inside the ::process function.

      Am I looking at your question the right way?
    • Private event details

      The event (DealCardEvent?) I had in mind would contain two values: seat and card. While initiallly dealing the cards. many of these events would be sent. Card for Player 1, card for Player 2, card for Player 1, card for Player 2, etc.

      Each seat would listen for this event and store its cards as they pass by. As you pointed out, my concern is network hacking. In this scenario, a sniffer could see that event/packet and capture everyone else's cards.

      My proposed solution was to send it directly to the pertinent listerner and bypass the normal event distribution of sending it to anyone that registered to listen for it. I am not really concerned that other listeners know when cards are dealt to everyone else.

      I apologize, but I do not understand your solution. It sounds like you are describing an event passing system that has the ability to send a message to a specific listener. I have followed Mike's system where you essentially post a message and the system sends it to whoever asked to receive it. Do I not understand your solution? Am I misunderstanding Mike's architecture?

      Thanks for the reply,

      Dave
      DaveK
    • RE: Private event details

      I hope you see Mike's event stuff is not related to the network code. The network code would be one of the things listening for events. You generally don't want client programs to be trusted with hiding information from their users.
      -Larrik Jaerico

      www.LarrikJ.com
    • Mike's system is the system I was assuming you were following.

      Larrik has a good point about keeping your conceptions on networking code separate from your conceptions on the event system.

      Your conceptions on the event system are correct.

      Network code, on the other hand, is a different story. The only way to make absolutely sure a player does not see cards that she/he is not supposed to see is to make sure that the card data never gets sent in their direction.

      I think I see why you thought I was talking about an event system that sends messages to a specific listener. In that previous post, I was actually talking about a network server application that sends data packets to a specific client application, which is a completely separate system from the event system. You can think of the event system as all inside a single executeable, while a network system takes place between two or more executeables.

      So to answer your original question, there is no reason to make anything that constitutes a "private" event. By definition, events are meant to reach anybody that listens for it, and it is assumed that every potential listener is trustworthy. At some point, your events will probably get converted to and from network packets.

      The post was edited 1 time, last by Kain ().