Akka Actors in games

385 views
Skip to first unread message

Brian Berard

unread,
Sep 12, 2013, 8:14:20 PM9/12/13
to akka...@googlegroups.com
Hi everyone,

I'm really interested in using Akka Actors for my game, since I feel like actors play well in a game world. I only have one problem... I'm currently using OpenGL for rendering (via LibGDX). When I start a LibGDX application, it spawns its own thread that contains the OpenGL context. Since I need the OpenGL context for rendering, I'm wondering if there's anyway to configure an actor to run with a PinnedDispatcher on the same thread as OpenGL without modifying the LibGDX library. Either that, or I could probably get away having actors publish their state (Texture, x, y) on each TickMessage to some location that I can access from outside of the Actor system. 

Has anyone done anything like this before? 


Patrik Nordwall

unread,
Sep 13, 2013, 5:18:46 AM9/13/13
to akka...@googlegroups.com
Hi,


On Fri, Sep 13, 2013 at 2:14 AM, Brian Berard <brian.m...@gmail.com> wrote:
Hi everyone,

I'm really interested in using Akka Actors for my game, since I feel like actors play well in a game world. I only have one problem... I'm currently using OpenGL for rendering (via LibGDX). When I start a LibGDX application, it spawns its own thread that contains the OpenGL context. Since I need the OpenGL context for rendering, I'm wondering if there's anyway to configure an actor to run with a PinnedDispatcher on the same thread as OpenGL without modifying the LibGDX library.

PinnedDispatcher will create its own thread. You cannot tell it to use another existing thread. You can of course write your own dispatcher.
 
Either that, or I could probably get away having actors publish their state (Texture, x, y) on each TickMessage to some location that I can access from outside of the Actor system. 

yes, that is probably easiest

/Patrik
 

Has anyone done anything like this before? 


--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.



--

Patrik Nordwall
Typesafe Reactive apps on the JVM
Twitter: @patriknw

Brian Berard

unread,
Sep 18, 2013, 10:31:27 AM9/18/13
to akka...@googlegroups.com
Is there an easy way to do such a thing? That is, to maintain a list of objects to be rendered (Texture, x, y) in some central actor and make that value available outside of the actor system?

Patrik Nordwall

unread,
Sep 19, 2013, 7:36:42 AM9/19/13
to akka...@googlegroups.com
On Wed, Sep 18, 2013 at 4:31 PM, Brian Berard <brian.m...@gmail.com> wrote:
Is there an easy way to do such a thing? That is, to maintain a list of objects to be rendered (Texture, x, y) in some central actor and make that value available outside of the actor system?

If you can't do it with messages you have to resort to let the actor write the value to some place where the rendering engine can read. A thread safe implementation is your responsibility.

/Patrik
Reply all
Reply to author
Forward
0 new messages