Skip to main content

More than one virtual universe?

No replies
harshadbits
Offline
Joined: 2010-12-10
Points: 0

Hi!

I am developing a game using java 3D ( http://launchpad.net/r3 ). Currently I am adding multiplayer support, and I need multiple virtual universes with their canvas3d's rendering at the same time. When I tried to do this with 2 universes, the second canvas that is initialized always died in half a second. As in it shows up, renders a few frames and then just disappears.

Are we supposed to use only one virtual universe? Or do we need some special configuration in this case? I am initializing the virtual universe in the following manner:

VirtualUniverse universe = new VirtualUniverse();
Locale locale = new Locale(universe);
ViewPlatform vp = createViewPlatform();

BranchGroup viewBranchGroup = new BranchGroup();
TransformGroup tg = new TransformGroup(); //some transform for the view
viewBranchGroup.addChild(tg);
tg.addChile(vp);

locale.addBranchGraph(root);
locale.addBranchGraph(viewBranchGroup);

View view = new View();
PhysicalBody pb = new PhysicalBody();
PhysicalEnvironment pe = new PhysicalEnvironment();
view.setPhysicalEnvironment(pe);
view.setPhysicalBody(pb);
view.attachViewPlatform(vp);

GraphicsConfigTemplate3D gc3D = new GraphicsConfigTemplate3D();
gc3D.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
GraphicsDevice gd[] = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getScreenDevices();
Canvas3D c3d = new Canvas3D(gd[0].getBestConfiguration(gc3D));
c3d.setSize(170, 170);

view.addCanvas3D(c3d);

Thanks!
Harshad