Chadderz121 / wii-ct-code

CT-CODE Mario Kart Wii mod
MIT License
122 stars 17 forks source link

[Question] What causes ct-code to have a course/cup limit? #22

Closed s5bug closed 4 years ago

s5bug commented 4 years ago

I've been looking at bad1Code and bad1Data for CRS1 and CUP1 and I can't find anything that has a limit on it, but I might just not be looking hard enough.

Chadderz121 commented 4 years ago

I believe the main limit comes from the online packet format. When submitting a race vote packet, a single byte is used to transfer the course ID. Otherwise, I believe the rest of the game uses 32 bit IDs for cups and courses.

s5bug commented 4 years ago

If you already run the online servers via Wimmfi, couldn't you just patch that? Since le-code "removes" this limit, doesn't it do that?

Chadderz121 commented 4 years ago

Most of the game's networking is peer to peer. It's not a server issue, it just requires all peers to change the packet in the same way. The server is unaware of the change. As le-code demonstrates it's possible to change the packet format to patch it (without changing the server).

s5bug commented 4 years ago

So can le-code concretely not connect to a non-le-code peer?

Chadderz121 commented 4 years ago

I'm not sure, you'd have to ask leseratte. My assumption would be that it would be possible to have two different packet formats, and only use the 'extended' one when you knew it was safe to do so (e.g. friend rooms with all le-code clients or else regional rooms). It would therefore remain compatible if in worldwide, defaulting to the normal format. Most distributions already have to detect world wide and disable custom tracks anyway, since they are not compatible. Like I say, this is just my assumption though, I could be wrong and it could be incompatible.

s5bug commented 4 years ago

@Leseratte10

Leseratte10 commented 4 years ago

The CRS1 and CUP1 section don't have a hard-coded file size limit, the game just runs out of RAM after a certain size. The one-byte limitation for online mode is not the problem (offline), I've successfully created a ct-code distribution with 260 tracks in the past (of course, only 0-254, excluding 0x43 and 0xff worked online).

If you changed the format so CRS1 and CUP1 would stop wasting so much RAM, you could fit way more working courses in there (offline).

For the online mode in LE-CODE, I completely rewrote the track voting protocol, as that only had one byte per track ID (as Chadderz said). Currently, a LE-CODE peer cannot talk to a non-LE-CODE peer, that is correct. It just wasn't necessary to add that feature for MKW-Fun, as the worldwide mode is removed there anyways (only custom region and friend rooms are available). However, if necessary, that could be added.

Wiimmfi didn't need any change to support more tracks at all. That is all handled by the game itself.