How to Design Games in Java

This article gives an overview of designing games in Java. At the end of it, you will have a better understanding of how to design games your game using this program.

Things You'll Need

  • Paper or index cards
  • Java JDK
  • NetBeans IDE
  • jMonkeyEngine or other Java Games engine
Show More

Instructions

  1. How to Design Games in Java

    • 1
      Example: A simple first-person shooter

      Take a sheet of paper and write out how the game works (or use index cards).

      Most Java applications follow the Model-View-Controller (MVC) design. For games, the 'Model' is the game mechanics, the 'View' is the display graphics and the Controller' handles the inputs to the game (keyboard, mouse, joystick).

      Get the model working before worrying about graphics. If the model doesn't work, the graphics and sound are pointless.

    • 2

      The example shows a very simple shooter game with two players. Each player has a rifle and bullets. The shooters can only hit if they can see the target.

      Design Java classes from the drawing. In our example we have:

      1. Rifle

      2. Bullets

      3. Shooter

      The three classes could be wrapped into one class--ShooterWithRifleAndBullets--but three separate classes allow for the rifle to jam, for the Shooter to get a new rifle, for the Shooter to run out of bullets, for the Shooter to find bullets.

    • 3
      Weapon and Ammo classes.

      Refine the model.

      Java allows objects to be built hierarchically, and we could replace our Rifle and Bullets with more generic classes, Weapons and Ammo.

      Pistol, Rifle, MachineGun and Bazooka are sub-classes of Weapon. Bullet and Rocket are sub-classes of Ammo. The diagram also shows that Pistols, Rifles and Machine Guns shoot Bullets while the Bazooka fires Rockets.

      Pistol, Rifle, Machine Gun, and Bazooka are sub-classes of Weapon. Bullet and Rocket are sub-classes of Ammo. The diagram also shows that Pistols, Rifles and MachineGuns shoot Bullets, while the Bazooka fires Rockets.

      Spend time refining the model. Each Shooter needs to know where he is on the game terrain and where he's looking, so the Shooter class will need a "Location" attribute and a "Facing" attribute. Each Shooter may have a "Health" attribute.

    • 4

      Code the model classes

      Write and test the Java code for the base model classes. A great advantage of working this way is that the Model can be integrated with different Viewers and different Controllers.

    • 5

      Once the Model is working, integrate it into the View and the Controller. For example, the Model could be integrated with advanced Games Engines such as jMonkey to produce high-speed, high-res, brilliant graphics. The same Model can be used again, or expanded, to allow new features.

      Integrating the Model into the Games Engine will require developing graphic images and sounds.

      With all the images, sounds, and the Games Engine you're ready to play--and sell--your game!

Tips & Warnings

  • Start simple. Consider using Swing and AWT for simple games. Plan for re-use. Generalize your code so that you can use it again and again. Be certain to familiarize yourself completely with Java and your chosen IDE. Be sure to follow the tutorials for your chosen Games Engine (like jMonkey).

  • Never use graphics or sounds for which you don't have distribution rights.

Related Searches:

References

Resources

Comments

You May Also Like

  • Java Game Ideas

    Java Game Ideas. Video games have become a deeply entrenched aspect of many peoples' lives. Video gaming is a multibillion-dollar-a-year industry that...

  • How to Download a Video Game Design Program

    So, you've got a unique idea for a video game, but you don't have any training or background in video game design....

  • Why Do Web Designers Use Java Applets in Web Pages?

    Java applets are programs written in the Java programming language that are embedded in web pages. Your web browser will download the...

  • Game Design for Beginners

    Game Design for Beginners.Game design can be fun, but it can also be a frustrating process. If you'd like to give game...

  • How to Build Simple Java Games

    If you're a beginning Java programmer and would like to write a game, it's best to start as simple as possible. Text-based...

  • How to Play Online Java Games

    Sun Microsystems developed the Java programming language. Java is similar to the C++ language except in a smaller scale. The design for...

  • How to Develop a Game in Java

    Developing a video game using Java can be a tough task to complete, but anyone can do it with a little bit...

  • Online Games That Use Java

    Java is a very popular technology today. If you have ever played a game online, chances are you have been able to...

  • Game Designers

    Game designers are multi-talented project managers for the game industry. They work directly with artists, programmers, writers, and quality assurance teams to...

  • Developing Games in Java

    The traditional language of game development has been C++ due to its speed, but Java has been gaining ground. Most games are...

  • How to Develop a Java Puzzle Game

    Java software is used to create many applications on multiple platforms. The creation of games is an especially popular use for Java....

  • How to Make a Board Game in Java

    Anybody that has ever played a video game has said, "I like this, but I would have done it THIS way." As...

  • Game Designing & Programming

    Game designing and programming has many different aspects and each is important to the creation of a video game. It is important...

  • The Best Java Games

    Java games are short games written in Sun Microsystems' Java programming language. They can be web-based or downloaded. In order to play...

  • How to Become a Game Designer

    Game Designers are team players who design and develop video and computer games. They typically have a bachelor's degree in game design,...

  • Java Sandbox Games

    Java Sandbox Games. Java-based sandbox games provide free-form environments where the user is provided with unrestricted control over the game world. Sandbox...

  • How to Design a Computer Game

    In the past, designing a game meant writing a plan that described the gameplay in detail, and drawing graphics to illustrate that...

  • How to Program 3D Games in Java

    If you want to generate 3D games, Java provides you an API, which best suits for creating 3D games. The java 3D...

  • About Video Game Designers

    Video games have come a long way since the days of Pong and Pac-Man, and they're not just for kids anymore. Today's...

Related Ads

Featured