Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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 ?
Re^2: How to share complex data structure in threads ?
by exilepanda (Monk) 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2014-10-24 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (138 votes), past polls