Plz help me to choose a game type

hi guys…



im on a server-clients based game and need advice.



all the game input from a client is realized by commands transmitted to the server by RMI.

on the server every cmd causes some actions and/or events which updates the server in real time.

the server has a world manager which represents a complete scene graph containing…

static objects:

-objects like trees, buildings or other not movable objects

dynamic objects:

-objects like NPCs, AI enemys, or a sword on the ground

characters:

-every other character in the world

the RMI method 'HashMap<String, _ObjectInWorld> getObjectsInSightRange(Vector position)' returns from the server

a map of visible objects (mapped on scene object name) , which are compiled into spatials by the client and build the game state (or whatever the best might be). that means new objects in range were attached to scene graph and existing objects were moved and animated. that should be done at every frame (rated to max. 50).



that means everything changes on the server and is readed/displayed by the clients StandardGame (… or whatever). all input is handled

by a seperate GUI which send commands to the server.



my question is: should i use StandardGame or something else?

and how can i realize the game main loop and integrate the getObjectsInSightRange method into it?

its a more general question … if you need more detailed info tell me.

thx for your help

My recommendation: Start with SimpleGame if you're starting with jME. Start with non-networked stuff if you did not do that before. Gain experience with network synchronization when you're already familiar with jME. Finally decide about your game architecture and then ask your question again :wink: (but you can most probably decide that yourself then)



Even if someone here tell you what type of superclass/architecture he would choose, it won't save you the time to gather experience yourself. More likely it will only frustrate you to use the 'best' and 'almighty' superclass suggested here…

As much as it pains me, I must agree with Irrisor.  Long-term I would recommend using StandardGame (but don't listen to me…I'm biased), but as a beginner it's very helpful to understand that way "Game" instances in jME work before you move to StandardGame that sort of removes most of the necessity to work with that.

thanks for your advice.

i used jME before in the early version of this project.

there i had a java.util.timer calling the rmi methods every 25ms in a SimpleGame (different Thread)

where i did all translations, updates, ect…



public void repaintDynamicObjects(){
      
      //get dynamicObjects set from server
      //dynamic objects are abstract objects which are
      //compiled by 'comp'-object into geometries
      try {
                                      //RMI call from servers worldRemote
         dynamicObjects = worldRemote.getDynamicObjects(100, new Vector3f(0,0,0));
      } catch (RemoteException re) {
         System.out.println("! (get dynamic objects): " + re);
      }
      
      //update positions of all dynamic objects      
      Iterator<_DynamicWorldObject> iterator = dynamicObjects.iterator();
      while (iterator.hasNext()){
         _DynamicWorldObject dwo = iterator.next();
         
      //debug output 1   
         //System.out.println(dwo.getObjectName() + " 1- " + dwo.getPositionInWorld());
      
         //System.out.println("compobject - " + comp.compileObject(dwo).getWorldTranslation());
         
         //compile and attach object if it is 'new'
         if (objectNode.getChild(dwo.getObjectName())==null) {
            Geometry geo = comp.compileObject(dwo);
            geo.setModelBound(new BoundingBox());
            geo.updateModelBound();
            objectNode.attachChild(geo);
            
            System.out.println("bounded!!!");
         }         
         //get geometry by name         
         Geometry geo = (Geometry) objectNode.getChild(dwo.getObjectName());
      
      //debug output 2   
         //System.out.println(geo.getName() + " 2- " + geo.getLocalTranslation());
         
         //set position from abstract world object
         geo.setLocalTranslation(dwo.getPositionInWorld());
         geo.updateModelBound();
         objectNode.updateWorldBound();
      }
            
   }


(odler version... i change it to GameStates)

is a timer running this method every 25ms a good choise?
thx

It seems like you're making a multiplayer RPG type game, in that case RMI calls every 25 ms will only cause a huge amount of lag…

First of all, you should update data for clients when it changes, and only that data which the clients care about. Also, you would probably want to use some more light-weight system than RMI, which is designed toward non real-time applications.