Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i am trying to make a pacman game in c# using GDI+, i have done some basic work and i have previously replicated games like copter-it and minesweeper. but i am confused about how do i implement the map in pacman, i mean which datastructure to use, so i can use it for moving AI controlled objects and check collisions with walls. i thought of a 2d array of ints but that didnt make sense to me. looking for some help. thanks.

share|improve this question
Tile set including how it was put together can be found here – John Nov 24 '12 at 21:26

Why not use a simple 2d array of chars, and use some text editor as your level editor?

Something like this:

Pacman level in ASCII

share|improve this answer
that was my first thought. but im a little confused about how do i use it properly, i mean a single character represents how many pixels? and if lets say it represents 10x10, then would it be the smallest reachable area on screen? i mean what if i want to draw something like 5x5, then the collision detection will still be related to 10x10. sorry for bad english. – Sam Fisher Nov 24 '12 at 21:02
This would only be a logical representation of the model. How you choose to render it is entirely up to you. If you need a fined 'resolution' let's say you want to be able to have three 'dots' in one 'wall width' then simply use three characters as the with of 'one unit' and as such a solid horizontal wall would go from (###) for the three first to ex ( # # # ) – AlexanderBrevig Nov 24 '12 at 21:11

Perhaps a graph can be used. I imagine the vertices would represent intersections or corners in the maze and the edges would be the connections between the intersections.
Each edge should probably contain a length, and if the graph is used for rendering as well, each edge would have to contain a vertical/horizontal value too, i guess.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.