The Pacman Project
Map Generation
To allow a game of Pacman to be played in the city of Maastricht, a virtual map is needed which allows the system to generate advise for the connected players and run simulations. As mentioned in Chapter 2, there is a database server available in the system. A game-map has been traced out on the city plans of Maastricht (conveniently near the University), which can be seen in figure 5.2. This map needed to be stored in a database to allow easy conversion into something that the game program can work with. The GPS-position of each crossroad within the map was stored in the database as a 'Node'. A method to do this automatically could be designed, but this was beyond the scope of this project. To connect the Nodes to each other, an 'Arc' was designed that forms a connection between two Nodes. Also, a 'Street' contains one (or more) Arcs. With these objects, the map can be represented in a database (see Figure 5.1) with the tables 'StreetToArc' and 'ArcToNode' containing the connections.

Figure 5.1 - The Pac-Maas map database
To use this database in the system, an SQL-connection is made in Java that queries the database for each table and converts all this information into a 'Nodemap'. This Nodemap is a graph representing the game-map. The game uses the following functionalities from Nodemap:
- Return the node which is closest to a specified node
- Return the node which is closest to a specified GPS-position
- Return all the nearby nodes within a certain distance from a specified node
- Return all the adjacent nodes to a specified node
- Eat a pill at a specified node
- Check if the map still has any pills left (e.g. if pacman has completed the game)

Figure 5.2