0

I have never had any experience fixing build-related problems before, so when the Jmonkey Engine decided to produce a build that didn't function like it would run in the compiler, I didn't (and still don't) really know what to do. The Jmonkey Engine runs on top of netbeans, but in this particular game we make use of mostly the Nifty GUI, as there is only one 3D object (the globe).

There are no error messages - the build is "successful", the game runs without errors. The thing is that player cannot move on from the class menu to the Malware Hub, or the place where the game starts. I'll post my build log, the Class Menu, and the Malware Hub.

Even if you don't have any direct experience with Jmonkey, could you explain to me why this would happen and what I might need to do to fix it in general? NOTE: I do not have console knowledge, so any help in that order might need some explaining.

Thanks.

I wish I could provide smaller segments of code that recreate the problem but I don't actually know what the problem is and therefore all I can do is post the two classes. HOWEVER, I will post the part of the code here which you should probably be paying attention to. Check the links if you want a full class, though.

Links and Code

Build Log: http://pastebin.com/bgaVNvKi

Class Menu: http(colon)//pastebin(dot)com/9ZBJkGhi

--IMPORTANT PARTS OF CLASS MENU ONLY--

nifty.fromXml("Interface/NiftyGUI/MalwareHub.xml","start", MH);
//^^ How I reach the Malware Hub.

private MalwareHub MH;

MH = Main.getMalwareHub();
Main.getApplication().getStateManager().attach(MH);

//^^ Value of MH

Malware Hub Full Code: http://pastebin.com/AnuTWQP0

--IMPORTANT PARTS ONLY--

public class MalwareHub extends AbstractAppState implements ScreenController {

    public MalwareHub() {

        day = Time.getDayRate();
        timekeeper = 0;
        upgradeTimekeeper = 0;
        //We add the functionality necessary to let the player rotate the globe.
        inputManager = Main.getApplication().getInputManager();
        initKeys();

        gameStarted = false;


    }

    @Override
    public void onStartScreen() {
        System.out.println("Screen Started");
    }

    @Override
    public void onEndScreen() {
        System.out.println("Screen Ended");
    }

    @Override
    public void bind(Nifty NIFTY, Screen SCREEN) {
        //Actual Screens
        nifty = NIFTY;
        screen = SCREEN;

        //Correct instantiations of other xml files
        UA = Main.getUpgradeAbility();
        UE = Main.getUpgradeEffect();
        UIV = Main.getUpgradeInfectionVector();
        PH = Main.getPopupHandler();

        //I initialize a lot of Main variables.
        app = Main.getApplication();
        assetManager = app.getAssetManager();
        n = new Node("Globe");
        cam = app.getCamera();
        onMalwareHub = true;

        //<editor-fold desc="Show the beginning popup" defaultstate="collapsed">
        if(!gameStarted){      
            System.out.println("Beginning window shown");
            PH.showWindow("Welcome. You have recently posted a piece of malware online that does nothing but will soon be upgraded by you. "
                  + "Use these upgrades to increase infectivity, complete new and more powerful effects, and conquer the world.", "");
        }
        //</editor-fold>

        //We're here
        gameStarted = true;

        UpgradeButton=screen.findElementByName("MalwareButton");

        //We are going to create the globe.
        //<editor-fold defaultstate="collapsed" desc="It's 'Global'">        
        //In order to do this, first, we need to transform it to fit whatever device they're using.        
        //Here we create the actual sphere, with the radius being slightly smaller than the smallest side of whatever device is being used.
        globe = assetManager.loadModel("Models/World/World_Globe.obj");

        globeGeometry = new Geometry();

        //Attach the texture
        globeMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        globeMaterial.setTexture("ColorMap", assetManager.loadTexture("Models/World/Globe_Txtr.png"));
        globe.setMaterial(globeMaterial);

        //Set move the globe to the right location and center it.
        globe.setLocalTranslation(0, 1, 0);
        globe.center();

        //Attach the globe, scale it down (cuz its big), then translate the node to the same spot as the globe so we don't start revolving around 0,0,0.
        n.attachChild(globe); //Attach it to the node
        n.scale(0.02f); //Scale the globe down    
        n.setLocalTranslation(0, 1, 0);

        //Starring... the globe!
        cam.lookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y);
        cam.update();

        //Now we must give it some light!
        //<editor-fold defaultstate="collapsed" desc="Light">
        DirectionalLight sun2 = new DirectionalLight();
        sun2.setDirection(new Vector3f(0, 1, 0).normalizeLocal());
        sun2.setColor(ColorRGBA.White);
        n.addLight(sun2);

        DirectionalLight sun3 = new DirectionalLight();
        sun3.setDirection(new Vector3f(0, 0, 1).normalizeLocal());
        sun3.setColor(ColorRGBA.White);
        n.addLight(sun3);

        DirectionalLight sun4 = new DirectionalLight();
        sun4.setDirection(new Vector3f(1, 0, 0).normalizeLocal());
        sun4.setColor(ColorRGBA.White);
        n.addLight(sun4);

        DirectionalLight sun5 = new DirectionalLight();
        sun5.setDirection(new Vector3f(-1, 0, 0).normalizeLocal());
        sun5.setColor(ColorRGBA.White);
        n.addLight(sun5);

        DirectionalLight sun6 = new DirectionalLight();
        sun6.setDirection(new Vector3f(0, -1, 0).normalizeLocal());
        sun6.setColor(ColorRGBA.White);
        n.addLight(sun6);

        DirectionalLight sun7 = new DirectionalLight();
        sun7.setDirection(new Vector3f(0, 0, -1).normalizeLocal());
        sun7.setColor(ColorRGBA.White);
        n.addLight(sun7);
        //</editor-fold>

        Main.getRN().attachChild(n); //Finally, attach the node to the root node.

        //</editor-fold>

        //Initialize text variables
        //<editor-fold defaultstate="collapsed" desc="Initialize Text Renderers">
        governmentInvestigationText = screen.findElementByName("GovernmentInvestigationText").getRenderer(TextRenderer.class);
        computersInfectedText = screen.findElementByName("InfectedText").getRenderer(TextRenderer.class);
        moneyMadeText = screen.findElementByName("MoneyText").getRenderer(TextRenderer.class);
        destructionDoneText = screen.findElementByName("DestructionText").getRenderer(TextRenderer.class);
        //</editor-fold>


    }

UPDATE

http(colon)//puu(dot)sh/9su8k/3910c2365a(dot)png

After figuring out how to use a command prompt, I found an "Illegal Argument Exception". It's complaining that the given root path "C:\Users\Dean\Dist\Assets\Interface" is not a directory, however I don't get this in the compiler. What does that even mean? I get this moving from ClassMenu to MalwareHub.

P.S. I register Assets/Interface as a locator for my asset manager in main.

  • First, if you have to work around the filter to post your question, it's a good indication that you should be doing something different. In this particular case, we would much prefer that all relevant code is embedded in the question. Second, if you want anyone to actually help you, don't give us 1100 lines of code/messages. Nobody has the time or the patience to spend that much time sifting through someone else's code looking for a bug. You should construct a small code sample that has an equivalent bug and then give us that. Plus, your build log is likely irrelevant if your code compiles. – murgatroid99 Jun 13 '14 at 22:22
  • :( Sorry. If you could just tell me what could possibly be happening here that'd be great; I'd much rather do this myself but I have no idea what could be causing a problem that messes up ONLY the build. And I don't really know what portion of the code is messing so I can't recreate the bug other than by giving you those two classes. Regardless I've posted the code into the question and tried to include the "important parts" –  Jun 13 '14 at 22:44
  • This isn't an answer per se, but a few suggetions of things that are worth considering. (1)NiftyGui swallows all exceptions. This is (imo) really stupid, but so be it. This means you should put some sort of custom error handling between nifty and your code. (2) Most of the time when I have an issue where the code works in IDE but not anywhere else it is because all the needed resources weren't bundled up. Are you using the AssetManager or are you using conventional java loading of images ect. If the later you need to make sure to include the folders which contain your images along with the JAR – Richard Tingle Jun 14 '14 at 12:46
  • Re your update; what is generating that exception? (what is the stack trace). All of JMonkey like `/` path seperators rather than `\` seperators – Richard Tingle Jun 14 '14 at 13:00
  • The exception is generated when I go from ClassMenu to MalwareHub. –  Jun 16 '14 at 18:28
  • An interesting fact is that I register the "assets/Interface" locator for my assetManager in main –  Jun 16 '14 at 18:28

1 Answers1

0

http://puu.sh/9wml6/50eed968f8.png

What ACTUALLY happened was that I had registered that locator I talked about earlier, which I shouldn'tve had to do. Subsequently, in my xml I had (accidentally) forgot to put the Interface/ in front of a filename. This worked in the compiler because from Jmonkey's perspective that Assets/Interface was an actual folder, but in the build, everything was supposed to be accessed from the assets.jar. That's why it was complaining that the Assets/Interface folder didnt exist.

Thanks for the help gaize!