How to add more actors to same groupe

7 views
Skip to first unread message

Afke

unread,
Mar 15, 2011, 9:16:05 PM3/15/11
to pysage
Hi,

mgr.enable_groups()
mgr.add_process_group('chefs', Chef) # spawns a new process that
"ticks" independently

after adding Chef actor as default actor to group 'chefs' how we can
add some more actors to 'chefs' group

like some badChef actor .I will make new class badChef(Actor): and
then ...

Thanks and Sorry for disturbing

Afan

John Yang

unread,
Mar 16, 2011, 12:04:57 AM3/16/11
to pys...@googlegroups.com
Afan:

You'll need to send a message to the default actor of the "chefs" group.

The default actor upon receiving that message can spawn as many actors
as you'd like.

Or you can put logic in the default actor's "update" method to spawn
more actors based on some condition.

John

> --
> You received this message because you are subscribed to the Google Groups "pysage" group.
> To post to this group, send email to pys...@googlegroups.com.
> To unsubscribe from this group, send email to pysage+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pysage?hl=en.
>
>

Message has been deleted

Afke

unread,
Mar 16, 2011, 12:02:12 PM3/16/11
to pysage
Hi, I Made ChatServer ChatClient and ChatClientBot Example but I
can't commit I don't have permissions for that :)

Afke

unread,
Mar 19, 2011, 7:49:26 PM3/19/11
to pysage
Thanks for your time
You don't understand me :)
I am asking for sintax how to spawn actor to group.
to main manager group we are registering actor with:
mgr.register_actor(Player(), 'player1')
How to spawn actor to group ? Just if you write a line of code which
spawns new actor in existing group.
When I figure out everything ,I will like to help you about
documentation and I will make some more examples for pysage
usage .Pysage is most beautiful lightweight message passing
library ,in my opinion . I will make framework on the top of it, Game
specific framework with server, client,chat , groups etc. and share
it
with community.
I made some simple error handling in udp transport which are
preventing server crash when client break connection.
I will try to make notify udp transport which is good for important
messages ,to resend lost messages again , to avoid TCP , to insure
lower bandwidth.
Thanks again
Afan

Bigjhnny

unread,
Mar 19, 2011, 8:05:54 PM3/19/11
to pysage
Hi Afan:

Did you get your problem solved? Sorry for the late reply, been busy
lately!

I'd appreciate it for your examples, just send them to me. Or would
you like to have commit access?

John

Afan Olovcic

unread,
Mar 19, 2011, 8:14:01 PM3/19/11
to pys...@googlegroups.com
Thanks for your reply

I don't solve the problem about how to spawn more actors to existing group
could you please just write line of code which spawn spawn some more actors in group chefs for example :)
(Some more Chef Actors in group Chefes)
I did not found the way how to do that :) 

commit access will be nice :) 

if it is possible :)

Thanks 

Afan



John Yang

unread,
Mar 19, 2011, 8:50:03 PM3/19/11
to pys...@googlegroups.com
Afan:

As I've mentioned earlier, a pysage "group" is another OS level
process running completely separately. You can't simply spawn an
actor (an object) in another process. Although pysage abstracts a lot
of this away, it still is a distributed system.

Having said that, doing this is fairly simple and if things like this
are requested more, it's fairly easy to extend the API to allow this.

The way you do this is simply to have your "Default Actor" spawn
additional actors in the group. The default actor is the "mother"
actor that you start a pysage group with.

Example:

So you have two groups: Main and Slave

You started "Slave" group with a default actor of "SlaveActor". And
you want to be able to "spawn" more actors into the "Slave" group from
the "Main" group. Simply make the "SlaveActor" accept "SpawnActor"
message, and have your "Main" group send "SpawnActor" message to your
"Slave" group. The "SlaveActor" upon receiving the message can spawn
as many actors as you want.
--

Group Main: MainActor(sends "SpawnActor" message to group "Slave")

Group Slave: SlaveActor(accepts "SpawnActor" Message)

--

You'll need to make this call:

mgr.queue_message_to_group

example usage: http://www.bigjstudio.com/pysage/ipc.html#example

Does this help?

John

Afan Olovcic

unread,
Mar 19, 2011, 9:18:42 PM3/19/11
to pys...@googlegroups.com
Yes it helps
Thanks

As I've mentioned earlier I am working on mmo framework for my project and most of it will be open source 
I will need  some kind of group functionality and player can be part of those groups , and play game together.
They will see each  other in the group but they will not see other players on the server until they are in the group

There will be places where all players on the server can see each others but most of the time they will make party groups and play missions together

Thanks again

John Yang

unread,
Mar 19, 2011, 11:08:58 PM3/19/11
to pys...@googlegroups.com, Afan Olovcic
Yeap, in that case, you may need a room manager actor for each
group/room that is responsible for spawning/removing players.

John

Reply all
Reply to author
Forward
0 new messages