smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.77k stars 2.79k forks source link

Instead of having just one `|split` message, we should have multiple. #5331

Closed scheibo closed 5 years ago

scheibo commented 5 years ago

Maybe instead of having just one |split message, we can have multiple.

|split|p1, etc. That'd probably be easier to read/etc than literally six repetitions of the same message.

Originally posted by @Zarel in https://github.com/Zarel/Pokemon-Showdown/pull/5317#issuecomment-474154108

The idea is that

|split|p1
SECRET
PUBLIC

would mean the same thing as

|split
PUBLIC
SECRET
PUBLIC
SECRET

and

|split|p2
SECRET
PUBLIC

would mean the same thing as

|split
PUBLIC
PUBLIC
SECRET
SECRET

Originally posted by @Zarel in https://github.com/Zarel/Pokemon-Showdown/pull/5317#issuecomment-474678889

I think this protocol change is important in a world with @MacChaeger's 4 player battles to allow for not sharing information between teammates (or an opponent in a free-for-all!) Because this changes protocol, I believe the change needs to first be made on the client (to handle the new protocol as well as the old one), after which point the server can be updated

Zarel commented 5 years ago

This change doesn't affect client, which only receives sanitized messages. It only affects the sim protocol – i.e. the protocol the sim process and the main process use to communicate with each other.

scheibo commented 5 years ago

Ah! Quite right, I forgot that the server handles this. I was thinking maybe replays have splits in them, but thats clearly wrong as theyre from the spectators POV. It seems its mainly battle.ts/battle-stream.ts/server/sockets.js and maybe a few other places that need updating.