vbGore Free Online RPG Engine

Revolutionizing Visual Basic ORPG Development
It is currently Tue May 21, 2013 4:26 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Winsock vs. Internet Connection Speed
PostPosted: Mon Jun 18, 2007 10:45 pm 
5th Dimension Prisoner

Joined: Mon Jun 18, 2007 2:16 am
Posts: 214
I test my game on my own computer (127.0.0.1) and have yet to run it over the internet. Most of the winsock senddata events are back to back with DoEvents inbetween which from what I know allow the line above it to execute before the next line is ran (which is below it). Is my theory wrong there?

So my question is this - My server/client may work fine on my own machine, but how would something like this work on say a 56k line:

Code:
Public Sub SendPlayerStats(Index As Integer)
    Dim InvParseNum As Integer
    Dim SkillParseNum As Integer
    Dim InvSlot As Integer
    Dim InvNum As Integer
    Dim SkillSlot As Integer
    Dim SkillDelimiterPacket As String
    Dim SkillDelimiter As String
    Dim InvDelimiter As String
    Dim InvDelimiterPacket As String
    Dim PlayerPacket As String
   
    SkillDelimiter = "â"
    SkillDelimiterPacket = "ä"
    InvDelimiter = "ã"
    InvDelimiterPacket = "å"
    InvParseNum = 0
    SkillParseNum = 0
       
    PlayerPacket = "STATþ" & Trim(Account(Index).CharName) & "þ" & Account(Index).Level & "þ" & Account(Index).Health & "þ" & Account(Index).Magicka & "þ" & Account(Index).Dice & "þ" & Account(Index).Sides & "þ" & Account(Index).Defense & "þ" & Account(Index).ExpGained & "þ" & Account(Index).ExpToNext & "þ" & Account(Index).Experience & "þ" & Account(Index).Access & "þ" & Account(Index).Wins & "þ" & Account(Index).Loss & "þ" & Account(Index).Gold & "þ" & _
                        Account(Index).Dark & "þ" & Account(Index).Holy & "þ" & Account(Index).Cold & "þ" & Account(Index).Fire & "þ" & Account(Index).ToHit & "þ" & Account(Index).ToBlock & "þ" & Account(Index).ToCast & "þ"
   
    For InvSlot = 1 To MaxInv
        If Account(Index).Inventory(InvSlot).Number = 0 Then GoTo GetSkills
        InvParseNum = InvParseNum + 1
        With Account(Index)
            PlayerPacket = PlayerPacket & InvSlot & InvDelimiter & .Inventory(InvSlot).Number & InvDelimiter & .Inventory(InvSlot).Amount & InvDelimiter & .Inventory(InvSlot).Used & InvDelimiter & .Inventory(InvSlot).CombatDurability & InvDelimiter & InvDelimiterPacket
        End With
    Next InvSlot

GetSkills:
    PlayerPacket = PlayerPacket & "þ" & InvParseNum & "þ"

    For SkillSlot = 1 To MaxPlayerSkills
        If Account(Index).Skills(SkillSlot).Number = 0 Then GoTo SendPlayerData
        SkillParseNum = SkillParseNum + 1
        With Account(Index)
            PlayerPacket = PlayerPacket & .Skills(SkillSlot).Number & SkillDelimiter & SkillDelimiterPacket
        End With
    Next SkillSlot
   
SendPlayerData:
    PlayerPacket = PlayerPacket & "þ" & SkillParseNum & "þÿ"
        DoEvents
    frmServer.wskMain(Index).SendData PlayerPacket
        DoEvents
   
    If Account(Index).StatPoints > 0 Then
        frmServer.wskMain(Index).SendData "LEVELUPþ" & Account(Index).StatPoints & "þ" & Account(Index).ToAddDice & "þÿ"
            DoEvents
    End If
End Sub


That's the largest packet that I'll be sending. I added in SendData "LEVELUP" so upon getting your stats, your level up screen pops up if you have stat points to distribute instead of waiting to gain a level which it then automatically does. This is mainly for first time registering accounts. But that's another topic altogether. Would this work on a slow connection? Any helpful tips would be greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 10:51 pm 
Site Admin

Joined: Fri Jul 14, 2006 4:00 pm
Posts: 11230
Location: Washington
So are you asking if its fine to send data constantly even behind a slow connection? The answer is yes - when you say send, it doesn't actually send until it is ready, it just stores it in the buffer until it can send.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 11:06 pm 
5th Dimension Prisoner

Joined: Mon Jun 18, 2007 2:16 am
Posts: 214
Awesome. Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


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

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group