Multiplayer: Dog-Fight and MMOPG
Posted: Mon Jan 03, 2005 12:54 pm
folks,
i have some thoughts on networking oolite i'd like to share.
let me start with a simple list of how to get to that goal:
Server for simple dogfight:
- awakes (or spawns a thread) when first client enters a new system
- controls one complete system (not a galaxy) per thread
- receives events from client
- moves all entities (ships, asteroids...) and checks for collisions/hits
- sends positions and velocities of visible entities to clients (may differ per client)
Client for simple dogfight:
- enters/connects server by hyperjump
- sends data about player/ship/cargo (cheat possible!)
- sends player movements (events)
- executes events localy (hoping the server agrees)
- receives server corrected data (avoid cheats and de-syncs) of pos. and vel. and adjusts local entities to match server data.
the dogfight-server would be a version of the current client without the graphical stuff. that would involve splitting the Entity-classes in two: one to maintain the physics (position, velocity...) and one for the gui (drawing the ships, asteroids...). the server could then sit there and wait for players. if a player wants to enter a system the server spawns a new thread/port for that system (like apache does) and redirects the client to the new port. other players entering the same system just get redirected to the running port.
the server then collects the events from the clients to move the players ships and all other entities in the system. the new positions and velocities are sent back async to the client. each client gets just the data of entities that are visible to it and not everything in the whole system to reduce traffic and avoid cheating (like maphack in diabloII). the client now adjusts it's local entities to match the servers. to avoid hangs on slow connections the client might just project a course of it's local entities on the latest data and adjust to the server's when the next packet arrives.
udp would be best for this but it needs holes in firewalls. tcp is slower (ack of every package) but goes easily through nat.
for a first proof of concept it might be possible to just extend the current client to act as a server for one system. in this case the player opening the server would not be able to hyperjump, as this would let the system collapse. or the server-output would just act like an observer (ghost-view) without any possibility to play.
extending this ideas to a persistent galaxy:
Persistent Server (MMOPG)
- maintains player/ship/cargo database (cheat resistent)
- persistent universe and cargo-prices
- delivers galaxy and system-info to client
Persistent Client (MMOPG)
- needs login to server to resume game
- no local save-game possible.
- no local knowledge of galaxy/systems/prices...
this is the part i am most interested of. it would make oolite a frontend to any space-trading mmopg. it would allow the server to tell the client what the galaxy looks like, what the prices are and what ships and cargo exists.
this grips me most because i have a mmopg (currently offline) with more than 130.000 suns, up to 15 planets each, up to 7 moons each planet. and i have settlers building colonies on those planets, producing tons of different goods, buildings, vehicles, weapons, and spaceships.
those are the strategy-gamers. existing front-end: html
and i'm still searching for a frontend for the spacers, who won't build colonies but want to fly through the wast space and just trade and fight like in oolite but with real people.
those are the action-gamers. wanted front-end: oolite
any thoughts?
i have some thoughts on networking oolite i'd like to share.
let me start with a simple list of how to get to that goal:
Server for simple dogfight:
- awakes (or spawns a thread) when first client enters a new system
- controls one complete system (not a galaxy) per thread
- receives events from client
- moves all entities (ships, asteroids...) and checks for collisions/hits
- sends positions and velocities of visible entities to clients (may differ per client)
Client for simple dogfight:
- enters/connects server by hyperjump
- sends data about player/ship/cargo (cheat possible!)
- sends player movements (events)
- executes events localy (hoping the server agrees)
- receives server corrected data (avoid cheats and de-syncs) of pos. and vel. and adjusts local entities to match server data.
the dogfight-server would be a version of the current client without the graphical stuff. that would involve splitting the Entity-classes in two: one to maintain the physics (position, velocity...) and one for the gui (drawing the ships, asteroids...). the server could then sit there and wait for players. if a player wants to enter a system the server spawns a new thread/port for that system (like apache does) and redirects the client to the new port. other players entering the same system just get redirected to the running port.
the server then collects the events from the clients to move the players ships and all other entities in the system. the new positions and velocities are sent back async to the client. each client gets just the data of entities that are visible to it and not everything in the whole system to reduce traffic and avoid cheating (like maphack in diabloII). the client now adjusts it's local entities to match the servers. to avoid hangs on slow connections the client might just project a course of it's local entities on the latest data and adjust to the server's when the next packet arrives.
udp would be best for this but it needs holes in firewalls. tcp is slower (ack of every package) but goes easily through nat.
for a first proof of concept it might be possible to just extend the current client to act as a server for one system. in this case the player opening the server would not be able to hyperjump, as this would let the system collapse. or the server-output would just act like an observer (ghost-view) without any possibility to play.
extending this ideas to a persistent galaxy:
Persistent Server (MMOPG)
- maintains player/ship/cargo database (cheat resistent)
- persistent universe and cargo-prices
- delivers galaxy and system-info to client
Persistent Client (MMOPG)
- needs login to server to resume game
- no local save-game possible.
- no local knowledge of galaxy/systems/prices...
this is the part i am most interested of. it would make oolite a frontend to any space-trading mmopg. it would allow the server to tell the client what the galaxy looks like, what the prices are and what ships and cargo exists.
this grips me most because i have a mmopg (currently offline) with more than 130.000 suns, up to 15 planets each, up to 7 moons each planet. and i have settlers building colonies on those planets, producing tons of different goods, buildings, vehicles, weapons, and spaceships.
those are the strategy-gamers. existing front-end: html
and i'm still searching for a frontend for the spacers, who won't build colonies but want to fly through the wast space and just trade and fight like in oolite but with real people.
those are the action-gamers. wanted front-end: oolite
any thoughts?