GameMessage Class?

Hey everyone,

I’m new to jmonkey engine and I have this cookbook. And I was looking into it and reading how to load a level in a game; kind of like when a player exits a room and the outside world loads.

I’m having a little bit of trouble with understanding how these stages are loaded. I typed in the code for loading it. But
I’m getting an error where jmonkey isn’t reading GameMessage class. I’ve read post on SimpleGame and StandardGame. But I just wanted to clear a little confusion up with this “other” class or importation.

Does anybody know where I can get a source code for GameMessage? Or does anyone know how to solve this without using the GameMessage class?

I can show you what the book has and post the code if I’m not wasting my time.

Don’t know which chapter you are reading. Maybe you should define the “GameMessage” class yourself.

If you are doing network thing, then you will need jme3-networking.jar. You can Define your own GameMessage by extends AbstractMessage class.

com.jme3.network.AbstractMessage

Thanks I’ll take a look into it. But I found something on the tutorials about Nifty Gui Loading Screen. But I cant find the images for the loader in my interface folder in assets. Is there a downloadable version of the loading screen somewhere?

I didn’t buy that book, but I think there must be some where you can download the code file and assets, only if there are.

Maybe you can look for download link in this page.

Hi.
I’ve looked through the text for this chapter. It seems it’s an abstraction step that I missed to explain, due to it being made in the previous “Battleships” recipe. I’m sorry for that.
You can get around the issue by extending AbstractMessage instead and adding “gameId” to the class plus getter and setter

OR

you can create the GameMessage class by yourself with this code:

import com.jme3.network.AbstractMessage;
import com.jme3.network.serializing.Serializable;

/**
 *
 */
@Serializable()
public abstract class GameMessage extends AbstractMessage{
    
    private int gameId;
    
    public GameMessage(){
        setReliable(false);
    }

    public int getGameId() {
        return gameId;
    }

    public void setGameId(int gameId) {
        this.gameId = gameId;
    }
    
}

OR

you can copy the class from chapter07.fps.common.message package in the accompanying source code. It should have been made available with your purchase. If not, contact Packt’s support.

By the way, reading your message again.

The recipe is for loading a level in a networked game, something more complicated than what I think you’re looking for. It seems you just want to see your level/scene in the game. If I’m correct, I suggest you check out the tutorial here:
https://jmonkeyengine.github.io/wiki/jme3/beginner/hello_asset.html