The Sims Online: Pre‐Alpha ‐ nio2so Protocol Regulators Reference - JDrocks450/nio2so GitHub Wiki
This reference material is generated from this directory in the repo.
These handle incoming PDUs by their PDU Type. They can respond with one, or many PDUs.
When a PDU is received from the client in nio2so, the PDU given to the Protocol-Regulator that has a matching Handler function. These are broken-down into three types:
- TSOProtocolHandler - These are simple TSOVoltron PDUs, deriving from TSOVoltronPacket. They fall into this category if they are not one of the other two.
- TSOProtocolDatabaseHandler - These are Database PDUs, they derive from TSODBRequestWrapper.cs, which in turn derives its logic from TSOVoltronPacket, and therefore is also a TSOVoltron PDU. They have a different structure and format than a normal TSOVoltron PDU and are used primarily in Database operations, hence the name.
- TSOProtocolDatablobHandler - These are used specifically in the Simulation of the game. They have Broadcast and Transmit types of Datablob PDUs.
- Respond to the Client with a PDU it forms
- Insert a new PDU into the receiving queue (pass messages to another regulator)
- Append a PDU to the end of the receiving queue
- Ignore it
- Run other code depending on what the needs are.
These regulators have a connection to the nio2so Data Service to supply data to the Client.
/// <summary>
/// Handles incoming requests related to the Avatars and their DB operations
/// </summary>
[TSORegulator("AvatarProtocol")]
internal class AvatarProtocol : TSOProtocol
nio2so Protocol-Regulators have the TSORegulator attribute and inherit TSOProtocol (TSORegulatorBase).
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| FIND_PLAYER_PDU | FIND_PLAYER_PDU | TSOVoltronPacket PDU |
| Incoming PDU CLSID | Parameter(s) | Associated Action CLSID |
|---|---|---|
| GetCharByID_Request | TSODBRequestWrapper PDU | GetCharByID_Request |
| SetCharByID_Request | TSODBRequestWrapper PDU | SetCharByID_Request |
| GetCharBlobByID_Request | TSODBRequestWrapper PDU | GetCharBlobByID_Request |
| GetBookmarks_Request | TSODBRequestWrapper PDU | GetBookmarks_Request |
| SetBookmarks_Request | TSODBRequestWrapper PDU | SetBookmarks_Request |
| InsertNewCharBlob_Request | TSODBRequestWrapper PDU | InsertNewCharBlob_Request |
| SetCharBlob_Request | TSODBRequestWrapper PDU | SetCharBlob_Request |
| DebitCredit_Request | TSODBRequestWrapper PDU | DebitCredit_Request |
| SetMoneyFields_Request | TSODBRequestWrapper PDU | SetMoneyFields_Request |
| GetRelationshipsByID_Request | TSODBRequestWrapper PDU | GetRelationshipsByID_Request |
| GetReversedRelationshipsByID_Request | TSODBRequestWrapper PDU | GetReversedRelationshipsByID_Request |
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| LOAD_HOUSE_PDU | LOAD_HOUSE_PDU | TSOVoltronPacket PDU |
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| BuyLotByAvatarID_Request | BuyLotByAvatarID_Request | TSODBRequestWrapper PDU |
| GetRoommateInfoByLotID_Request | GetRoommateInfoByLotID_Request | TSODBRequestWrapper PDU |
| GetLotList_Request | GetLotList_Request | TSODBRequestWrapper PDU |
| GetLotByID_Request | GetLotByID_Request | TSODBRequestWrapper PDU |
| GetHouseThumbByID_Request | GetHouseThumbByID_Request | TSODBRequestWrapper PDU |
| SetHouseThumbByID_Request | SetHouseThumbByID_Request | TSODBRequestWrapper PDU |
| GetHouseBlobByID_Request | GetHouseBlobByID_Request | TSODBRequestWrapper PDU |
| SetHouseBlobByID_Request | SetHouseBlobByID_Request | TSODBRequestWrapper PDU |
| SetLotByID_Request | SetLotByID_Request | TSODBRequestWrapper PDU |
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| LIST_ROOMS_PDU | LIST_ROOMS_PDU | TSOVoltronPacket PDU |
| LOT_ENTRY_REQUEST_PDU | LOT_ENTRY_REQUEST_PDU | TSOVoltronPacket PDU |
| DESTROY_ROOM_PDU | DESTROY_ROOM_PDU | TSOVoltronPacket PDU |
| DETACH_FROM_ROOM_PDU | DETACH_FROM_ROOM_PDU | TSOVoltronPacket PDU |
| CHAT_MSG_PDU | CHAT_MSG_PDU | TSOVoltronPacket PDU |
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| GetHouseLeaderByLotID_Request | GetHouseLeaderByLotID_Request | TSODBRequestWrapper PDU |
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| GET_MPS_MESSAGES_PDU | GET_MPS_MESSAGES_PDU | TSOVoltronPacket PDU |
| FLASH_MSG_PDU | FLASH_MESSAGE_PDU | TSOVoltronPacket PDU |
Inbox Lifecycle: The
GET_MPS_MESSAGES_PDUhandler follows a "fetch-and-clear" pattern. It downloads all pending messages for the avatar from the data service, transmits them to the client as individual flash packets, and then immediately callsClearInboxMessagesto empty the server-side queue.-
Flash Message Routing: The
FLASH_MESSAGE_PDUlogic differentiates between two types of communication:SMS: Attempts a real-time delivery using
TrySendTo. If the recipient is online and the packet sends successfully, it confirms back to the sender.Letter: Persists the message to the database via
SendInboxMessageToAvatarfor later retrieval, acting as an offline mailing system.
Data Conversion: The class includes helper methods
ToLetterandFromLetterto bridge the gap between the network-layerTSOFlashMessagePDUand the data-service-layerLetterobject.
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| SearchExactMatch_Request | SearchExactMatch_Request | TSODBRequestWrapper PDU |
| Search_Request | Search_Request | TSODBRequestWrapper PDU |
-
Unified Logic: Both exact and wildcard searches are routed through
UnifiedSearchHandler. This method determines the search type by checking the object type (TSOExactSearchRequest) and then awaits the results from the data service. -
Category Mapping: The search utilizes the
TSO_PreAlpha_Categoriesenum, which is converted to a string before being sent to thenio2soVoltronDataServiceClient. -
Search Results: The results are mapped from the data service IDs and names into
TSOSearchResultStructobjects before being packaged into either aTSOExactSearchResponseor a standardTSOSearchResponse.
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| GetTopList_Request | GET_TOP_LIST_REQUEST | TSODBRequestWrapper DBPDU |
| GetTopResultSetByID_Request | GET_TOP_RESULT_SET_BY_ID_REQUEST | TSODBRequestWrapper DBPDU |
Dynamic Image Conversion: The class includes a unique
TO_RLE8method. Since The Sims Online (Pre-Alpha) requires specific legacy formats, this converts modern images into 8-bit Indexed BMPs with RLE (Run-Length Encoding) compression on the fly.Resource Caching: It uses a
ConcurrentDictionaryto cache these encoded bytes during a single request cycle to avoid redundant processing, though it callsFLUSH_CACHE()at the end of theGET_TOP_LIST_REQUESTto prevent memory bloat.Format Constraints: Images are explicitly cropped and clamped to a maximum size of 96x23 pixels during the conversion process to ensure they fit the UI constraints of the Top 100 list icons.
Top 100 Lists: The logic supports different list types (e.g., "Most Popular Places") by mapping the remote data service results into the
TSOTop100ListandTSOTopListResultStructformats required by the client.
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| BYE_PDU | BYE_PDU | TSOVoltronPacket PDU |
| CLIENT_ONLINE_PDU | CLIENT_ONLINE_PDU | TSOVoltronPacket PDU |
| BC_VERSION_LIST_PDU | BC_VERSION_LIST_PDU | TSOVoltronPacket PDU |
This handler manages incoming telemetry and logging from the client.
| Incoming PDU CLSID | Method Name | Parameters |
|---|---|---|
| InsertGenericLog_Request | InsertGenericLog_Request | TSODBRequestWrapper PDU |
-
UPDATE_PLAYER_PDUthis PDU tells the client "who" the player is, their name and account ID. -
This Protocol handles when someone disconnects from Voltron, ensuring their session is properly closed: their house they're hosting is taken offline, and they're properly marked as being offline.
-
BC_VERSION_LIST_PDUis currently unknown what it does. -
InsertGenericLog_Requestis sent from the Client when it wants to log something important, and it is shown in nio2so as well.