This is a game implementation that runs entirely inside of AutoCAD, it uses the C#.NET AutoCAD API. The game uses all of the standard elements that would be available as a drafter. The character sprites are made up of blocks. The maze is build of polylines. All of these items are generated at run time and is not imported from a library.
There are five mazes. The original Pacman maze and the four MS. Pacman mazes. Each maze is generated from a simple grid. Each corner is made up a collection of lines and arcs and is arranged in a grid pattern. These separate elements are then combined into a single polyline and assigned a color.
The chomping monster, ghosts, and dots are build from scratch by code. They are combined into a single block for each version of the character. For example, the Ghosts: looking up, looking right, being eaten, and changing color when afraid. Chomp has three mouth states: mid, open and close. The block is rotated around it’s axis to show the direction.
This project started by trying to answer a few simple questions
- Can we display real time graphics?
- Can the graphics update without user interactions?
- Can we get enough performance to play a game?
Normally the graphics area will only update with the following conditions
- The user moves the mouse on the screen
- The view is zoomed or panned
- The user manually regenerates the screen
This can be worked around by using the idle process
- AutoCAD exposes an idle process approximately every 6 milliseconds.
- While this values can change depending on what AutoCAD is doing, we can count the intervals.
- During this interval we can update the graphics display without flicker or user interaction