Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Design decision, call backs and network data

by zentara (Archbishop)
on Jul 25, 2004 at 12:27 UTC ( [id://377264]=note: print w/replies, xml ) Need Help??


in reply to Design decision, call backs and network data

I can sympathize with your current problem. I'm working on a 4 player, tcp-networked game and have spent the last 4 days trying to solve a similar problem. If the "listening loop' isn't setup just right, things quickly get "out of synchronization" and I end up with a situation where clients have to hit enter a few times, to be brougt back into "sync".

All I can say is setup a test network, and hack,hack,hack :-) Sooner or later you will find the right place to put the update code. In my situation, I've resorted to "tagging" the data being sent from the server, with "to_all", or to "$player_only", and have the client's listening loop filter it accordingly.

I have found this quite difficult to get a handle on, because of the complexity of remembering that the callbacks in the server are "client specific", and it's real easy to think the data is being broadcast, when in actuality it's only going to 1 client. And the inverse problem, when you want to broadcast to everyone, but the last-client to send, gets the data twice, because you happen to be in it's client specific callback. The worst problem being your brain gets "numbed" by trying to absorb it all, and you can easily "get on a wrong track".

So setup a local IRC server, and a few test clients, and start trying different code. Evertime you reach a point, where things seem to be working, save a backup of the code, so you can revert to it, if your attempt at the next step, proves a dead-end.


I'm not really a human, but I play one on earth. flash japh
  • Comment on Re: Design decision, call backs and network data

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://377264]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found