<< Chapter < Page Chapter >> Page >

The appearance of this empty game window matches the second item in the above list titled default behavior . In particular, the default behavior of the Slick2D game engine is to display an empty game window with an active FPS counter in the upper-leftcorner..

Discussion and sample code

A service provider program

Many game engines, (and the Slick2D game engine is no exception) , are "service provider" programs. They provide services that make it easier to write game programs than would otherwise be the case if you were to "start from scratch" to write a game program.

Different game engines provide different services. However, most game engines, including Slick2D, provideat least a minimum set of services, which includes the following:

  • An opportunity to initialize the game state.
  • Overall flow control that includes a game loop, which alternates in some fashion between
    • an update phase, in which the game state is updated, and
    • a rendering phase in which portions of the game state may be displayed for the benefit of the player.

These services are provided in different ways in different game engines. You will learn how they are provided by the Slick2D game engine in future modules.

Two primary objects

At a minimum, a Slick2D game that runs as an application (not an applet) consists of at least two cooperating objects :

  1. An object instantiated from a subclass of the Slick2D class named GameContainer .
  2. An object instantiated from a class that implements the Slick2D interface named Game .

(For the remainder of this and future modules, unless I specifically indicatethat I am discussing a Slick2D game applet, you can assume that I am talking about a Slick2D game program that runs as an application.)

Behavior of an object of the AppGameContainer class

The GameContainer object ( item 1 above ) , and the behavior of its methods, manages the game play after the game program starts running. For example, this is the object that managesthe game loop.

For the program shown in Listing 1 , this object is an object of the class named AppGameContainer , which extends the class named GameContainer .

The AppGameContainer class provides many public methods by which you can manipulate the behavior ofthe container object. However, the authors of the Slick2D library did not intend for you to physically modify the source code in the GameContainer class or the AppGameContainer class.

Behavior of an object thatimplements the Game interface

The Game object ( item 2 above ) , and the behavior of its methods is what distinguishes one Slick2Dgame from another Slick2D game. The authors of the Slick2D library did intend for you to physically modify the source code in the class that implements the Game interface. This is how you distinguish your game from games written by others.

(Clarification: See a later discussion of a class named BasicGame , which implements the Game interface. The authors of the Slick2D library did not intend for you to modify the source code in the BasicGame class. Instead, they intended for you to subclass that class and to modify thebehavior of the Game object by overriding inherited abstract methods.)

Questions & Answers

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
Do somebody tell me a best nano engineering book for beginners?
s. Reply
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?
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
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
many many of nanotubes
what is the k.e before it land
what is the function of carbon nanotubes?
I'm interested in nanotube
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
what is system testing
what is the application of nanotechnology?
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
anybody can imagine what will be happen after 100 years from now in nano tech world
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
silver nanoparticles could handle the job?
not now but maybe in future only AgNP maybe any other nanomaterials
I'm interested in Nanotube
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
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
Berger describes sociologists as concerned with
Mueller Reply
Got questions? Join the online conversation and get instant answers!
QuizOver.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?