Distributed Networking

I see. I’m not designing it that way because I don’t have a static server with a persistent world. It’s all peer-to-peer, with a host player who’s client handles level generation and distribution.

I suppose I’ll just have to suck it up and have the AI make a pointless object, or make everything a DistributedNode even if it doesn’t have any components to place in the scene graph.

Perhaps you don’t even need a special AI client, or rather, you don’t need a client with special “AI” privileges? You can connect your “AI” servers as regular clients. If they’re only responsible for moving their own objects around, not anyone else’s objects, you don’t need to use the special “AI” mode.

David

As I understood it, the AI is required to create a TimeManager for the use of DistributedSmoothNodes.

I tried to do it without, but I either got an error that the class “TimeManagerAI” was not found or some such, if I didn’t have the dcSuffix = “AI”, or the TimeManager didn’t seem to work correctly if I tried to use the class name “TimeManager” to create it. And I don’t know of a way to add the dcSuffix for a single object’s creation.

Does that make sense?

Ah, you’re right. Yes, you will need the TimeManagerAI, which means you need an AI class.

Okay, thanks for clarifying.

How do I tell the server to stop accepting new connections?

Nothing built in to do that. You can program the AI to send “go away” messages to new clients.

David

I thought as much. Thanks.

I’ve been working on a DistributedNode to use as an inter-client messenger, and I’ve run into a serious snag. The p2p and broadcast keywords for a method in the DC file appear to be mututally exclusive. When I use p2p, so that non-owners can send messages via the messenger, only the owner of the messenger gets them.

The only work around I can think of for this is to give each client it’s own messenger to send from. This seems needlessly inefficient.

p2p and broadcast are indeed mutually exclusive. p2p means “send only to the owner”, and broadcast means “send to everyone”.

Perhaps you’re thinking of clsend, which means “allow any client to send this message”. clsend is implicit when p2p is specified.

David

After continued thought, I believe I can get around it by creating a method with the p2p keyword that in turn calls a method with the broadcast keyword. That still seems silly to me, though.

Ah, so that’s the issue is it? The documentation on the keywords in the manual says:

That, apparently, is only a fraction of the story.

I edited the DC File page of the manual to replace the confusing explanations with more clear definitions.

Feel free to double check it for accuracy.

Hmm, yes, that manual page is a bit of a mess, isn’t it? But it’s more accurate now, thanks for that. :slight_smile:

David

Like I said, once I feel I have a real handle on this stuff, I’m going to add a full tutorial for the Distributed system to the manual.

When a client loses it’s connection to the server, be it because the sendDisconnect method was called or some other cause, the clientRepository prints out a warning to the console. Does it also send a message of some kind that I could program a response to? I’m looking for something I could tell a DirectObject to accept and call a method in response to.

Try accepting for cr.uniqueName(‘lostConnection’).

David

That worked, thanks.

What’s the proper way to delete a DistributedObject/Node such that all clients will remove it?

cr.sendDeleteMsg(obj.doId) should do it.

David