Inverness

Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

115 Neutral

About Inverness

  • Rank
    Newbie
  1. Unreal Networking design questions

    Actors that already exist on the client would be those that are added to a level in the editor, which both the server and client would have a copy of in Unreal games. I recommend using RakNet if possible because it can handle reliability issues for you. Unreal compresses its vectors send sends the full value over the Internet, not a delta from the last state. This way the packet can be ignored if it arrives late or not at all. Unreal handles player movement separately from the rest of its replication using RPC. See this section: http://udn.epicgames.com/Three/NetworkingOverview.html#Player Movement and Prediction   This is why you need to be conservative in determining which actors in a game need to be replicated and how often they need to be replicated. In Unreal, the score board would be send to the client in WorldInfo which is a special actor representing the game world. You could also simply not use replication for things like that. Right now I have 3 modes of communication in my game: Normal replication happens only between actors and 5 times per second. This is done reliably, but order is not guaranteed and older packets can be ignored by the client. Example:public override void Serialize(DeltaSerializer s, IReplicaClient destination) { base.Serialize(s, destination); s.Write(_collideTiles); s.Write(_collideActors); s.Write(_blockActors); s.Write(_layer); } public override void Deserialize(DeltaSerializer s, IReplicaClient source) { base.Deserialize(s, source); s.ReadBoolean(ref _collideTiles); s.ReadBoolean(ref _collideActors); s.ReadBoolean(ref _blockActors); s.ReadSByte(ref _layer); }   Event messages can be sent manually between actors, which is what I use for my complex things like player movement or updating the inventory of an actor. For movement, this is done for every game update, which means 30 times per second as opposed to 5 for normal replication.private void MoveAutonomous(Vector2 delta) { // Only call this on the client when it is autonomous Debug.Assert(Actor.Role == NetRole.Autonomous); Move(delta); Vector2 newPos = Actor.Position; // Save moves so we can replay them later if the server corrects us _savedMoves.AddLast(new SavedMove(delta, _time)); // Tell the server to do the same move and confirm or correct our own NetOutgoingMessage message = CreateEventMessage(EventServerMove); message.Write(delta); message.Write(newPos); message.Write(_time); message.Write((byte)_direction); SendEvent(message, NetDeliveryMethod.UnreliableSequenced); } Player messages can be sent through through the player objects that represent clients in a game. The client only has its own local player object that can send to the server, but the server has one for each player logged in the game to communicate with its local counterpart. For each combination of a client and an actor relevant to it Unreal stores the values previously sent to that client. Replication is done by comparing the current value in an actor to the last sent value for each connection. This happens during network ticks only.
  2. Unreal Networking design questions

      I'm also using Unreal's networking model as inspiration for my own project, though I'm using C# for it.   Anyhow, a few points:   Actor checking: I suggest adding actors that could possibly be replicated (that aren't already provided by the level itself) to a separate list to be checked. You would further eliminate unnecessary checks by allowing actors to specify a replication rate so less important actors need not use as many resources.   And yes, if a client joins, the server would evaluate replication for that client and send it any actors that are relevant to it and they have not already been replicated to it.   As for reliability, I am using the Lidgren library for C# and used reliable sequenced delivery so packets always arrive but old packets are dropped in favor of newer ones.   As for Unreal networking attributes, bNetDirty is set whenever a property is set on an object in UnrealScript, it is a helper variable so you can skip replication if its false. bNetOwner is true when the client you're replicating to owns that actor, and bNetInitial is true when it is the first time you're replicating so you can send variables that only need to be sent once.   My current source code is available, it might be of some help or it might confuse you.  ReplicaManager handles replicating my actors through the IReplica interface. And you can look at my MovementBehavior component to see how player movement is handled. I just copied how Unreal did it in that case.
  3. How to start Network Programming?

    Considering I'm already pretty proficient with C++, for learning networking, I looked at existing documentation and code for engines like Source, Doom 3, and UDK. They were really helpful in understanding how I would design my game architecture for networking and the different ways that are possible. UDK's documentation on its networking is extensive, and Valve has a developer wiki with information about how they handle networking.   Sending messages between servers is very easy depending on what kind of library you use, such as RakNet.   Unfortunately I can't really point you towards a specific book or tutorial since I never used one myself.
  4. Quote:Original post by tgashby There's got to be a way to package it without dealing with that Visual C++ Redistributable... Can I just compile it in the console or something and include the dlls?With Visual C++ 10, you can simply include the runtime DLLs in the same folder as your executable and it will run. In previous versions, a private assembly was the only way to do this, but that is no longer necessary.