+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: QuickJoinGameRequest

  1. #1
    Member
    Join Date
    Jan 2011
    Posts
    44
    Thanks
    9
    Thanked 0 Times in 0 Posts

    QuickJoinGameRequest

    Hi,

    I'm seeing a server exception every time I send from a javascript client a QuickJoinGameRequest.

    The exception:

    Code:
    15:10:24,647 [AnonymousIoService-12] ERROR TransactionTiming  - Exception proces
    sing message com.electrotank.electroserver5.messages.client.request.ClientCreate
    OrJoinGameRequestMessage@14ff81a
    java.lang.NullPointerException
            at java.util.concurrent.ConcurrentHashMap.get(Unknown Source)
            at com.electrotank.electroserver5.entities.managers.GameManager.findCand
    idates(GameManager.java:343)
            at com.electrotank.electroserver5.entities.managers.GameManager.findGame
    s(GameManager.java:292)
            at com.electrotank.electroserver5.entities.managers.GameManager.createOr
    JoinGame(GameManager.java:88)
            at com.electrotank.electroserver5.servers.registry.transactions.CreateOr
    JoinGameTransaction.execute(CreateOrJoinGameTransaction.java:47)
            at com.electrotank.electroserver5.servers.registry.transactions.SinglePe
    rsonTransaction.execute(SinglePersonTransaction.java:34)
            at com.electrotank.electroserver5.servers.registry.transactions.SinglePe
    rsonTransaction.execute(SinglePersonTransaction.java:16)
            at com.electrotank.electroserver5.servers.registry.transactions.Transact
    ionHandlerImpl.processMessage(TransactionHandlerImpl.java:170)
            at com.electrotank.electroserver5.servers.registry.RegistryEndpoint.doRe
    ceive(RegistryEndpoint.java:213)
            at com.electrotank.electroserver5.servers.registry.RegistryEndpoint.rece
    ive(RegistryEndpoint.java:97)
            at com.electrotank.electroserver5.servers.gateway.GatewayEndpoint.write(
    GatewayEndpoint.java:74)
            at com.electrotank.electroserver5.servers.gateway.GatewayEndpoint.write(
    GatewayEndpoint.java:86)
            at com.electrotank.electroserver5.servers.gateway.transactions.ClientMes
    sageToRegistryForwarder.forward(ClientMessageToRegistryForwarder.java:31)
            at com.electrotank.electroserver5.protocol.mina.AbstractClientIoHandler.
    forward(AbstractClientIoHandler.java:155)
            at com.electrotank.electroserver5.protocol.mina.AbstractClientIoHandler.
    messageReceived(AbstractClientIoHandler.java:129)
            at com.electrotank.electroserver5.protocol.mina.DisconnectedClientIoHand
    ler.messageReceived(DisconnectedClientIoHandler.java:86)
            at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messa
    geReceived(AbstractIoFilterChain.java:570)
            at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
    eceived(AbstractIoFilterChain.java:299)
            at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
    ractIoFilterChain.java:53)
            at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
    ageReceived(AbstractIoFilterChain.java:648)
            at org.apache.mina.common.IoFilterAdapter.messageReceived(IoFilterAdapte
    r.java:80)
            at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
    eceived(AbstractIoFilterChain.java:299)
            at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
    ractIoFilterChain.java:53)
            at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
    ageReceived(AbstractIoFilterChain.java:648)
            at com.electrotank.electroserver5.protocol.mina.crypto.DHKeyExchangeIoFi
    lter.messageReceived(DHKeyExchangeIoFilter.java:36)
            at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
    eceived(AbstractIoFilterChain.java:299)
            at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
    ractIoFilterChain.java:53)
            at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
    ageReceived(AbstractIoFilterChain.java:648)
            at com.electrotank.electroserver5.protocol.mina.ProtocolFilter.messageRe
    ceived(ProtocolFilter.java:87)
            at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
    eceived(AbstractIoFilterChain.java:299)
            at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
    ractIoFilterChain.java:53)
            at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
    ageReceived(AbstractIoFilterChain.java:648)
            at org.apache.mina.common.IoFilterAdapter.messageReceived(IoFilterAdapte
    r.java:80)
            at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
    eceived(AbstractIoFilterChain.java:299)
            at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
    ractIoFilterChain.java:53)
            at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
    ageReceived(AbstractIoFilterChain.java:648)
            at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flus
    h(SimpleProtocolDecoderOutput.java:58)
            at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(Prot
    ocolCodecFilter.java:174)
            at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
    eceived(AbstractIoFilterChain.java:299)
            at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
    ractIoFilterChain.java:53)
            at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
    ageReceived(AbstractIoFilterChain.java:648)
            at com.electrotank.electroserver5.protocol.mina.http.HttpRequestDispatch
    er.messageReceived(HttpRequestDispatcher.java:154)
            at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
    eceived(AbstractIoFilterChain.java:299)
            at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
    ractIoFilterChain.java:53)
            at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
    ageReceived(AbstractIoFilterChain.java:648)
            
    ...
    I have a GMSInitializer properly configured from the admin panel. Besides, I dont understand where the code that searches for a game should go.

    GMSInitializer:
    Code:
    package com.snailwars;
    
    import com.electrotank.electroserver5.extensions.BaseExtensionLifecycleEventHandler;
    import com.electrotank.electroserver5.extensions.api.value.EsObject;
    import com.electrotank.electroserver5.extensions.api.value.EsObjectRO;
    import com.electrotank.electroserver5.extensions.api.value.ExtensionComponentConfiguration;
    import com.electrotank.electroserver5.extensions.api.value.GameConfiguration;
    import com.electrotank.electroserver5.extensions.api.value.RoomConfiguration;
    
    /**
     *
     * @author Joan
     */
    public class GMSInitializer extends BaseExtensionLifecycleEventHandler {
    
        @Override
        public void init(EsObjectRO ignored) {
            // use the name of the extension that will contain all the game plugins
            String extensionName = getApi().getExtensionName();
    
            // invoke the initialization method for each of your games
            initOneGame(extensionName);
        }
    
        private void initOneGame(String extensionName) {
            ExtensionComponentConfiguration gamePlugin = new ExtensionComponentConfiguration();
            gamePlugin.setExtensionName(extensionName);
    
            gamePlugin.setHandle("SnailWarsGame");//Name by which the plugin can be addressed when instantiated in the room
            gamePlugin.setName("SnailWarsGame");//Name of the plugin in the Extension.xml file
    
            // Create the room configuration
            RoomConfiguration roomConfig = new RoomConfiguration();
            roomConfig.setCapacity(2);
            roomConfig.setDescription("SnailWarsGame two players game");
    
            //add the game plugin(s)
            roomConfig.addPlugin(gamePlugin);
    
            // temp testing: add a language filter
    //        roomConfig.setUsingLanguageFilter(true);
    //        roomConfig.setLanguageFilterSpecified(true);
    //        roomConfig.setLanguageFilterName("MyWhiteFilter");
    
            // Create the game configuration
    
            // When a user joins a room there are many events that user can potentially receive.
            // The default subscriptions for a user joining the game are defined here.
            GameConfiguration gameRoomConfig = new GameConfiguration();
            gameRoomConfig.setReceivingRoomListUpdates(false);
            gameRoomConfig.setReceivingRoomVariableUpdates(false);
            gameRoomConfig.setReceivingUserListUpdates(true);
            gameRoomConfig.setReceivingUserVariableUpdates(true);
            gameRoomConfig.setReceivingVideoEvents(false);
            gameRoomConfig.setRoomConfiguration(roomConfig);
    
            //Create the default GameDetails object
    
            // When a game is created it has a game details EsObject associated with it.
            // This object is publicly seen in the game list, and can be accessed and modified
            // by the game itself.
    
            EsObject esob = new EsObject();
            
            gameRoomConfig.setInitialGameDetails(esob);
    
            // Register the game
            // Once the game has been registered, users can create a new instance of this game
            // using the integrated game manager.
            // Plugins can also create a new game and put users into it.
    
            getApi().registerGameConfiguration("SnailWarsGame", gameRoomConfig);
    
            getApi().getLogger().warn("SnailWarsGame game registered with GameManager.");
        }
    
    }


    The client request is done this way:

    Code:
    var request = new QuickJoinGameRequest();
    request.gameType = "SnailWarsGame";
    request.zoneName = "General";
    es.engine.send(request);
    Any ideas?
    thanks

  2. #2
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    This is likely a bug in the api. I'll add a ticket to our system for it.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  3. #3
    Member
    Join Date
    Jan 2011
    Posts
    44
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Well, I don't want to be annoying but in just two days I've found maybe too many bugs in the javascript api. I understand this is the first release of a javascript api, but if you release something we expect it to work, at least some core functionality. Is this api really stable and tested?

  4. #4
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    Try creating your FindGamesRequest using this pattern (AS3):
    Code:
    			//create request
    			var fgr:FindGamesRequest = new FindGamesRequest();
    			
    			//create search criteria that will filter the game list
    			var criteria:SearchCriteria = new SearchCriteria();
    			criteria.gameType = PluginConstants.GAME_NAME;
    			criteria.gameId = -1;
    			
    			//add the search criteria to the request
    			fgr.searchCriteria = criteria;
    			
    			//send it
    			_es.engine.send(fgr);
    here's a Java snippet that I know works:
    Code:
                EsFindGamesRequest fgr = new EsFindGamesRequest();
    
                EsSearchCriteria sc = new EsSearchCriteria();
                sc.setGameType(PLUGIN_NAME);
                sc.setLocked(false);
    
                fgr.setSearchCriteria(sc);
    
                es.getEngine().send(fgr);
    Last edited by tcarr; 01-21-2011 at 02:42 PM.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  5. #5
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    Quote Originally Posted by joanrocagas View Post
    Well, I don't want to be annoying but in just two days I've found maybe too many bugs in the javascript api. I understand this is the first release of a javascript api, but if you release something we expect it to work, at least some core functionality. Is this api really stable and tested?
    I'm not sure whether this is a bug or not after finding the code snippets above. I'm going to try to reproduce it using AS3 or Java, and see if the SearchCriteria part is required or not.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  6. #6
    Member
    Join Date
    Jan 2011
    Posts
    44
    Thanks
    9
    Thanked 0 Times in 0 Posts
    doing some tests now it seems that the search criteria.gametype, request.gametype and request.zone are required to avoid that exception which is kind of odd.

    the criteria has this fields
    var SearchCriteria = function(thriftObject) {
    this.gameId = null;
    this.locked = null;
    this.lockedSet = null;
    this.gameType = null;
    this.gameDetails = null;
    if (thriftObject) {
    this.fromThrift(thriftObject);
    }
    };

    Could you explain them a little bit please?

  7. #7
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    SearchCriteria is what GameManager uses when searching for a game, if the request is not marked as create only. The default for gameId should be -1. You normally only want to search for games that have locked = false, because you can't join games that are locked. The gameType in your case would be "SnailWarsGame", and that *should* be the only field that you need to set on the SearchCriteria. I remember previous bugs (now fixed) in the other client api where you also had to set gameId to -1 to get it to work correctly.

    I'm not familiar with the Javascript API personally. I am quite familiar with the GameManager code, so I may be able to prevent this error from occurring when the SearchCriteria is not set, instead of having to get Jason to edit the code generator to set a default SearchCriteria. I'll be looking into it this morning.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  8. The Following User Says Thank You to tcarr For This Useful Post:

    joanrocagas (01-21-2011)

  9. #8
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    Gah, I need to stop answering forum posts before breakfast. The code snippets I gave you were for FindGamesRequest, not for QuickJoinGameRequest. Let me find the right snippets.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  10. #9
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    Here's the AS3 version of a QuickJoinGameRequest:
    Code:
    			var qjr:QuickJoinGameRequest = new QuickJoinGameRequest();
    			qjr.gameType = PluginConstants.GAME_NAME;
    			qjr.zoneName = "GameZone";
    			qjr.createOnly = false;
    			_es.engine.send(qjr);
    It doesn't specify a SearchCriteria, and I know that works. The line of GameManager that is choking is upset because there is no SearchCriteria object. This means that AS3 client has a default set for SC but JS client missed that. I'll ask Jason to add the default, but also look at the GameManager code to see if I can put in some belt and suspenders if the SC is not set.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  11. #10
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,284
    Thanks
    81
    Thanked 1,093 Times in 1,082 Posts
    Ok, GameManager was already set up so that if SearchCriteria is null, it creates one. This means that the JS client API must be adding a SearchCriteria that isn't properly initialized, so that it's neither null nor has the gameType specified. The only thing that you really need to specify is the gameType. For now, just create a SC and add it to the QuickJoinGameRequest. I'll add a bug ticket for fixing the JS client API.

    Thanks for helping us spot the bugs, and being patient with us. It's enormously more complicated to juggle all these multiple client apis than it was with ES4 and only keeping track of AS2 and AS3.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts