Some thoughts on Networking and Multiplayer facilities within OpenRails.
To initially try and replicate the model railway club style experience where a small group of people who are known to each other organise an operating session, some will be drivers and some will be signallers. The ability to join and leave on-demand will be a nice feature for later however it is felt that this will need additional management such as kicking, banning, reporting and so forth.
Initially there will be two clients, one will be the simulator itself for drivers, the other will be a virtual signalbox. Ultimately these will be merged, also allow the signallers to see the 3D world and also potentially take on multiple roles. Initially though, the rule of thumb is keep it simple.
No AI trains and no AI signallers. Any session will therefore need a min of two players, one to signal and one to drive.
Drivers potentially can hop between trains if OR permits this. Signallers can hop between configured boxes.
Initially, a separate support file will define the layout of each signalbox, identifying the signals and junctions controlled and also the visual layout of the box. Definitions will refer to named/numbered points and signals and be able to use an API to effect a state change, read a state etc.
Users will initially use a client to gain access to a lobby, this will provide some basic chat functions and allow users to gather together.
The system will then allow users to create a session, optionally password protected, and set the limit of participants.
Users will elect to join a session and within that session can also chat amongst themselves. They will be able to select their roles, initial starting positions (e.g. which signal box, which loco etc).
At some point the players will be ready and the organiser can start it, this will then cause everyone to go in to the virtual world together.
It is not deemed necessary at this point to consider implementing voip, there are other 3rd party systems that can effect this feature for now.
Text chat in the game should be implemented, both in the 3D drivers world and in the 2D signallers world, it should include chat that all participants can see and contribute to as well as "private" chat between two parties. Only global chat will be implemented initially.
- Get Junction state
- Set junction state
- Get signal state
- Set signal state
- Get all junction states
- Get all switch states
- Player position and speed data (track piece id, track position, direction, speed, speed delta avg)
- Other player event (horn, whistle, triggered animations like windows opening, doors opening etc)
- Trigger details
- Signal state change
- Junction state change
This will be implemented as a client/server system, to be hosted on an Internet accessible server. Peer-to-peer would bring in many potential firewalling issues and while it isn't ruled out for later, the client/server approach is felt to be a much simpler starting point.
I can't remember the names of these things, they're from the real railways - i.e. they are on the track, and they detect the presence of a train and feed that back to the signal box, which usually would mean a light would appear on the panel for example.