education-2022/ideas/realtimenetworking.md

2.5 KiB

Structure

All references to "ass" in the following are courtesy of StrangeZak.

Prereqs

  • TCP/UDP
    • Packets and ordering
  • Sockets
    • Port forwarding, firewalls - context for why you might do NAT punching
    • hey ive heard of this thing called "web sockets"
      • tcp over tcp, baby
    • Blocking vs. non-blocking sockets
  • Peer-to-peer / network topology
    • why peer to peer is ass
    • NAT punching: STUN/ICE/TURN
      • Types of NATs (carrier-grade vs. normal)
    • WebRTC
    • UPNP (auto port forwarding) (possibly an aside?)
      • security problems
      • please do not
  • Handshakes / authentication

Games

  • Code structuring for games
    • the way every game handles you know replicating eneitites to other clients is very different so you have ot pick the one that you think is least ass
    • they are all ass
  • Prediction / rollback
    • Older model: every input is sent to the server, server sends state to clients
    • Newer model: local game is simulated independently, corrected by the server as it goes (prediction and rollback)
    • How some games might do this
      • Unreal: go over all connections, iterate all actors, see if actor is relevant, delta, bunch, send
        • typical of big shooter games - you want to be able to control relevancy of data per connection (e.g. what is in view)
      • Simple 2D game: send the whole state
  • Server / client authority
  • RPCs

Audio / video streaming

  • Packet framing (deltas / key frames / error correction)
    • I, P, and B-frames (for video)

Collaborative editing

  • CRDTs...? Operational transforms?

Possible applications of real-time networking

  • Multiplayer games
  • Collaborative editing
  • Real-time communication (audio/video)

Useful practice projects

These would all need to be written and vetted by the community. We're not going to find good examples of this lying around.

  • Basic multiplayer game with rollback
  • Online voice chat
  • Figma-like?