openairlinetycoon / OpenATDeluxe

The open source remake of Airline Tycoon Deluxe
GNU General Public License v3.0
108 stars 15 forks source link

Network play #7

Open Serphentas opened 5 years ago

Serphentas commented 5 years ago

It's early to implement it now but regarding the overall design, I think a DHT could be used to find servers and each server serves clients over UDP. Pretty basic implementation where actions of each player are forwarded to others, something along those lines.

WizzardMaker commented 5 years ago

Yeah we should use a message system, where every action done by a user will create a message for every other player. That way we don't send the full game state over and just inform of the changes from each player. For that to work we would need to implement a checksum system to prevent sessions from desyncing. It should also be a server client model, as we need one person to calculate the computer players and their actions.

I am not keen on implementing a master server list for connecting to other players though. We lack the ability to do proper NAT Punching for most of the people and letting them do the work with direct IP or Hamachi is the easier route, but I am open for more discussion on that topic.

Serphentas commented 5 years ago

I can see the server doing all the computation and on a fixed tickrate, all actions are applied and a new state is obtained. All changes from the previous state would then be seen on clients when they pull info (or the server pushes). Many ways to do it.

As for the server list, we can use https://github.com/bmuller/kademlia. Pretty straightforward.