コード例 #1
0
  public void update(int delta) {
    if (!initialized) return;

    commonWorld.loopStart();
    commonWorld.setDelta(delta);
    commonWorld.getGameTimeManager().update(delta);

    if (worldSimulationTimer > GameTimeManager.SERVER_WORLD_SIMULATION_INTERVAL) {
      worldSimulationTimer -= GameTimeManager.SERVER_WORLD_SIMULATION_INTERVAL;

      botTest.update(delta);

      for (Message message = network.getNewMessage();
          message != null;
          message = network.getNewMessage()) {
        commonWorld.getEventBusManager().publish(message);
      }
      storePositionHistorySystem.process();
      expirationSystem.process();

      positionHistorySystem.reward();
      collisionSystem.setRewindMode();
      collisionSystem.setTime(commonWorld.getGameTimeManager().getNetworkTime());
      collisionSystem.process();
      positionHistorySystem.forward();
      positionHistorySystem.process();
    }
    worldSimulationTimer += delta;

    serverNetworkTimer += delta;

    if (serverNetworkTimer > GameTimeManager.SERVER_NETWORK_INTERVAL) {
      serverNetworkTimer -= GameTimeManager.SERVER_WORLD_SIMULATION_INTERVAL;
      entitySendNetworkSystem.process();
      for (User user : commonWorld.getUserManager().getUsers()) {
        network.sendMessages(user);
      }
      network.clearUserCompressedMessagePerTick();
    }
  }
コード例 #2
0
 public User getUserByNetworkId(String networkId) {
   return commonWorld.getUserManager().findByNetworkId(networkId);
 }