Results 1 to 2 of 2
  1. #1
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky

    Object Serialization

    I'm making a multiplayer snake in C# but I'm getting stuck on the networking part.

    my plan was to use TcpClient and TcpListener, I have the listener set up but I have no idea how I can the send snake struct or direction updates...
    On google I found that I need to do object serialization, but I have no idea how it works.
    I found working code but am unable to understand what they're doing so I don't want to use it.

    If someone could find or make me a detailed tutorial on how to send my game data over the network that would be awsome.

    Thanks in advance,
    Hell_Demon

    P.S. Yes, I code it in C#, but since that section is dead and VB code can easily be ported to C# i'm asking it here instead.
    Ah we-a blaze the fyah, make it bun dem!

  2. #2
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    You can transfer snake directions by trimming the parameters. When you broadcast the message through server, append the parameter at the end. When the client will receive the data, trim the parameter, perform a check on it and execute the direction.

    Code:
    While CurClien*****nnected
    Dim IncomingMessage As String = StreamX.ReadLine
    
    'Trim the parameter. For example trims 'Snake # 1 Says: /Go Up' and returns 'Go Up'
    
    Dim parameter as string = IncomingMessage.Substring(IncomingMessage . Indexof("/")+1)
    If parameter = "MoveLeft" Then
    'Snake MoveLeft Code Here...
    ElseIf parameter = "MoveUp" Then
    'Snake MoveUp Code Here...
    End If
    End While
    I think this is all you need to communicate direction between the client snakes. I could be wrong.

Similar Threads

  1. Good Cracks/Serials/Keygens website
    By Elmo in forum Spammers Corner
    Replies: 11
    Last Post: 10-22-2016, 07:05 AM
  2. Keygens/Serials?
    By Mikoll in forum Suggestions, Requests & General Help
    Replies: 6
    Last Post: 08-27-2006, 10:20 PM
  3. SERIAL CODE FOR PHOTOSHOP 9!!!!!!!! 100% working
    By -[standoff]- in forum Art & Graphic Design
    Replies: 10
    Last Post: 07-29-2006, 05:35 AM
  4. Starcraft Serial
    By arunforce in forum General
    Replies: 13
    Last Post: 05-01-2006, 07:09 PM