PDA

View Full Version : Understanding Client/Server interaction and programming



Perro
06-18-2010, 12:54 AM
Hello.

First of all, I would like to thank all of you people who read questions and threads like this one, and help whenever you can. It is only because of people like you that newbies like me can go on with our projects.

Moving on, I'm learning about multiplayer in UDK. I know this is quite complicated and there are several tutorials on the internet, like this (http://udn.epicgames.com/Three/NetworkingOverview.html), this (http://mutualdestruction.net/udk-networking-tutorial/), and this (http://wiki.beyondunreal.com/Introduction_to_replication).

Even so, I cant figure out some concepts and how to code them, and my mind is blocked right now.

I managed to run a server and a client, but I "discovered" that the client doesnt have the gameinfo nor the gamecontroller the server have, BUT it is controlled with the same commands, and the same camera, and has the same hud...
I really think I'm wrong about this...

So I'm quite confused here.

For example, in my GameInfo class I wrote:
simulated exec function tellMeControllerClass()
{
`Log("Clase:"@GetALocalPlayerController().Class);
}
In my server it tells me what controller I have. In the Client, it tells me "not recognized" as if it doesnt exist!

I hope someone's able to clear my doubts...

immortius
06-18-2010, 03:41 AM
Some objects only exist on the machine they are created. GameInfo only exists on the server. AI Controllers only exist on the server. Each client and listen server has it's own, unconnected HUD.

This behaviour is determined by the object's RemoteRole.

Other objects only exist while they are relevant - which is more or less while they are visible to a player. Pawns are a good example of this.

elmuerte
06-18-2010, 05:56 AM
I'd suggest to read these articles:

http://wiki.beyondunreal.com/Legacy:Introduction_To_Replication
http://wiki.beyondunreal.com/Legacy:Replication_De-Obfuscation

Note that these two articles mention some things which are no longer relevant for UE3 (e.g. replication statements for functions in the replication block), but they are a good introduction to the whole replication system.

And then continue to:
http://udn.epicgames.com/Three/NetworkingOverview.html

Perro
06-18-2010, 12:04 PM
Then I will read the wiki links, read about remoterole and come back if I have any more questions. Thanks!

Perro
07-03-2010, 12:01 AM
Ok, after much reading and testing, I've been able to receive variables in the clients using gamereplicationinfo and playerreplicationinfo (for my AIControllers).

Even so, I cant handle client to server functions! I would like to change some values in my AIControllers from a client, so I thought of doing a server function in the PRI.

I basically want to do something like this:

Client calls PRI.function() ---> PRI.function is a server function so it is able to handle its owner, the AIController ---> AIController moves its pawn given the parameters in the function.

I searched for an answer before asking here, and I came up with this! http://forums.epicgames.com/showthread.php?t=680797

So the problem seems to be the Owner of the PRI (or GRI). In the server, its correct, but in the clients there is no owner.

Exactly where am I supposed to use this SetOwner function? :( Or am I doing something wrong here?

EDIT: Ok, There's nothing wrong. As said earlier, AICOntrollers dont get replicated, but PlayerControllers do, and they are located in the server.. so... yeah... My bad :P