# JME 3 Tutorial (1) - Hello SimpleApplication

Previous: Installing JME3, Next: Hello Node
Prerequisites: This tutorial assumes that:
* You have downloaded the jMonkeyPlatform (or set up the jMonkeyEngine3 in another IDE of your choice)
* You have created a Java SE project with the JME3 libraries on the classpath.
You are ready to create your first jMonkeyEngine3 game! You can generally use the tutorials in this introductory series with any integrated development environment (IDE), such as the jMonkeyPlatform, NetBeans, Eclipse, or run them straight from the commandline. In the following, we will use the jMonkeyPlatform.

## Writing a SimpleApplication

Create a jme3test.helloworld package and a file HelloJME3.java in it.
In the jMonkeyPlatform, you right-click the Source Packages node:
* Select New… > Java Class to create a new file.
* Enter a class name: HelloJME3
* Enter a package: jme3test.helloworld
* Click Finish.

## Sample Code

Replace the contents of the HelloJME3.java file with the following code:
Build and run the HelloJME3 class. If a jme settings dialog pops up, confirm the default settings.
* You should see a simple window displaying a 3-D cube.
* Use the WASD keys and the mouse to navigate around.
* Press Escape to close the application.
Congratulations, it works! How did we do that?

## Understanding the Code

The code above has initialized the scene, and started the game.

### Understanding the Terminology

| What you want to do | How you say it in JME3 terminology |
| You want to create a cube. | You create a Geometry with a 1x1x1 Box shape. |
| You want to use a blue color. | You create a Material with a blue Color property. |
| You want to colorize the cube blue. | You set the Geometry's Material. |
| You want the cube to appear in the scene. | You attach the cube to the rootNode. |

### Initializing the Scene

In Java, the creation of a blue cube looks as follows:
In the simpleInitApp method, you create or load all game objects before the game starts. The simpleInitApp method is automatically called once at the beginning of every JME3 game.
A typical JME3 game has the following initialization process:
* You initialize game objects:
** You create or load objects and position them.
** You make objects appear in the scene by attaching them to the rootNode.
** Examples: Load player, terrain, sky, enemies, obstacles, and place them in their start positions.
* You initialize variables
** You set variables to their start values.
** You want to use variables track the game state.
** Examples: Set the score to 0, set health to 100%, and so on.
* You initialize keys and mouse actions
** The following input bindings are pre-configured by default:
*** W,A,S,D keys – Move around in the scene
*** Mouse movement and arrow keys – Turn the camera
*** Escape key – Quit the game
** Add your own keys and mouse clicks.
** Examples: Click to shoot, press Space to jump, etc.

### Starting the Game

The HelloJME3.java class extends com.jme3.app.SimpleApplication, which is a subclass of com.jme3.app.Application. Every JME3 game is an instance of com.jme3.app.SimpleApplication.
To run a JME3 game, you first instantiate your SimpleApplication-based class, and then call its start method:
Typically you start a game from your Java application's main method.

## Conclusion

These few lines of code simply display a static 3D cube. You can navigate around in this 3D scene.
You have learned that a SimpleApplication is a good starting point because it provides you with:
* A simpleInitApp method where you create objects.
* A rootNode where you attach objects to make them appear in the scene.
* Useful default input settings that you can use for navigation in the scene.
When developing a game application, you will now want to:
* Initialize your game world,
* Trigger actions in the event loop,
* Respond to user input.
In the following tutorials you learn how accomplish these tasks with the jMonkeyEngine 3.
Continue with the Hello Node tutorial, where we will first show you more details about how to initialize the game world, also known as the scene graph.
See also:
* Install the jMonkeyEngine
* SimpleApplication From the Commandline
* Create a JME3 project.