Unvanquished / Unvanquished

An FPS/RTS hybrid game powered by the Daemon engine (a combination of ioq3 and XreaL)
https://unvanquished.net
Other
991 stars 160 forks source link

[Idea] Replace infostrings with json #2097

Open DolceTriade opened 2 years ago

DolceTriade commented 2 years ago

There shouldn't be any more reason to use infostrings. We should use a standardized serialization protocol like json. Since we control the master server as well, we should update the master server to only accept json.

necessarily-equal commented 2 years ago

On one hand, yes why not. On te other hand this adds a dependency to jsoncpp or another lib, so it must bring some benefit. Maybe https://github.com/Unvanquished/Unvanquished/issues/1749 is broken due to infostrings, but that's unsure.

Various things to consider:

Basically unless this fixes some bugs or helps debugging I'd rather not do it

slipher commented 2 years ago

I see mostly disadvantages to this.

Gireen commented 1 year ago

Is it for unv possible to download a JSON file and pass it to the client lua? Then we could use json on top of the current format.

the masterserver can query all servers and generate a json file clients download the json and pass it to lua for parsing and have it direct available for the ui

that would solve many networking issues where not all servers a listed the old serverbrowser would stay as fallback and for lan games

ghost commented 1 year ago

I don't see how changing a format (json is not a protocol) would change anything. From what I understand, infostrings are key->values pairs, like an ini file but without the sections. If one of the key's can benefit from a non-flat representation, then it can already use json, the content is, AFAIK, free-form, as long as the associated gamelogic understands it.

Or am I confusing infostrings with something else?

slipher commented 1 year ago

@bmorel, that is correct. Well, it is not 100% free-form as you can't use \ or ; characters... Still, the overhead of setting up a JSON library and dealing with unwanted structured data would be more than just making our own string->string map format that doesn't choke on certain characters.

Gireen's (unrelated to the OP) idea might be nice for easier development of 3rd-party server list apps such as Xonpress (the list at unvanquished.net/servers) or Viech's tray thing. It doesn't remove the need to ping the servers for the in-game list though as you want to make sure the server is reachable at a reasonable latency.

ghost commented 1 year ago

Then I guess an infostring could be added to give more complete info to server browser applications in JSon, while the pinging would use a different one, more lightweight?