HybridGames / odyssey

Working on preserving and improving the Odyssey Classic source code.
The Unlicense
3 stars 4 forks source link

Map Failed to Load - Showing Anyways #6

Open clowenhg opened 10 years ago

clowenhg commented 10 years ago

So, logging into a fresh server.dat, Map 1 has grass and the message "Map Failed to Load - Showing Anyways" appears.

In the Client, modProcess - ProcessReceivedMap is where that message appears.

It seems to only be happening on Map 1

clowenhg commented 10 years ago

Issue may be a matter of the map data, but until we can add data to other maps we can't test this.

7 prevents us from updating the other maps.

clowenhg commented 10 years ago

Now that I was able to upload the map the error went away. The error showed up at first, but after uploading something for Map1 it doesn't show up anymore.

Need to try deleting the server.dat and trying again, I think it may be related to the cache having data that the server doesn't.

clowenhg commented 10 years ago

Now that there was a Map2 linked previously, it looks like the client expect to be able to go there. Going to the edge of the map like I was moving from 1 to 2 causes the Map Failed to Load message to keep coming up. Suspecting that the cache is out of sync with the server.

clowenhg commented 10 years ago

Looks like deleting the cache removes the issue. Removed the error handling and got a "Subscript out of Range" error.

So it seems like an issue of syncing between the cache and the server data.

clowenhg commented 10 years ago

Traced the error to this line

modCompress - UncompressString

ReDim bRet(lKey - 1)    'allocate output buffer

In this case, lKey was 0 to ReDim with a -1 seems to be the issue. Going to investigate, but we may just be able to surround this with an if block.

clowenhg commented 10 years ago

So the bRet(0) is the one throwing an issue. Saying the subscript is out of range.

Call ZUncompress(bRet(0), lKey, bData(0), lCSz)    'decompress to output buffer

It seems like this isn't a problem after the server is established with some maps, but it shows that the map cache could override live map data from the server.

clowenhg commented 10 years ago

Server: modProcess - ProcessString

If MapRS.NoMatch Then
    SendSocket Index, Chr$(21) + String$(2677, vbNullChar)
Else
    SendSocket Index, Chr$(21) + MapRS!Data
End If

If the map isn't found in the database, it sends a bunch of nulls. Suspecting that this causes a problem with the compression. Possibly all null is an issue, or the final data size and alignment isn't correct.

clowenhg commented 10 years ago

Previous note was Case 4 'Request Map, using a different size 2677) later in the code there is this. There is also a Case 104 'Send uncompressed map with the 2677 size.

Server: modProcess - ProcessString

Case 45    'Request Map
If Len(St) = 0 Then
    MapRS.Seek "=", .Map
    If MapRS.NoMatch Then
        SendSocket Index, Chr$(21) + String$(2388, vbNullChar)
    Else
        SendSocket Index, Chr$(21) + MapRS!Data
    End If
Else
    Hacker Index, "A.66"
End If
clowenhg commented 10 years ago

So, my current suspicion is that the case 45 is sending simply blank text, which isn't actually a compressed string. The client isn't aware that it's not compressed, tries to uncompress it and has an error.

Since the entire string is null, there is no size information encoded into the byte string, so defining the bRet to size -1.

It also looks like the map data is compressed when it's placed into the database. The Case 104 explicitly decompresses the map after getting it from the database.

St = UncompressString(MapRS!Data)