<< Chapter < Page Chapter >> Page >

What is a concrete method definition

Not much is required to provide a concrete method definition. All that is necessary to define concrete methods that return void is to replicate the signature of the abstract method and to provide an empty body delineated by apair of empty curly brackets. If the return type for the abstract method is not void, the body of the concrete version must contain a return statement that matches the specified return type.

Five abstract methods

The interface named Game declares the five abstract methods shown in Figure 4 :

Figure 4 . Abstract methods declared in the Game interface.
boolean closeRequested() - Notification that a game close has been requested Returns: True if the game should closeString getTitle() - Get the title of this game Returns: The title of the gamevoid init(GameContainer container) throws SlickException - Initialise the game.This can be used to load static resources. It's called before the game loop starts Parameters: container - The container holding the gamevoid render(GameContainer container, Graphics g) throws SlickException - Render thegame's screen here. Parameters: container - The container holing this game,g - The graphics context that can be used to render. However, normal rendering routines can also be used.void update(GameContainer container,int delta) throws SlickException - Update the game logic here. No rendering should take place in this method though it won'tdo any harm. Parameters: container - The container holding this game,delta - The amount of time that has passed since last update in milliseconds

Concrete versions of the inherited abstract methods

As you can see in Listing 1 , the new class named Slick0110a is not declared abstract. Therefore, it must provide concrete versions of the inherited abstract methods shown in Figure 4 .

The init , update , and render methods in Listing 1 return void and are defined with empty bodies. The getTitle and closeRequested methods do not return void. Therefore each of these concrete versions contains a return statement of the required type.

Not much fun to play

As you learned earlier, the skeleton code for this Slick2D game program shown in Listing 1 can be compiled and executed. However, it isn't very much fun to play because it doesn't do anything otherthan to sit there and display the frames per second (FPS) rate in the upper-left corner of the game window. Make no mistake about it, however, thegame loop is running meaning that the game is active.

Not the recommended form

While this is probably the simplest Slick2D game program that can be written to run as a Java application, it is not the recommended form for an empty Slick2Dgame skeleton. You will learn in the next module that instead of implementing the Game interface directly, it is better to extend a Slick2D helper class named BasicGame that implements the Game interface and provides some additional services that may be useful to the gameprogrammer. However, even when you do that, it is still necessary to write code to put some meat on the skeleton'sbones to create a playable game.

Run the program

I encourage you to copy the code from Listing 1 and Listing 2 Compile the code and execute it,making changes, and observing the results of your changes. Make certain that you can explain why your changes behave as they do.


The main purpose of this module is to teach you about some of the characteristics of game engines and frameworks in general, and to teach you howSlick2D fits those characteristics.

More specifically, you learned what we often mean when we speak of a "game engine." You learned how that terminology relates to something that we often refer to as a "software framework."

You learned how to write a minimal Java application in conjunction with a set of Slick2D jar files to create your own Slick2D game engine. Using that programas an example, you learned about the overall structure of the Slick2D game engine.

You learned that game engines are typically service provider programs and you learned about a common set of services that is provided bymost game engines.

You learned about the two cooperating objects that form the heart of the Slick2D game engine.

You learned about the methods declared in the interface named Game .

You learned that in order to write a game program using the Slick2D game engine that will run as a Java application, you must, as a minimum,perform the steps shown in Figure 1 .

What's next?

In the next module, I will begin explaining the purpose of the methods that are inherited from the Game interface and will begin showing how you can override those methods to control the behavior of your Slick2D gameprogram.


This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Slick0110: Overview
  • File: Slick0110.htm
  • Published: 02/03/13
  • Revised 06/09/15 for 64-bit

Financial : Although the Connexions site makes it possible for you to download a PDF file for thismodule at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, you should beaware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version of the module.

In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale on Amazon.com showing me as the author. Ineither receive compensation for those sales nor do I know who does receive compensation. If you purchase such a book, please beaware that it is a copy of a module that is freely available on cnx.org and that it was made and published withoutmy prior knowledge.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.


Questions & Answers

where we get a research paper on Nano chemistry....?
Maira Reply
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
Jyoti Reply
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
yes that's correct
I think
Nasa has use it in the 60's, copper as water purification in the moon travel.
nanocopper obvius
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
analytical skills graphene is prepared to kill any type viruses .
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Anatomy of a game engine. OpenStax CNX. Feb 07, 2013 Download for free at https://legacy.cnx.org/content/col11489/1.13
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Anatomy of a game engine' conversation and receive update notifications?