Photon -- Basic concepts Basic Concepts

Source: Internet
Author: User
Tags joins
ArticleDirectory
    • Applications
    • Game Logic
    • Operations operations
    • Events event
    • Connections and timeouts connection and timeout

 

Basic concepts the following article will show you the important basic concepts for photon. The following are important basic concepts of photon (applications ). Program
An application is the server side logic for a game. all features of a game (e.g. remote Procedure CILS, data storing, etc .) are implemented in a photon application. the C # source is compiled and the resulting assemblies are loaded by photons native core. to Setup applications and to define start parameters the photon core uses configuration files. an application is a server-side game logic. All features of a game are implemented in the photon application. The source code compiled by C # is compiled into an assembly and loaded to photons native core. Deploy the application and define parameters in the photon configuration file. Usually, all logics of a game are provided in a single application. photon is still able to run several applications at the same time. each application can have a different task. for example, a separate application can be made to send out policy files for web-based clients. by running a separate policy application next to your game logic you can add functionality. generally, all the logic of a game is provided by an application, and photon is To run multiple applications at the same time. Each application can have different tasks. For example, an independent application can be used to send a policy file to a web-based client, run an independent policy application to add function a client chooses the application it wants to use by simply providing the application's name on connect. when connecting a client, you need to use the application name to select an application.
Game Logic
The game logic defines how a client can interact with the server. It implements operations, events, and anything that the server does by itself. The game logic defines how the client interacts with the server. It implements operations, events, and what other servers want to do. A good basis for Room based games is provided   "Lite" Application   , Found in the SDK folder Src-server/Lite. It does not know (your) Game's logic (yet), but provides rooms where players can communicate and interact easily. The application   "Lite lolobby"   Extends Lite with lists of rooms if you want your users to select a room manually. lite is a basic room-based game application. It can be found in Src-server/Lite. It does not know your game logic, but provides a room, players can easily communicate and interact with each other. Lite loby extends lite and provides a room list so that you can manually select a room if your game is going to be a single, huge world,   MMO Demo Application   Is a good basis for it. this application handles interest management for your clients and provides classes for items, properties, actors and more. if your game is an independent and huge world, MMO is a good basic application that provides interest management and some types for your clients, such as commodities, attributes, and players. Alternatively any game logic can be developed directly on top of the C # framework. the entry point for this is the application class, defined in the photon. socketserver. DLL. or any game logic can be developed on the C # framework. The entry of this program must be defined in photon. socketserver. DLL
Operations operations
An operation is photon's equivalent to a Remote Procedure Call. photon clients use operation callfor anything they want to get done. An operation is equivalent to a Remote Procedure Call (RPC ). The photon client uses an operation call to perform operations and all of their parameters are defined in the server-side application as needed. clients can call any operation by setting up a hashtable with keys and values fitting the Operation's conventions. the client and server frameworks take care of serialization, transfer and deserialization. operations and properties are defined in the server application. The client can call any operation. You only need to set a hashtable key and value to create a contract for this operation, frameworks on the client and server is responsible for serialization, transmission, and deserialization of each operation can also provide a result. this is one way to provide a client with requested data. of course the result can be skipped, which saves bandwidth. each operation can also provide a result. This is a method provided to the client to request data. Of course, the result can be skipped. Skipping can save bandwidth traffic operation CILS and results are a thing between one client and the server. the other clients won't know about these. the call and result of an operation occur between a client and a server. Other clients cannot know the result.
Events event
Photon events are messages for clients. each event is typed by a byte code and carries game updates. the lite application defines several events but it's possible to define custom events purely on the client side. the photon event is a message to the client, and each event type is a byte Code Lite defines many events. You can also define general events unlike operation results on the client. A specified ed event is most likely caused another client's operation call. this means: events might arrive anytime. lite sends events when someone joins or leaves a room. unlike the operation result, an accepted event is most likely to trigger operation calls from other clients, which means that the event may occur at any time, in the lite application, when a player joins or leaves the room, the operation event is sent.   Raiseevent   (In lite) makes events truly universal: any client can create new events by putting together a hashtable with the data and applying a code on sending it. game data can be sent without any need to change the server. this Raiseevent Operations make events universally available: any client can create a new hashtable event containing data and application code for sending. Game data can be sent without changing the server of course, for more elaborate server side reaction to events, custom operations can be defined which check event data, compile it or create other events. of course, for more complex responses to server-side events, common operations can be defined as checking, compiling event data, or creating other events.
Connections and timeouts connection and timeout
Unlike plain UDP, photon's reliable UDP protocol establishes a connection between server and clients: commands within a UDP package have sequence numbers and a flag if they are reliable. if so, the processing ing end has to acknowledge the command. reliable commands are repeated in short intervals until an acknowledgement arrives. if it does not arrive, the connection is timed out. unlike conventional UDP, photon uses reliable UDP protocol to establish a connection between the client and the server: The command is in a UDP packet, which contains serialized numbers and a reliability mark, in this way, the acceptor can recognize this command. A reliable command is repeated within a short interval until it is confirmed. If it is not confirmed, the connection times out. Both sides monitor this connection independently from their perspective. both sides have their rules to decide if the other is still available. the monitoring connections at both ends are independent. You can also define your own rules if a timeouts is detected, a disconnect happens on that side of the connection. as we think the other side does not respond anymore, no message is sent to it. this is why timeout disconnects are one sided and not synchronous. if a timeout value is detected, the connection will be disconnected. In this case, we think the other side has not responded and no information can be sent to it, this is why timeout disconnection occurs on one side and is not synchronized.

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.