1: Unreal Engine network Architecture: Actors

Source: Internet
Author: User

Finally have the time, intends to be serious this weekend to study the Unreal Engine network architecture, and I found on the safaribooksonline a instinct to make my life easier book multiplayer Game programming by Rough Cuts, Enjoy the weekend.

Well, take the last part: Why is the Unreal Engine's network architecture so efficient?

  1. Continue the generalized client-server model from his architectural pattern (generalized Client-server models):

In this model, the server still controls the game state changes, the client runs the same code as the server to determine the game's running state. The server sends the game state information to the client by replicating replication, and the client and server can also replication exchange information.

Of course, in order to minimize the duplication of content, we sorted out only the actors of the calling function.

  2. The Unreal network architecture from the earliest Tim Sweeney, Unreal 3-unreal 4 I didn't see much change.

 The following can usually be duplicated in the engine variable, Function, Actor,object, game state, tick.

-client is a Unreal.exe running instance that maintains a set of approximate game state subsets of events occurring in the world and can render an approximate view of the world.

-Server is a running instance that is responsible for each individual level and passes the game state to the client.

  3.Unreal an update cycle that occurs between the server and the client

  -If I am a server, I can pass my status to all clients.

-If I am a client, I can send the motion of my request to the server and receive the game status information from the server and send it to the client to render to the screen.

  

  4. About real-time status updates in Unreal: Event Tick (float deltatime)

Each tick affects all actors updates to the game, implementing their physical variables or events, such as Position+=velocity*deltatime;

So in the tick for acting on actor can

-Modify Actor's variables

-Create actor

-Destroy actor

  Do you wonder why I spend so much energy explaining unreal updates? Because server Management game state is the state of all actors in the management world. So the server is considered to be a real game state, the game state on the client can be said to be the approximate state of the server side, need to be supervised and treatise. Objects that exist on the client cannot be treated as proxies because they are just approximations of a proxy.

For example, your iphone machine ran its own character pawn, which is not really pawn, but a server-side pawn clone, only for you to present. Sadly, you can only play on the client to an avatar.

  5. To save performance, we have to classify the actor: These signs indicate that the actor's links will be replication

In a level, there is no change in the state of some actors, we know they are immutable, so copying without meaning only wastes unnecessary bandwidth and waste. We use two kinds of flag bits to Bnodelete | | Bstatic's actor is ruled out, and the actors in both flags are generally either Staticmesh or gameinfo.

So what special annotations does the actor need to make for replication?

The actor that exists on both the server and the client we mark it as authority. For the server side is always save it as authority authority, and for the client is to prioritize to differentiate: for example, in network replication to the client, if a splash particle effect of the importance of performance, certainly less than the player shot bullets. According to the priority we can be divided into:

Dumbproxy (dumb agent): Portal, Pickup items

Simulatedproxy (emulation agent): Projectiles can use actors that physically predict on the client. Description This is a temporary actor that simulates physics and animation on the client.

Autonomousproxy (autonomous agent): This is a local player that can perform some local predictive motion (giving the player control). Local scripts can be executed and visible only on local clients and not in the server and single player games.

Authority: Can execute script, enter state, all actors on server side. When local, the actor is generated locally to reduce bandwidth, such as effects. On the server side, all role=role_authority and Remoterole are set to the same type of proxy. The opposite is on the client and server side.

// Net variables.enum ENetRole{   ROLE_None,              // No role at all.   ROLE_SimulatedProxy,    // Locally simulated proxy of this actor.   ROLE_AutonomousProxy,   // Locally autonomous proxy of this actor.   ROLE_Authority,         // Authoritative control over the actor.};var ENetRole RemoteRole, Role;
  
 用以下的举例来结束这一片内容:
a.因为Actor.AmbientSound变量是从服务器发送给客户端的
 if(Role==Role_Authority)
AmbientSound;

b.Actor.AnimSequence,只有当actor被渲染成为mesh时才会
从服务器发送给客户端
 if(DrawType==DT_Mesh && RemoteRole<ROLE_SimulatedProxy) AnimSequence;

c.Server传送给client velocity为代理模拟。当被初始化为mover时
 if((RemovetRole==ROLE_SimulatedProxy && (bNetInitial||bSimulatedPawn))||bIsMover)velocity;

  

  

1: Unreal Engine network Architecture: Actors

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.