Good and Scalable Game Structure

So, I’m new to JMonkey. I’ve been reading the tutorials for JME3, Ind I’m really amazed with it’s simplicity. However, I just couldn’t find good abstract tutorials for creating a game using AppStates and Controlers. In fact, I think they are a litle bit bad documented in the wiki, but I understand that taking into account that the project is still in beta and this is made by volunteers. :slight_smile:

However, that doesn’t help me, so I thought I’d ask the experts what would be the best method. I will try to explain my goals:

The game will be some kind of FPS, however, it won’t be like a classical FPS where you just shoot and run. It will some kind of GTA SA, where you can walk where you want, and as it’s going to be a cops game, you will be able to shoot and have a weapon. All, with a First Person view.

So, what I’m thinking is to create an AppState for the world, world loading and so on, and controls for the character control. This because there will be multiple states that I can switch between during gameplay, and that will assign different tasks to the same key, like normal walking, weapons mode, and possibily, in the future, physical fighting mode. It will be able to control vehicles too, which will need a new control. So, as you see, I need an architecture that allows me to create an easily extensible application.

So, how would you create an aplication (a simple draft with the main classes and their main functions would be great). :slight_smile:

I know this isn’t simple, but I’m prepared for a lot of work. :slight_smile:

Any help is apreciated, thanks.


Well, I think that the best thing for you to do would be to start doing some research on overall game architecture. The documentation for the engine is just that, documentation for the engine. It’s not supposed to teach you how to make a game from start to finish or how to structure your game, it’s there to teach you how to use the toolset provided to you by the team.

This way, you know how to use the tools at your disposal and it’s up to you to figure out the best way to put it together for your case. The team did work on a full blown game at one point called MonkeyZone. The source and the assets are free to download and you are free to analyze the structure of the game to see how it all comes together. That’s actually what it was created for.

And lately, there has been some mention of in the future releasing game templates so developers would basically have a blank framework to kinda just plug their code into, but i’m sure it’ll be a while before that stuff starts rolling out.


Hi feengur, and thanks for the answer. I just want to clarify that I did not criticized JME3’s documentation in any way. I also didn’t mention anything about it not having tutorials for a game’s structure. I just said that, in my opinion, there weren’t good tutorials for explaining the Application States and Controls to newbies (like me). Of course, this can be just because I’m not very accustomed to JME. Sorry for any misunderstanding. :slight_smile:

Anyway, I’ll probably look the web for tutorials regarding Game Development, or try to find any decent book. However, I think I’m just going to build my application with normal classes, not implementing AppStates, and if in the future I want to change that, I don’t think it will be a big deal, so it’s ok.

Btw, I’m still trying to figure it out the best game structure for my game, or at least, a good one.



first of all you need to be familiar with GOF Patterns (see at

after take a look at the State Pattern, read some articles or books about game architecture but with some of Gof Pattern

you will be able to make the link between game design, JME Pattern and your needs (i hope !).

Dont you think that AppStates pattern sounds like State pattern ?

Enjoy your game and dont hesitate to publish your work (or your workaround :wink: )

Cheers !

Hi soaring, and thanks for the kind answer. I’ve seen in the wikipedia that the book you linked me is still being printed, so I’ll try to catch it on some bookstore near me.

I also took a look at the State pattern and they look like Interfaces… However, AppStates look for me like multiple levers that can be turned on and off, and which will affect the application’s behaviour. Am I right?

@soaring said:
Enjoy your game and dont hesitate to publish your work (or your workaround ;) )

Cheers !

Of course I will, once I have something playable. However, I'm not sure if I will post it open source, since I'm planning doing it to my school project. If so, the source code will become available in about two years, not sooner. However, I will probably publish demos of the game while I develop it. :)

AppStates are a way to extend (potentially temporarily) the behavior of the application globally.

Controls are a way to extend (potentially temporarily) the behavior of a Spatial.

They both have specific life cycle hooks that let them perform behavior at different parts of the update cycle.

The idea is to avoid having to use inheritance everywhere (one should generally favor composition over inheritance).

There is a section in here on controls and app states:

I use app states for all kinds of things… from screen controllers all the way to the little crosshair that appears in the middle of the screen. I think I have close to a dozen or more AppStates in the current version of Mythruna (in dev). I try to think modular and reusable for my app states. But sometimes I just create them for behavior that will need to be switched on and off… and a lot of times those app states are just adding some other more modular ones.

Thanks everyone for their answers.

@pspeed Thanks for the link, I think I already got it. I’m starting with small things to get used to JME, and then I’ll put it all together and “think higher”.



I Know this thread is old, but was there some succes with the project?