dhewm / dhewm3

dhewm 3 main repository
https://dhewm3.org/
GNU General Public License v3.0
1.81k stars 351 forks source link

Bring checksum check for game logic binaries again. #353

Open Stradex opened 3 years ago

Stradex commented 3 years ago

I know that dhewm3 does not use anymore the game00.pk4, etc... files but actually these are important so while playing multiplayer we can ensure that server and client are both using the same game logic, otherwise, for example, in LibreCoop someone hosting with LibreCoop alpha 1.2 can join in a server while using LibreCoop alpha 1.1 binaries and that can cause problems to the clients (dropping from the server) but also even problems to the server!. It is important to make sure the server does not allow connections from people with different game logic binaries.

I am not so sure what's the best way to bring this back to dhewm3, but it is necessary I feel.

DanielGibson commented 3 years ago

Well, checksumming files that aren't there doesn't make much sense IMO ;)

Do you remember where the checksumming code was/how it worked? Could we maybe do something very similar but instead of using the checksum we use a version from the game.dll itself that you can increase when breaking compatibility?

Do you think we should find a solution before 1.5.1?

Stradex commented 3 years ago

I've been thinking about this and the solution is not appearing in front of my eyes. We CAN'T bring back the game00.pk4, game01.pk4, etc... because since dhewm3 work for SO many OS that's going to be problematic and can lead to people from some operative systems not being able to join to servers. So maybe having some kind of check with the game dll version (and it should be a static value, not something automatically generated, since people maybe would like to compile librecoop for their own OS and still being able to join to the servers)

That can be a solution, and yes people still would have it easy to "hack and cheat"but only people with bad intentions. But at least that way I can ensure that someone using an older version of librecoop will not be able to join to a server using a new version, all that without breaking compatibility with multiple OS.

I can try doing a pull request if you wish.

DanielGibson commented 3 years ago

So maybe having some kind of check with the game dll version (and it should be a static value, not something automatically generated, since people maybe would like to compile librecoop for their own OS and still being able to join to the servers)

Yeah, that's what I had in mind

I can try doing a pull request if you wish.

That'd be great! :)

That can be a solution, and yes people still would have it easy to "hack and cheat"but only people with bad intentions.

That can't be avoided anyway (esp. with all of Doom3 being open source); I don't see this kind of check as a way to prevent cheating but as a way to prevent problems for users with an outdated game dll.

DanielGibson commented 3 years ago

I thought a bit about this yesterday (but didn't implement anything). Adding/removing the old checksums breaks/breaked the network protocol (see usages of #if ID_CLIENTINFO_TAGS in AsyncClient.cpp and AsyncServer.cpp) - which I definitely want to avoid. However, it should be possible to transfer that game dll version as part of the server info or user info (which are both idDict), see:

Do you think that with those dicts it'd be possible to implement the version check completely in the game DLL? That would be really handy, because then:

Stradex commented 3 years ago

Today I'll take a look to that. Sorry for not doing it before.

DanielGibson commented 3 years ago

Do you mind if I release 1.5.1 today? If it turns out that this can't be done purely in gamecode, I could release 1.5.2 in a few weeks (or whenever we have a good solution).

Stradex commented 3 years ago

Do you mind if I release 1.5.1 today? If it turns out that this can't be done purely in gamecode, I could release 1.5.2 in a few weeks (or whenever we have a good solution).

Oh yes, that's nice for me.