What you want is probably event based AI with its own (probably threaded, but not necessarily) event loop. Here is mine, but it was build for panda3d (should not be a problem to adapt, since its thread based loop).
Server: http://paste.pound-python.org/show/12608/ Node: http://paste.pound-python.org/show/12609/ 2011/9/16 Brian Blais <[email protected]> > Hello, > > I've played a little bit with pyglet, and hope to use it for a project idea > for a game with multiple agents. What I am having trouble with planning is > the way to implement the interaction between the agents (human and ai) and > the game. I'd like to separate them out, so I could write an independent > function, say, for an AI agent that has access (or can query) parts of the > environment and can send instructions to the environment which will then be > updated and displayed with pyglet. I thought maybe some message passing > scheme, or perhaps something else like xmlrpc. I don't want to reinvent the > wheel, and this seems to be something that should be pretty common I'd > imagine. Are there some examples for this sort of thing? Any ideas? > > thanks, > > Brian Blais > > -- > Brian Blais > [email protected] > http://web.bryant.edu/~bblais > http://bblais.blogspot.com/ > > > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pyglet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
