hey,
isnt it strange how the examples work but they dont when i try to implement them?
do
elapsed_time()
text 0,0,"Packets sent: "+str$(PACKETS_SENT)
text 0,13,"Packets PACKETS_RECEIVED: "+str$(PACKETS_RECEIVED)
text 0,26,"Screen fps: "+str$(screen fps())
packs = net get packetspersecond()
text 0,39,"Packets per second: "+str$(packs)
if role="host"
stateP1 = net get player state(1)
text 0,100,"Player 1 exists?: "+str$(stateP1)
endif
inc sendDelay
if sendDelay = 5
if role="host" then SendCoordinatesHost()
if role="client" then SendCoordinates()
sendDelay=0
endif
StackRecv()
`Handle controls
rotate camera 0,old_cam_y,0
if upkey()=1 then move camera Elapsed/5
if downkey()=1 then move camera -Elapsed/5
temp=get terrain ground height(1,camera position x(),camera position z())
position camera camera position x(),temp+20,camera position z()
cam_y=cam_y+mousemovex()
cam_x=cam_x+mousemovey()
if cam_x<-60 then cam_x=-60
if cam_x>60 then cam_x=60
old_cam_x=curvevalue(cam_x,old_cam_x,fps/drag)
old_cam_y=curvevalue(cam_y,old_cam_y,fps/drag)
old_cam_z=curvevalue(cam_z,old_cam_z,fps/drag)
rotate camera old_cam_x,old_cam_y,old_cam_z
sync
loop
FUNCTION SendCoordinates()
x# = camera position x()
y# = camera position y()
z# = camera position z()
net push float x#
net push float z#
net send 1
inc PACKETS_SENT
ENDFUNCTION
FUNCTION SendCoordinatesHost()
state = net get player state(1)
`Send the host coordinates to all players
if state
x# = camera position x()
y# = camera position y()
z# = camera position z()
net push float x#
net push float z#
net send 1
inc PACKETS_SENT
endif
ENDFUNCTION
FUNCTION StackRecv()
if net receive(1)
inc PACKETS_RECEIVED
msgAmount = net get msg amount()
for x=1 to msgAmount
net get msg
z# = net pop float()
y# = net pop float()
x# = net pop float()
position object 20,x#,y#,z#
inc PACKETS_RECEIVED
next x
endif
ENDFUNCTION
i simply dont understand why it doesnt work properly, the code their is just my main loop and the multiplayer functions, im using the stack recieve function for both host and server because they are identical for now, being server vs player.
sofar what happens is server hosts a game, i type in their ip and i connect, my packets sent count goes up but im not recieving packets and the host isnt sending/recieving nay. is there something terribly wrong with my code?
[EDIT] ok after thinking to myself i thought, why wouldent the packets count be changing? maybe because the packets dont match and voila the pop float ammount didnt match the sent ammount
.
well anyways get on msn