Mirage Source

Free ORPG making software.
It is currently Fri Apr 26, 2024 5:29 pm

All times are UTC




Post new topic Reply to topic  [ 59 posts ]  Go to page 1, 2, 3  Next

Is it any good?
Yeah 63%  63%  [ 15 ]
No 8%  8%  [ 2 ]
A little 29%  29%  [ 7 ]
Total votes : 24
Author Message
PostPosted: Sun Aug 12, 2007 8:07 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Completed! Not Tested yet! But I think it works.

By: William
Difficulty: 3/5
Source: http://www.key2heaven.net/Socket2.rar

Thanks to Bhenur for the idea and explanation behind it.

Introduction
Backup your source!
Currently, the movement is handled through the same socket as everything else that sends from the client to the server. This tutorial will add two new sockets. One to the client and one to the server that handles the movement. So the sending delays decreases.

Client Side
Begin with adding a new socket to frmMirage. Name it "Socket2" without the quote tags.
Find:
Code:
frmMirage.Socket.RemoteHost = GAME_IP
    frmMirage.Socket.RemotePort = GAME_PORT

Below add:
Code:
frmMirage.Socket2.RemoteHost = GAME_IP
    frmMirage.Socket2.RemotePort = GAME_PORT2

Find:
Code:
Sub TcpDestroy()
    frmMirage.Socket.Close

Replace it with:
Code:
Sub TcpDestroy()
    frmMirage.Socket.Close
    frmMirage.Socket2.Close

Under:
Code:
Sub IncomingData(ByVal DataLength As Long)

Add this sub:
Code:
Sub IncomingData2(ByVal DataLength As Long)
Dim Buffer As String
Dim Packet As String
Dim top As String * 3
Dim Start As Integer

    frmMirage.Socket2.GetData Buffer, vbString, DataLength
    PlayerBuffer = PlayerBuffer & Buffer
       
    Start = InStr(PlayerBuffer, END_CHAR)
    Do While Start > 0
        Packet = Mid(PlayerBuffer, 1, Start - 1)
        PlayerBuffer = Mid(PlayerBuffer, Start + 1, Len(PlayerBuffer))
        Start = InStr(PlayerBuffer, END_CHAR)
        If Len(Packet) > 0 Then
            Call HandleData(Packet)
        End If
    Loop
End Sub

Under:
Code:
Public Function ConnectToServer() As Boolean

Add:
Code:
Public Function ConnectToServer2() As Boolean
'****************************************************************
'* WHEN        WHO        WHAT
'* ----        ---        ----
'* 07/12/2005  Shannara   Optimized function.
'****************************************************************

Dim Wait As Long

    ' Check to see if we are already connected, if so just exit
    If IsConnected2 Then
        ConnectToServer2 = True
        Exit Function
    End If
   
    Wait = GetTickCount
    With frmMirage.Socket2
        .Close
        .Connect
    End With
   
    ' Wait until connected or 3 seconds have passed and report the server being down
    Do While (Not IsConnected2) And (GetTickCount <= Wait + 3000)
        DoEvents
    Loop
   
    If IsConnected2 Then
        ConnectToServer2 = True
    Else
        ConnectToServer2 = False
    End If
End Function

Under:
Code:
Function IsConnected() As Boolean

Add:
Code:
Function IsConnected2() As Boolean
    If frmMirage.Socket2.State = sckConnected Then
        IsConnected2 = True
    Else
        IsConnected2 = False
    End If
End Function

Under:
Code:
Private Sub Socket_DataArrival(ByVal bytesTotal As Long)

Add:
Code:
Private Sub Socket2_DataArrival(ByVal bytesTotal As Long)
    If IsConnected2 Then
        Call IncomingData2(bytesTotal)
    End If
End Sub

Under:
Code:
Public Const GAME_PORT = 7000

Add:
Code:
Public Const GAME_PORT2 = 7001

Make sure to open the new port in your router.
Replace:
Code:
Sub SendPlayerMove()
Dim Packet As String

    Packet = "playermove" & SEP_CHAR & GetPlayerDir(MyIndex) & SEP_CHAR & Player(MyIndex).Moving & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub

Sub SendPlayerDir()
Dim Packet As String

    Packet = "playerdir" & SEP_CHAR & GetPlayerDir(MyIndex) & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub

With this:
Code:
Sub SendPlayerMove()
Dim Packet As String

    Packet = "playermove" & SEP_CHAR & GetPlayerDir(MyIndex) & SEP_CHAR & Player(MyIndex).Moving & SEP_CHAR & END_CHAR
    Call SendData2(Packet)
End Sub

Sub SendPlayerDir()
Dim Packet As String

    Packet = "playerdir" & SEP_CHAR & GetPlayerDir(MyIndex) & SEP_CHAR & END_CHAR
    Call SendData2(Packet)
End Sub

Under:
Code:
Sub SendData(ByVal Data As String)

Add:
Code:
Sub SendData2(ByVal Data As String)
    If IsConnected2 Then
        frmMirage.Socket2.SendData Data
        DoEvents
    End If
End Sub

Replace your whole:
Code:
Public Sub MenuState(ByVal State As Long)

With this:
Code:
Public Sub MenuState(ByVal State As Long)
'****************************************************************
'* WHEN        WHO        WHAT
'* ----        ---        ----
'* 07/12/2005  Shannara   Added website constant.
'****************************************************************
   
    frmSendGetData.Visible = True
    Call SetStatus("Connecting to server...")
    Select Case State
        Case MENU_STATE_NEWACCOUNT
            frmNewAccount.Visible = False
            If ConnectToServer = True Then
             If ConnectToServer2 = True Then
                Call SetStatus("Connected, sending new account information...")
                Call SendNewAccount(frmNewAccount.txtName.Text, frmNewAccount.txtPassword.Text)
             End If
            End If
           
        Case MENU_STATE_DELACCOUNT
            frmDeleteAccount.Visible = False
            If ConnectToServer = True Then
             If ConnectToServer2 = True Then
                Call SetStatus("Connected, sending account deletion request ...")
                Call SendDelAccount(frmDeleteAccount.txtName.Text, frmDeleteAccount.txtPassword.Text)
             End If
            End If
       
        Case MENU_STATE_LOGIN
            frmLogin.Visible = False
            If ConnectToServer = True Then
             If ConnectToServer2 = True Then
                Call SetStatus("Connected, sending login information...")
                Call SendLogin(frmLogin.txtName.Text, frmLogin.txtPassword.Text)
             End If
            End If
       
        Case MENU_STATE_NEWCHAR
            frmChars.Visible = False
            Call SetStatus("Connected, getting available classes...")
            Call SendGetClasses
           
        Case MENU_STATE_ADDCHAR
            frmNewChar.Visible = False
            If ConnectToServer = True Then
             If ConnectToServer2 = True Then
                Call SetStatus("Connected, sending character addition data...")
                If frmNewChar.optMale.Value = True Then
                    Call SendAddChar(frmNewChar.txtName, 0, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1)
                Else
                    Call SendAddChar(frmNewChar.txtName, 1, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1)
                End If
             End If
            End If
       
        Case MENU_STATE_DELCHAR
            frmChars.Visible = False
            If ConnectToServer = True Then
             If ConnectToServer2 = True Then
                Call SetStatus("Connected, sending character deletion request...")
                Call SendDelChar(frmChars.lstChars.ListIndex + 1)
             End If
            End If
           
        Case MENU_STATE_USECHAR
            frmChars.Visible = False
            If ConnectToServer = True Then
             If ConnectToServer2 = True Then
                Call SetStatus("Connected, sending char data...")
                Call SendUseChar(frmChars.lstChars.ListIndex + 1)
             End If
            End If
    End Select

    If Not IsConnected Or Not IsConnected2 Then
        frmMainMenu.Visible = True
        frmSendGetData.Visible = False
        Call MsgBox("Sorry, the server seems to be down.  Please try to reconnect in a few minutes or visit " & WEBSITE, vbOKOnly, GAME_NAME)
    End If
End Sub

Whats added above are the "If IsConnected2 = True" on the menu_states. And also the last extra "Or Not IsConnected2".

___________________________________________________________________________________________________________________
Server Side
Now add a new socket to the server, name it "Socket2".
Under:
Code:
Private Sub Socket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    Call AcceptConnection(Index, requestID)
End Sub

Private Sub Socket_Accept(Index As Integer, SocketId As Integer)
    Call AcceptConnection(Index, SocketId)
End Sub

Private Sub Socket_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    If IsConnected(Index) Then
        Call IncomingData(Index, bytesTotal)
    End If
End Sub

Private Sub Socket_Close(Index As Integer)
    Call CloseSocket(Index)
End Sub

Add:
Code:
Private Sub Socket2_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    Call AcceptConnection2(Index, requestID)
End Sub

Private Sub Socket2_Accept(Index As Integer, SocketId As Integer)
    Call AcceptConnection2(Index, SocketId)
End Sub

Private Sub Socket2_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    If IsConnected2(Index) Then
        Call IncomingData2(Index, bytesTotal)
    End If
End Sub

Private Sub Socket2_Close(Index As Integer)
    Call CloseSocket2(Index)
End Sub

Under:
Code:
Sub AcceptConnection(ByVal Index As Long, ByVal SocketId As Long)

Add:
Code:
Sub AcceptConnection2(ByVal Index As Long, ByVal SocketId As Long)
Dim i As Long

    If (Index = 0) Then
        i = FindOpenPlayerSlot2
       
        If i <> 0 Then
            ' Whoho, we can connect them
            frmServer.Socket2(i).Close
            frmServer.Socket2(i).Accept SocketId
            Call SocketConnected2(i)
            'Call SocketConnected2(i)
        End If
    End If
End Sub

Under:
Code:
Sub SocketConnected(ByVal Index As Long)

Add:
Code:
Sub SocketConnected2(ByVal Index As Long)
    If Index <> 0 Then
            If Not IsBanned(GetPlayerIP(Index)) Then
                Call TextAdd(frmServer.txtText, "Received connection from " & GetPlayerIP(Index) & ".", True)
            Else
                Call AlertMsg(Index, "You have been banned from " & GAME_NAME & ", and can no longer play.")
            End If
    End If
End Sub

Under:
Code:
Sub IncomingData(ByVal Index As Long, ByVal DataLength As Long)

Add:
Code:
Sub IncomingData2(ByVal Index As Long, ByVal DataLength As Long)
On Error Resume Next

Dim Buffer As String
Dim Packet As String
Dim top As String * 3
Dim Start As Integer

    If Index > 0 Then
        frmServer.Socket2(Index).GetData Buffer, vbString, DataLength
       
        If Buffer = "top" Then
            top = STR(TotalOnlinePlayers)
            Call SendDataTo(Index, top)
            Call CloseSocket2(Index)
        End If
           
        Player(Index).Buffer = Player(Index).Buffer & Buffer
       
        Start = InStr(Player(Index).Buffer, END_CHAR)
        Do While Start > 0
            Packet = Mid(Player(Index).Buffer, 1, Start - 1)
            Player(Index).Buffer = Mid(Player(Index).Buffer, Start + 1, Len(Player(Index).Buffer))
            Player(Index).DataPackets = Player(Index).DataPackets + 1
            Start = InStr(Player(Index).Buffer, END_CHAR)
            If Len(Packet) > 0 Then
                Call HandleData(Index, Packet)
            End If
        Loop
               
        ' Check if elapsed time has passed
        Player(Index).DataBytes = Player(Index).DataBytes + DataLength
        If GetTickCount >= Player(Index).DataTimer + 1000 Then
            Player(Index).DataTimer = GetTickCount
            Player(Index).DataBytes = 0
            Player(Index).DataPackets = 0
            Exit Sub
        End If
       
        ' Check for data flooding
        If Player(Index).DataBytes > 1000 And GetPlayerAccess(Index) <= 0 Then
            Call HackingAttempt(Index, "Data Flooding")
            Exit Sub
        End If
       
        ' Check for packet flooding
        If Player(Index).DataPackets > 25 And GetPlayerAccess(Index) <= 0 Then
            Call HackingAttempt(Index, "Packet Flooding")
            Exit Sub
        End If
    End If
End Sub

Under:
Code:
Sub CloseSocket(ByVal Index As Long)

Add:
Code:
Sub CloseSocket2(ByVal Index As Long)
    ' Make sure player was/is playing the game, and if so, save'm.
    If Index > 0 Then
        frmServer.Socket2(Index).Close
    End If
End Sub

Under:
Code:
frmServer.Socket(0).RemoteHost = frmServer.Socket(0).LocalIP
    frmServer.Socket(0).LocalPort = GAME_PORT

Add:
Code:
frmServer.Socket2(0).RemoteHost = frmServer.Socket(0).LocalIP
    frmServer.Socket2(0).LocalPort = GAME_PORT2

Under:
Code:
Public Const GAME_PORT = 7000

Add:
Code:
Public Const GAME_PORT2 = 7001

Find:
Code:
' Init all the player sockets
    For i = 1 To MAX_PLAYERS
        Call SetStatus("Initializing player array...")
        Call ClearPlayer(i)
       
        Load frmServer.Socket(i)
    Next i

Replace it with:
Code:
' Init all the player sockets
    For i = 1 To MAX_PLAYERS
        Call SetStatus("Initializing player array...")
        Call ClearPlayer(i)
       
        Load frmServer.Socket(i)
        Load frmServer.Socket2(i)
    Next i

Under:
Code:
frmServer.Socket(0).Listen

Add:
Code:
frmServer.Socket2(0).Listen

Find:
Code:
For i = 1 To MAX_PLAYERS
        Unload frmServer.Socket(i)
    Next i

Replace it with:
Code:
For i = 1 To MAX_PLAYERS
        Unload frmServer.Socket(i)
        Unload frmServer.Socket2(i)
    Next i

Find:
Code:
If frmServer.Socket(i).State > 7 Then
            Call CloseSocket(i)
        End If

Replace it with:
Code:
If frmServer.Socket(i).State > 7 Then
            Call CloseSocket(i)
            Call CloseSocket2(i)
        End If

Under:
Code:
Function IsConnected(ByVal Index As Long) As Boolean

Add:
Code:
Function IsConnected2(ByVal Index As Long) As Boolean
    If frmServer.Socket2(Index).State = sckConnected Then
        IsConnected2 = True
    Else
        IsConnected2 = False
    End If
End Function

Under: (located in AlertMsg)
Code:
Call CloseSocket(Index)

Add:
Code:
Call CloseSocket2(Index)

Replace:
Code:
Sub SendPlayerXY(ByVal Index As Long)
Dim Packet As String

    Packet = "PLAYERXY" & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & END_CHAR
    Call SendDataTo(Index, Packet)
End Sub

With:
Code:
Sub SendPlayerXY(ByVal Index As Long)
Dim Packet As String

    Packet = "PLAYERXY" & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & END_CHAR
    Call SendDataTo2(Index, Packet)
End Sub

Replace your:
Code:
Sub SendDataToMapBut(ByVal Index As Long, ByVal MapNum As Long, ByVal Data As String)
Dim i As Long

    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) Then
            If GetPlayerMap(i) = MapNum And i <> Index Then
                Call SendDataTo(i, Data)
            End If
        End If
    Next i
End Sub

With:
Code:
Sub SendDataToMapBut(ByVal Index As Long, ByVal MapNum As Long, ByVal Data As String)
Dim i As Long

    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) Then
            If GetPlayerMap(i) = MapNum And i <> Index Then
                Call SendDataTo2(i, Data)
            End If
        End If
    Next i
End Sub

Under:
Code:
Sub SendDataTo(ByVal Index As Long, ByVal Data As String)

Add:
Code:
Sub SendDataTo2(ByVal Index As Long, ByVal Data As String)
Dim i As Long, n As Long, startc As Long

    If IsConnected2(Index) Then
        frmServer.Socket2(Index).SendData Data
        DoEvents
    End If
End Sub


Under:
Code:
Function FindOpenPlayerSlot() As Long

Add:
Code:
Function FindOpenPlayerSlot2() As Long
Dim i As Long

    FindOpenPlayerSlot2 = 0
   
    For i = 1 To MAX_PLAYERS
        If Not IsConnected2(i) Then
            FindOpenPlayerSlot2 = i
            Exit Function
        End If
    Next i
End Function


That should be it. If you encounter any bugs, feel free to post them.


Reference:
http://en.wikipedia.org/wiki/Transmissi ... on_control

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Mon Aug 13, 2007 2:00 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
The tutorial is completed. This source has it added and works great: http://www.key2heaven.net/Socket2.rar

Feel free to test the tutorial and see if I remembered to put everything into it. Thanks

Hopefully someone who has some knowledge in this could say some words what this does so people will trust it :P

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Mon Aug 13, 2007 2:09 pm 
What exactly does it do? Just a separate socket for movement?


Top
  
 
PostPosted: Mon Aug 13, 2007 2:15 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Yeah, instead of letting everything getting buffered and such in one socket. The new movement socket handles only movement and therefore decreases the delay and preassure on the main socket :P I dont have so much knowledge in what benefits it has. But sounded like a good idea when bhenur told me about it. And that wow uses like 4-5 for it :P

Hopyfully Bhenur can explain some about it, since he recently read up on this kind of things. :P

From the reference:
Congestion control

The final part to TCP is congestion control. TCP uses a number of mechanisms to achieve high performance and avoid 'congestion collapse', where network performance can fall by several orders of magnitude. These mechanisms control the rate of data entering the network, keeping the data flow below a rate that would trigger collapse.

Acknowledgments for data sent, or lack of acknowledgments, are used by senders to implicitly interpret network conditions between the TCP sender and receiver. Coupled with timers, TCP senders and receivers can alter the behavior of the flow of data. This is more generally referred to as flow control, congestion control and/or network congestion avoidance.

Modern implementations of TCP contain four intertwined algorithms: Slow-start, congestion avoidance, fast retransmit, and fast recovery (RFC2581).

Enhancing TCP to reliably handle loss, minimize errors, manage congestion and go fast in very high-speed environments are ongoing areas of research and standards development.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Tue Aug 14, 2007 12:35 am 
Offline
Regular
User avatar

Joined: Sat Jun 02, 2007 6:49 am
Posts: 28
I don't think i need to shed more light on this really, William did a decent job.

For a practical example check out the plugin for Firefox called DownThemAll at http://www.downthemall.net/. This plugin accelerates your downloads by breaking files into 5 parts - each on different TCP connections.


Top
 Profile  
 
PostPosted: Wed Aug 15, 2007 9:36 am 
Offline
Knowledgeable
User avatar

Joined: Fri Feb 02, 2007 4:50 am
Posts: 263
Location: usa michigan centriville
good job William well i like it allot, so I’m giving you a 10/10 and the right to use my particle system into a tutorial teaching hem how to use bitblt particle system. that’s if you want to. I would do it but as I told you I rather not because I don’t truly think they deserve stuff like that. But that’s up to you William I leave it in your hands.

_________________
Fuck? I really joined in 2006.
Spirea, Chat Rooms, Discussions, Help. everything you need in one spot.
http://spirean.com
I love my computer, you never ask for more, you can be my princess or be my whore


Top
 Profile  
 
PostPosted: Wed Aug 15, 2007 12:35 pm 
genusis wrote:
good job William well i like it allot, so I’m giving you a 10/10 and the right to use my particle system into a tutorial teaching hem how to use bitblt particle system. that’s if you want to. I would do it but as I told you I rather not because I don’t truly think they deserve stuff like that. But that’s up to you William I leave it in your hands.


We don't deserve your system? We don't care about it. If it's using DX7 it's not a very good method anyways. If we wanted a good one, or one at all, we could convert MS to DX8 and borrow the system in vbGORE.

If you wanna talk about deserving something, you don't deserve to be here. We've all helped you enormous amounts of time. And you've asked me to join in several retarded projects. Like an OS made in VB..? Dude..

Anyways..

William, how much will this change? Is it really worth putting it in? I've yet to see much of a problem in my game, but that's also because it's not that popular yet so we don't have a lot of players on..


Top
  
 
PostPosted: Wed Aug 15, 2007 12:42 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Genusis, you are our guest here and the way you a behaving is unacceptable.

Either step in line or get back to Elysium, where you belong.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
PostPosted: Wed Aug 29, 2007 6:55 am 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
Robin wrote:
Genusis, you are our guest here and the way you a behaving is unacceptable.

Either step in line or get back to Elysium, where you belong.


IVE BEEN HIDING IN ELYSIUM SHMUT ZOMG. Not.

I swear Will does a shitload but no one ever appreciates it.
Anyways, nice work.

_________________
Image


Top
 Profile  
 
PostPosted: Tue Sep 25, 2007 6:43 pm 
Offline
Newbie

Joined: Thu Jun 07, 2007 3:28 pm
Posts: 19
how much does this affect speed and fps ? sounds like a great tutorial ;)


Top
 Profile  
 
PostPosted: Tue Sep 25, 2007 6:53 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
frozen you really should read through a tutorial first.

This won't effect your FPS or speed at all, it is simply trying to relieve some of the main sockets stress by receiving the most common packets through a different socket.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
PostPosted: Tue Sep 25, 2007 7:11 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
I think this mod is more organizational than functional.

I think the winsock send function in VB is blocking, which means it haults the program until it is sent. This fact eliminates any advantage to sending packets faster.


Downthemall uses multiple sockets to download from a connection that may have upload limits. If there's an upload limit per socket, then using one will only get you so fast. Using two will get you double that, etc. In a mirage environment where there is no limit to how fast a socket can be, there is no real advantage to using multiple sockets as far as I know...


I just recently did a lot of research on winsock :)

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Tue Sep 25, 2007 7:19 pm 
Offline
Newbie

Joined: Thu Jun 07, 2007 3:28 pm
Posts: 19
ah ok, thanks for the info


Top
 Profile  
 
PostPosted: Tue Sep 25, 2007 7:48 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
So Dave, your saying that the tutorial doesn't do much good? I was thinking that dividing it into 2 sockets would decrease a lot of preassure on the socket. And also smoothen the movement a tiny bit too since it can send a packet from both sockets at the exact same time.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Tue Sep 25, 2007 9:08 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Aug 17, 2006 5:27 pm
Posts: 866
Location: United Kingdom
Guys lets just be simple,

send 100 cars down a 1 lane road they are going to have to wait on each other a lil,

send 50 cars down a road each its going to make things easier and reduce waiting times,

its not that difficult...

Other online modern games use like 23874297482734 gazillion sockets, kinda seems stupid just to utilize one,

cant be a step backwards, it just cant; logic negates that


Top
 Profile  
 
PostPosted: Tue Sep 25, 2007 9:37 pm 
Fox wrote:
Guys lets just be simple,

send 100 cars down a 1 lane road they are going to have to wait on each other a lil,

send 50 cars down a road each its going to make things easier and reduce waiting times,

its not that difficult...

Other online modern games use like 23874297482734 gazillion sockets, kinda seems stupid just to utilize one,

cant be a step backwards, it just cant; logic negates that


I dunno much about winsock, or if what I'm about to say is even true, it's just a theory to combat what you said. :P

If the program only allows for one to be active at a time, then there is no point in having both. Know what I mean?


Top
  
 
PostPosted: Tue Sep 25, 2007 10:54 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Aug 17, 2006 5:27 pm
Posts: 866
Location: United Kingdom
You can have more than one socket active at a time...


Top
 Profile  
 
PostPosted: Wed Sep 26, 2007 3:01 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
Send 100 cars down a one lane road when you can only send one car at a time. You get no speed bonus from adding more lanes.

You can only send one packet at a time (you can not call send() twice at the same time)
You can only receive one packet at a time (you can not call receive() twice at the same time)

Explain to me where the speed increase is?

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Wed Sep 26, 2007 3:10 am 
Dave wrote:
Send 100 cars down a one lane road when you can only send one car at a time. You get no speed bonus from adding more lanes.

You can only send one packet at a time (you can not call send() twice at the same time)
You can only receive one packet at a time (you can not call receive() twice at the same time)

Explain to me where the speed increase is?


So I was right then..?


Top
  
 
PostPosted: Wed Sep 26, 2007 11:49 am 
Offline
Persistant Poster
User avatar

Joined: Thu Aug 17, 2006 5:27 pm
Posts: 866
Location: United Kingdom
why cant you handle multiple packets using different sockets?


Top
 Profile  
 
PostPosted: Wed Sep 26, 2007 11:59 am 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Obviously the call senddata can't ran twice at the exact same time. But if you are running and typing at the same time, and you hit enter while running. The movement socket wont need to deal with the message being sent.

The movement socket is independent on all the other data being sent.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Wed Sep 26, 2007 1:45 pm 
William wrote:
Obviously the call senddata can't ran twice at the exact same time. But if you are running and typing at the same time, and you hit enter while running. The movement socket wont need to deal with the message being sent.

The movement socket is independent on all the other data being sent.


It can still only send one thing at a time, so I don't see how it would make much of a difference..


Top
  
 
PostPosted: Wed Sep 26, 2007 2:46 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
It doesn't make much of a difference, but it do affect it a little. There is no downside by adding this. And unless you guys come up with a strong case why this wouldn't decrease the sending delay, I still think it's a decent thing that could be added.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Wed Sep 26, 2007 2:52 pm 
William wrote:
It doesn't make much of a difference, but it do affect it a little. There is no downside by adding this. And unless you guys come up with a strong case why this wouldn't decrease the sending delay, I still think it's a decent thing that could be added.


If it can't call that sub more than once at the exact time, it's the same as one socket.


Top
  
 
PostPosted: Wed Sep 26, 2007 3:04 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
If you checked my tutorial, it doesn't use the same senddata sub, since senddata is linked to socket1, and my senddata2 sub is linked to socket2. This way both those subs can run at the same time.

Its just senddata that cant be run at the same time twice. But by having two subs for the sending, it can.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 59 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group