Hi everyone!
Over the last weeks I have been squishing bugs in my net game, and from what I can see, only one is left: Every joiner receives info from everyone including the host (like it should be), but the host only receives his own information, as if he is sending it to himself, and no info from any joiner is received.
This is the code I tracked down:
rem send positions to everyone
make memblock 1,20+(turrets(myplayerindex)*2)
write memblock byte 1,0,2
write memblock byte 1,1,0
write memblock byte 1,2,2
write memblock float 1,4,x#(myplayerindex)
write memblock float 1,8,y#(myplayerindex)
write memblock float 1,12,z#(myplayerindex)
write memblock byte 1,16,dead(myplayerindex)
write memblock byte 1,17,power(myplayerindex)
write memblock byte 1,18,update(myplayerindex)
write memblock byte 1,19,turrets(myplayerindex)
obj=0
p=0
for x=1 to mapx
for y=1 to mapy
inc obj
if turret(obj)=myplayerindex then inc p:write memblock word 1,18+(p*2),obj
next y
next x
send net message memblock 0,1
delete memblock 1
rem update turrets
m=myplayerindex
if update(m)=1
obj=0
for x=1 to mapx
for y=1 to mapy
inc obj
if turret(obj)=m then show object obj+2000:color limb obj+2000,5,rgb(r(m),g(m),b(m))
next y
next x
endif
rem get positions from everyone
get net message
while net message exists()
if net message type()=4
net message memblock 1
m=net message player from()
center text 320,240,"Receiving from : "+str$(m)
if m!myplayerindex
if memblock byte(1,0)=2
if memblock byte(1,1)=0
if memblock byte(1,2)=2
x#(m)=memblock float(1,4)
y#(m)=memblock float(1,8)
z#(m)=memblock float(1,12)
dead(m)=memblock byte(1,16)
power(m)=memblock byte(1,17)
update(m)=memblock byte(1,18)
turrets(m)=memblock byte(1,19)
for t=1 to turrets(m)
g=memblock word(1,18+(t*2))
turret(g)=m
next t
rem update turrets
if update(m)=1
obj=0
for x=1 to mapx
for y=1 to mapy
inc obj
if turret(obj)=m then show object obj+2000:color limb obj+2000,5,rgb(r(m),g(m),b(m))
next y
next x
endif
endif
endif
endif
endif
delete memblock 1
endif
get net message
endwhile
In case this is not enough, I attached my whole project.
In the receiving part of the above code, you will find the following line:
center text 320,240,"Receiving from : "+str$(m)
Running this on 2 computers, I get these results:
hostindex : 2
joinerindex : 1
joiner computer : a steady number "2"
host computer : a flashing, unsteady number "2"
Why is the command "net message player from()" returning the index of the host on the host computer? It should be returning the index of the joiner computer...
Any help is greatly appreciated.
TheComet
Make the paths of your enemies easier with WaypointPro!