PacDasher

An application by James McCabe
 
 

What is it? | What is it for? | What does it look like? | How does it work?



 
 
 
What is it?

PacDasher is a configurable Pacman clone written in Java 5.0. If you have this version of Java or higher you will probably be able to play it now (because the Web Start plug-in is installed in your browser when Java is installed).

If this does not work, or you are interested in the source, download the latest version from SourceForge.

The posts on the Java.Net gaming community give an idea of the history of PacDasher from June 2003 onwards.

Send feedback to me.
 
 
What is it for?

PacDasher demonstrates that Java, although slower than C++, is a feasible language for creating games and animations, especially with the new graphics capabilities and control over garbage collection included from Java 1.4 onwards.
 
 
What does it look like?


 
 
How does it work?

DESIGN PRINCIPLES
-----------------

Animation should be smooth
    => delay between frames should be small
        => data structures should be efficient
            => optimized for querying on visual object by position
            => 2D arrays used for MazeData
    => delay between frames should be consistent
        => garbage collection should rarely be allowed to run
            => minimal objects created on heap during animation iteration
                => be wary of clipping and complex Shapes
            => tweak arguments to java to run a quiet garbage collector
Platform independent
    => pure Java, avoid dlls
 

CODE ARCHITECTURE
-----------------

MVC variant:
 

  ------------------------------------> Animation
  |         |
  |                                         |
  |                                         v
User <---> GUI -----------------------> Controller
            ^                            |     |
            |                            v     |
            |            --------------State   |
            |            |                 ^   |
            |            v                 |   v
            -------MazeRenderer <----------UIModel
 

The UIModel contains the existence and positions
of all visual objects in the Maze: PacDasher, ghosts, dots, etc.
The Controller listens to events from the User.
The State is modified based on these events and also from changes
in the UIModel. Example states: GAME_READY_STATE, CAPTURE_STATE.
The MazeRenderer paints to the GUI based on the State and the
UIModel.
The Animation is kicked off by the User and is the main driver
of events.

Also frames in the GUI are currently allowed to listen directly
to PacDasher, an element of UIModel.