BlitzPlay Client Problem

Blitz3D Forums/Blitz3D Programming/BlitzPlay Client Problem

FBEpyon(Posted 2004) [#1]
Im making a MMORPG and im having problems with the Client side of it..

When I connect to the server, the client wants to keep adding players that are already on the server playing TRIS go up (meaning more objects are being made of the players already there..) and the FPS is going down..

What im looking for a is a better HandleMassage Function and a UpdateNetworkObjects (being the objects that would already be there or that are made, well im in the game)

Also im not looking ot buy a already made MMORPG ENGINE i want to make my own sorry.. I thought I would inform you of that before you suggest it :P

Also BlitzPlay v 1.14 lite does seem to be working right Im using 1.12 lite

<code>

Function HandleMessages()
For Msg.msgInfo=Each MsgInfo

Select msg\msgtype

Case 255

nInfo.NetInfo=Bp_findid(msg\msgfrom)
If Msg\Msgfrom>1
i.info=New info
i\txt="ID#"+Msg\Msgfrom+" ("+BP_GetPlayerName(Msg\Msgfrom)+")"+" Has Joined"
EndIf
NetPlayer.NetPlayers = New NetPlayers
NetPlayer\NetID = msg\msgFrom
NetPlayer\Name$ = BP_GetPlayerName(msg\msgFrom)
Netplayer\Mesh=CreateCube()



Case 254
i.info=New info
i\txt="ID#"+Msg\Msgfrom+" ("+BP_GetPlayerName(Msg\Msgfrom)+")"+" Has Left"
For NetPlayer.NetPlayers = Each NetPlayers
If NetPlayer\NetID = msg\msgFrom
FreeEntity Netplayer\mesh
Delete NetPlayer
Exit
EndIf
Next



Case 100
BP_EndSession()
End

Case 52
;EntityAlpha waterplane,Float(msg\msgdata)

Case 51
i.info=New info
i\txt="Wiping out all Server Objects!"
For NetSideObject.NetObjects = Each NetObjects
FreeEntity NetSideObject\Mesh
Delete NetSideObject
Next


Case 50
X# = BP_StrToFloat(Mid$(msg\msgData,1,4))
Y# = BP_StrToFloat(Mid$(msg\msgData,5,4))
Z# = BP_StrToFloat(Mid$(msg\msgData,9,4))
Heading% = BP_StrToFloat(Mid$(msg\msgData,13,4))
NetSideObject.NetObjects = New NetObjects
NetSideObject\Mesh=CreateCube()
NetSideObject\X# = X#
NetSideObject\Y# = Y#
NetSideObject\Z# = Z#
EntityTexture NetsideObject\mesh,cubetex
EntityType NetsideObject\mesh,2

Case 2
i.info=New info
ChatText$=msg\MsgData
i\txt=BP_GetPlayerName(msg\msgFrom)+": "+ChatText$

Case 1 ;Position/Rotation Data
X# = BP_StrToFloat(Mid$(msg\msgData,1,4))
Y# = BP_StrToFloat(Mid$(msg\msgData,5,4))
Z# = BP_StrToFloat(Mid$(msg\msgData,9,4))
Heading% = BP_StrToInt(Mid$(msg\msgData,13,2))
For NetPlayer.NetPlayers = Each NetPlayers
If NetPlayer\NetID = msg\msgFrom
Netplayer\name=BP_GetPlayerName(Netplayer\Netid)
NetPlayer\X# = X#
NetPlayer\Y# = Y#
NetPlayer\Z# = Z#
NetPlayer\Heading% = Heading%
EndIf
Next

Default
i.info=New info
i\txt="[Type: "+Msg\Msgtype+"] "+"[From: "+BP_GetPlayerName(Msg\Msgfrom)+"] "+Msg\Msgdata
End Select
Delete Msg
Next

Function UpdateNetworkObjects()

For Netplayer.Netplayers=Each Netplayers
RotateEntity Netplayer\Mesh,0,Netplayer\heading%,0
PositionEntity Netplayer\Mesh,Netplayer\x#,Netplayer\y#,Netplayer\z#
CameraProject camera,Netplayer\x#,Netplayer\y#,Netplayer\z#

If EntityInView(Netplayer\mesh,Camera)
BMPtext fntsmall,ProjectedX#(),ProjectedY#(),Netplayer\name$+"("+Netplayer\NetID+")"
EndIf
Next


For NetSideObject.Netobjects=Each Netobjects
PositionEntity NetSideObject\Mesh,NetSideObject\x#,NetSideObject\y#,NetSideObject\z#
Next

End Function

</code>


jfk EO-11110(Posted 2004) [#2]
looks like you get that message 255 continously. Maybe BP tries to confirm it but fails to do that, so the server sends that 255 again? Where's Surreal? :)


FBEpyon(Posted 2004) [#3]
yeah thats what I was thinking :(


Zenith(Posted 2004) [#4]
Hehe silly, I knew this answer! Sorry :D

After reading a message (After the select) delete the message from the type! :)

simple as:
Delete msg


It just keeps reading the message each loop because surreal made it so you have to delete it -- that way you can log it or do whatever you want with it.. :)


FBEpyon(Posted 2004) [#5]
THANKS THAT FIXED IT!!!