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.