<< 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

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.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket Reply
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?