Hello.
I'm using mutisync for my game and am using memblocks to send the data. because the map data is stored in an array to begin with using "make memblock for array" seemed like the obveos choice. thing is though is when I receive the memblock the data is wrong, not even out of sync, but different data all together.
Code that loads the data from a file to an array. Then sends it to all players (does not have an issue as I can tell)
open to read 1,a$
read string 1,hold1$ <--- the maps size in x
read string 1,hold2$ <--- the maps size in z
dim mapmakerdata(2)
mapmakerdata(0) = val(hold1$)
mapmakerdata(1) = val(hold2$)
dim mymap(mapmakerdata(0),mapmakerdata(1),2) <-- the array for the tile data
`dump line
read string 1,hold2$ <-- a brake string as the file saves as word so I can view it in a text editor
`refull array
for y = 0 to mapmakerdata(1) - 1
for x = 0 to mapmakerdata(0) - 1
read string 1,hold1$
read string 1,hold2$
myMap(x, y,0) = val(hold1$)
myMap(x, y,1) = val(hold2$)
next x
NEXT y
if memblock exist(1) = 1 then delete memblock 1
MAKE MEMBLOCK FROM ARRAY 1,mapmakerdata()
if memblock exist(2) = 1 then delete memblock 2
MAKE MEMBLOCK FROM ARRAY 2,mymap()
`send the data
NET PUT MEMBLOCK 1
NET PUT MEMBLOCK 2
code for clients to receive and view the data. (only the first 16 are shown. Note that the for x and y thing was crammed in to see if it was loading the data correctly before it loads the map and is not final code.)
`see if the host has sent any data.
while net get message()
`get map specs
if memblock exist(1) = 1 then delete memblock 1
net get memblock 1
dim mapmakerdata(2)
make array from memblock mapmakerdata(),1
dim mymap(mapmakerdata(0),mapmakerdata(1),2)
make array from memblock mymap(),1
`now that we have a file. read it.
do <---- part I am talking about
set cursor 0,0
for y = 0 to 4
for x = 0 to 4
print mymap(x,y,0)
print mymap(x,y,1)
print "brake"
next x
next y
sync
loop
onlineloadworld()
endwhile
Code I added to the host loop to see if he could read the array correctly. Same thing as above.
`if host select map
if userType = "host"
sendmapdata()
do
set cursor 0,0
for y = 0 to 4
for x = 0 to 4
print mymap(x,y,0)
print mymap(x,y,1)
print "brake"
next x
next y
sync
loop
endif `host selecting map
I added a photo to show you the numbers it gives.
Thanks