Unity3d network programming (2) (Unity3d built-in network parameters)

Source: Internet
Author: User
Tags password protection

Here are all the classes and methods that Unity3d can use in the network. Looking at the parameter functions,

Unity3d is the best choice for writing a mobile game:





Parameters that can be passed by RPC
Int
Float
String
NetworkPlayer
NetworkViewID
Vector3
Quaternion

Parameters that can be passed by BitStream
Void Serialize (bool value)
Void Serialize (char value)-only one byte [0, 0,255]
Void Serialize (short value)
Void Serialize (int value)
Void Serialize (float value, float maxDelta = 0.20.1f );
Void Serialize (Quaternion value, float maxDelta = 0.20.1f );
Void Serialize (Vector3 value, float maxDelta = 0.20.1f );
Void Serialize (NetworkPlayer value)
Void Serialize (NetworkViewID viewID)

RPCMode:
Server-only server
Others-send to everyone before t the sender
OthersBuffered-Send to everyone then t sender and adds to the buffer
All-send to everyone
AllBuffered-Sends to everyone and adds to the buffer

Network:
Network. AllocateViewID-automatically generate an available viewid
Network. CloseConnection-close the current connection
Network. Connect-Connect to the specified port or domain name
Network. connections-number of connections to the current Network
Network. connectionTesterIP-test the connection provider's IP address to connect to the server
Network. connectionTesterPort-test the connection provider's port to the server (Debug)
Network. Destroy-Destroy the Network connection related to the current viewID
Network. DestroyPlayerObjects-destroy the player objects related to the current Viewid
Network. Disconnect-close all connected connections and disable Network interfaces
Network. GetAveragePing-ping the player of the specified connection
Network. GetLastPing
Network. HavePublicAddress-check whether the current machine has a public IP Address
Network. incomingPassword-set the connection password of the server
Network. InitializeSecurity-server encryption and automatic Encryption
Network. InitializeServer-initialize the server
Network. Instantiate-Instantiate an existing prefab
Network. isClient-determines whether the current operation is a client
Network. isMessageQueueRunning-whether to cancel RPC access or Network Data Synchronization
Network. isServer-determine whether the current operation is a server
Network. logLevel-set the log level of the current Network information (sys)
Network. macConnections-set the maximum number of players that the server can connect to or the number of gamers
If it is set to 0, only one connection exists. If it is set to-1, the maximum number of connections and the current
The number of connections is equal. If so, if the player loses the connection, the server will be in the same position as the player.
Continue to save
Network. mininumAllocatableViewIDs-set the minimum number of viewids retrieved from the server *
Network. natFacilitatorIP-IP Address used for Network penetration
Network. natFacilitatorPort-set the port number for Network penetration
Network. OnConnectedToServer-[client] called when the connection to the server is successful
Network. OnDisconnectedFromServer-[client & svr] called when the server is disconnected
Network. OnFailedToConnect-[client] When the client connection fails
Network. OnNetworkInstantiate-[client | svr] when the Network instantiates an object call
Network. OnPlayerConnected-[svr] when a new player connects to the server
Network. OnPlayerDisconnected-[svr] when a player leaves the game
Network. OnSerializeNetworkView-[client | svr] synchronize variables through network view *
[Void OnSerializeNetworkView (BitStream stream, NetworkMessageInfo info)
Network. OnServerInitialized-[svr] when the server Initialization is successful
Network. peerType-Network peer status
Network. player-get the current NetworkPlayer instance reference
Network. proxyIP-IP address of the proxy server
Network. proxyPassword-proxy server password
Network. proxyPort-Port Number of the proxy server
Network. RemoveRPCs-Remove all RPC methods related to the current player from the server
Network. RemoveRPCsInGroup-remove the RPC method related to the current group from the server
Network. sendRate-transmission frequency of Network synchronization
Network. SetLevelPrefix-sets the region before the Network and applies it to all viewids.
Network. SetReceivingEnabled-sets whether the specified gamer group information can be received.
Network. SetSendingEnable-sets whether the specified gamer group information can be sent.
Network. TestConnection-test the connection status of the current host *
Network. TestConnectionNAT-force test the connection status of the current host
Network. time-get the current Network time, in seconds
Network. useProxy-use a proxy server


NetworkView:
NetworkView. Find-use netview id to Find a NetworkView
NetworkView. group-the group of the current NetworkView
NetworkView. isMine-whether the current object has the NetworkView Control Function
NetworkView. observed-whether the current NetworkView is under observation <name>
NetworkView. owner-who owns the current NetworkView
NetworkView. RPC-call all the RPC methods currently connected to the server
NetworkView. SetScope-set NetworkView's associated NetworkPlayer Information
NetworkView. stateSynchronization-security of synchronous transmission of Network Data *
NetworkView. viewID-NetworkViewID of the current NetworkView


NetworkViewID:
NetworkViewID. isMine-whether the object is self-instantiated
NetworkViewID. operator! =-If two networkviews are not equal
NetworkViewID. operator =-if the two networkviews are equal
NetworkViewID. owner (NetworkView)-NetworkViewID owned by NetworkPlayer
NetworkViewID. ToString-the formatted NetworkViewID is returned.
NetworkViewID. unassigned-indicates that the current networkview id is invalid.


NetworkPlayer:
NetworkPlayer. externalIP-obtain the IP address that the current NetworkPlayer is available to external users.
NetworkPlayer. externalPort-obtain the port number opened by the current NetworkPlayer.
NetworkPlayer. guid-The GUID of the current NetworkPlayer. When NAT punchthrough is used
NetworkPlayer. ipAddress-IP address of the current NetworkPlayer
NetworkPlayer. port-the port number of the current NetworkPlayer
NetworkPlayer. operator! =-Whether two networkplayers are not equal
NetworkPlayer. operator =-whether two networkplayers are equal
NetworkPlayer. ToString-returns the index of the current NetworkPlayer.


HostData:
HostData. comment-host description
HostData. connectedPlayers-number of current gamer connections
HostData. gameName-name of the game corresponding to the current host
HostData. gameType-game type corresponding to the current host
HostData. guid-NAT punchthrough
HostData. ip-Host ip Address
HostData. passwordProtected-whether the host has password protection
HostData. playerLimit-Maximum number of players on the host
HostData. port-port Number of the current host
HostData. useNat-whether the current host has the Nat penetration Function

MasterServer:
MasterServer. ClearHostList-Clear the list of hosts obtained from MasterServer. PollHostList
MasterServer. dedicatedServer-whether the current machine has a VPC
MasterServer. ipAddress-IP address of the master server
MasterServer. OnFailedToConnectToMasterServer-[svr | client] callback when the connection to the master server fails
MasterServer. OnMasterServerEvent-when the master server has an event notification [MasterServerEvent]
MasterServer. PollHostList-check the latest host list through MasterServer. RequestHostList
MasterServer. port-master server port number
MasterServer. RegisterHost-register the current server to the master server
MasterServer. RequestHostList-Request Host list from master server
MasterServer. UnregisterHost-unregister the current server from the master server
MasterServer. updateRate-set the minimum update frequency of the master server. If it is 0, the master server will not be updated,
The default update frequency is 60 s.





Zookeeper

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.