Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: How to share complex data structure in threads ?

by Anonymous Monk
on Dec 30, 2012 at 14:26 UTC ( #1010926=note: print w/replies, xml ) Need Help??

in reply to How to share complex data structure in threads ?

Although it may seem "obvious" that each player of an MMPG should be "a thread," that isn't what you should do ... no more than you should have a separate thread for each connected user to a website. Connected users are, say, a TCP/IP port. The game itself is a state-machine. The amount of time required to resolve the effect of anyone's move is a few microseconds: moves can be processed effortlessly one-at-a-time with a queue by one thread. (If you want a Perl analogy, look at POE.) And on this point, save yourself trouble: MMPGs are a dime a dozen and so are engines designed to run them. You don't need to write a Perl program from scratch to do such a thing.
  • Comment on Re: How to share complex data structure in threads ?

Replies are listed 'Best First'.
Re^2: How to share complex data structure in threads ?
by exilepanda (Pilgrim) on Dec 30, 2012 at 15:20 UTC
    Thanks for introducing POE. Looking at the interface and which looks really relative to what I may found useful for. Though, I am no doing an online game ( i would consider blender + python if needed ), it just easier for me to explain why I need a complex struct shared by threads. The real project is kind of bio-logic stuff ( and I know nothing about it! ) I possibly to do some work to simulate a "brain" like stuffs but the scope is not yet confirmed.

    All I know is I have to listen to certain range of ports, and signals come in, and the data struct will be altered, after `some external calls` returns values list. The ends up result maybe some like aaatttggg(they said it's protein or sort of) which is totally meaningless for me.. and I don't know how to express any further.. haha!

    So up to this stage, all I am looking for is how to share a complex struct which read/write possible, and start to listen on advise for which approach ( queue / struct ) would be more suitable in such data structure scenario.

    Do you have any "See Also" suggestion like POE ? Thanks again! =)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010926]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2018-06-25 10:42 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.