Examples of GameServer


Examples of agh.sr.rmi.game.GameServer


//            System.out.println("Enter your nick:");
//            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
//            String nick = bufferedReader.readLine();
            GameServer gameServer = (GameServer) Naming
                    .lookup(RMI_REGISTRY_ADDRESS + "/" + PAN_GAME_SERVER_REMOTE_OBJECT_NAME);

            String userName = "g1";

            PlayerToken playerToken = gameServer.register(userName);

            GameListener gameListener = new ClientGameListener(playerToken);

            UnicastRemoteObject.exportObject(gameListener, 0);

            GameController gameController = gameServer.createGame(playerToken, "game1", 1, 1, gameListener);
            gameListener.registerGameController(gameController);

//            System.out.println("Aktualna zawartosc tablicy: " + noteboard.getText(userToken));

        } catch (Exception e) {
View Full Code Here

Examples of agh.sr.rmi.game.GameServer

    private static final String PAN_GAME_SERVER_REMOTE_OBJECT_NAME = "gameServer";

    public static void main(String[] args) {

        try {
            GameServer gameServer = new PanGameServer();

            UnicastRemoteObject.exportObject(gameServer, 0);

            Registry registry = LocateRegistry.createRegistry(1099);
View Full Code Here

Examples of be.demmel.jgws.rmi.GameServer

  @Override
  public void handlePacket(ChannelHandlerContext ctx, P041_CharacterPlayInfo packet, LoginServerSession serverData, List<QueueAction> actions) throws Exception {
    serverData.setLoginCount(serverData.getLoginCount() + 1);

    GameServer selectedGameServer = LoginServer.getBestGameServer();

    if (selectedGameServer == null) {
      // No available GameServer was found
      P003_StreamTerminator streamTerminator = new P003_StreamTerminator();
      streamTerminator.setErrorCode(5);
      streamTerminator.setLoginCount(serverData.getLoginCount());
      ctx.write(streamTerminator);
    } else {
      // An available Game Server was found. Let the Game Server know he can expect some new client
      // Gather the info for the Game Server
      int accountId = serverData.getAccId();
      int characterId = serverData.getCharId();
      int mapId = serverData.getMapId();

      byte[] keys1 = new byte[4];
      byte[] keys2 = new byte[4];

      Random r = new Random();
      r.nextBytes(keys1);
      r.nextBytes(keys2);

      short[] newKeys1 = new short[keys1.length], newKeys2 = new short[keys2.length];
      for (int i = 0; i < keys1.length; i++) {
        newKeys1[i] = (short) (keys1[i] & 0xFF);
        newKeys2[i] = (short) (keys2[i] & 0xFF);
      }

      // Retrieve the connection with the GameServer
      GameServerPortal gameServerPortal = selectedGameServer.getGameServerPortal();
      // tell the Game Server to accept connections from this client
      try {
        gameServerPortal.acceptPlayerRequest(new LoginServerPlayerData(accountId, characterId, mapId, newKeys1, newKeys2));
      } catch (RemoteException e) {
        LOGGER.error("Failed to register this player with a game server");
        throw new RuntimeException("Failed to register this player with a game server", e);
      }
      // This returned, the Game Server knows about the new client that should connect soon

      // TODO: if the game server returns he's full, choose another one (while !accepted ....)
      // TODO: Servers that are unavailable will be detected here in a catch(some exception) and REMOVED from the list + logs
      // TODO: Game Servers that are full should warn the login server when they're good again

      // Redirect the client to the chosen Game Server
      ByteBuf buffer = Unpooled.buffer(24);
      buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);
      // Why we need this is unknown
      buffer.writeShort(2);

      int selectedGameServerPort = selectedGameServer.getHostAndPort().getPort();

      // The bytes of the port must be reversed
      buffer = buffer.order(ByteOrder.BIG_ENDIAN);
      buffer.writeShort(selectedGameServerPort);
      buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);

      // the GS should pass its public IP when it registers itself to the LS
      byte[] ipBytes = selectedGameServer.getHostAndPort().getAddress().getAddress();

      LOGGER.info("The Game Server's IP: {}.{}.{}.{}", new Object[] { ipBytes[0] & 0xFF, ipBytes[1] & 0xFF, ipBytes[2] & 0xFF, ipBytes[3] & 0xFF });
      short[] newIpBytes = new short[ipBytes.length];
      for (int i = 0; i < ipBytes.length; i++) {
        newIpBytes[i] = (short) (ipBytes[i] & 0xFF);
View Full Code Here

Examples of bomberman.gameserver.GameServer

            ActivationGroupDesc groupDesc1 = new ActivationGroupDesc(prop, null);
            ActivationGroupID groupID1 = ActivationGroup.getSystem().registerGroup(groupDesc1);
            ActivationDesc actDesc1 = new ActivationDesc(groupID1, gameServerClass, codebase, new MarshalledObject<Bootstrap>(authServer));

            GameServer gs = (GameServer) Activatable.register(actDesc1);
            Naming.rebind("//:" + rmidPort + "/gameserver", gs);
            System.out.println("# GameServer registrato in RMID.");

            System.out.println("# Tutti i server sono operativi.");
        }
View Full Code Here

Examples of ca.vanzeben.game.net.GameServer

        thread = new Thread(this, NAME + "_main");
        thread.start();
        if (!isApplet) {
            if (JOptionPane.showConfirmDialog(this, "Do you want to run the server") == 0) {
                socketServer = new GameServer(this);
                socketServer.start();
            }

            socketClient = new GameClient(this, "localhost");
            socketClient.start();
View Full Code Here

Examples of l2p.gameserver.GameServer

    InputStream is = new FileInputStream(PhoenixHomeDir + LOG_NAME);
    LogManager.getLogManager().readConfiguration(is);
    is.close();
    L2DatabaseFactory.getInstance();
    // Run server threads
    gameServer = new GameServer();
    loginServer = L2LoginServer.getInstance();
    //loginServer = new LoginServer();
    //loginServer.start();
    // run telnet server if enabled
    if(Config.MAT_BANCHAT)
View Full Code Here

Examples of lineage2.loginserver.gameservercon.GameServer

      rset = statement.executeQuery();
      int id;
      while (rset.next())
      {
        id = rset.getInt("server_id");
        GameServer gs = new GameServer(id);
        _gameServers.put(id, gs);
      }
    }
    catch (Exception e)
    {
View Full Code Here

Examples of lineage2.loginserver.gameservercon.GameServer

    try
    {
      int id = 1;
      while (id++ > 0)
      {
        GameServer pgs = _gameServers.get(id);
        if ((pgs == null) || !pgs.isAuthed())
        {
          _gameServers.put(id, gs);
          gs.setId(id);
          return true;
        }
View Full Code Here

Examples of lineage2.loginserver.gameservercon.GameServer

  public boolean registerGameServer(int id, GameServer gs)
  {
    _writeLock.lock();
    try
    {
      GameServer pgs = _gameServers.get(id);
      if (!Config.ACCEPT_NEW_GAMESERVER && (pgs == null))
      {
        return false;
      }
      if ((pgs == null) || !pgs.isAuthed())
      {
        _gameServers.put(id, gs);
        gs.setId(id);
        return true;
      }
View Full Code Here

Examples of lineage2.loginserver.gameservercon.GameServer

   * Method runImpl.
   */
  @Override
  protected void runImpl()
  {
    GameServer gs = getGameServer();
    if (gs.isAuthed())
    {
      gs.removeAccount(account);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.