What I Learned from Building a Pacman Clone

Hey everyone.

I apologize for taking so long to write a new post on this site. I was busy applying for graduate colleges, working on a new Unity project, dealing with issues at work, playing video games that I have missed out on for months, and going on a month long trip to the United States and Canada. I wanted to write this post right after I made the Pacman clone, but I was distracted by other things at the time, and the above mentioned activities delayed my post even further. So, let’s get on with it.


Working on the Pacman Clone is probably one of the most challenging projects I have ever worked on, mainly for two reasons: it utilized more of the functionalities in Unity than the Tetris clone project, and it required more skills to develop and utilize to make the end product possible. For these reasons, I significantly improved my knowledge in Unity, and developed some basic skills outside of programming, such as pixel art design, basic sound editing using a software called Audacity, using mathematics to design the level and movements of Pacman and the ghosts, and, most importantly, understood more about how game feel should work in a video game.

As much as I gained some skills from working on this project, there were some lessons I learned as well. They are crucial lessons that I hope to adopt in the future when working on games so that I wouldn’t go through so much difficulty during development.

  1. Art takes a lot of work
    You would think that graphics and animation would be a much easier and shorter task to do than programming. As it turns out, art is actually a very lengthy process, because of  the attention to details when drawing your sprites or levels. If art is rushed, it will look unappealing for the user to look at, which is devastating because the user must have a better first impression of the game in order for him to play it.For example, I could’ve used the original Pacman sprite, which looks like this:pacmanInstead, I personally believe that this Pacman sprite and animation looks more appealing for the user if it looks like this.

    This Pacman has shadows and lighting to make it have a better look. Also, I like shadows.

    This Pacman has shadows and lighting to make it have a better look. Also, I like shadows.

    Had I rushed the sprite and animation, the animation probably would not look as smooth, or even move at all. The animation of Pacman above has 47 frames in it, and it runs in the game at 60 frames per second.

    Sometimes the art can define how the movement of the characters in the game can move smoothly and symmetrically.

    For example, originally, I wanted to use this maze extracted from a Pacman clone online as a background for the level.

    However, I realized how the maze was not symmetric enough so that the Pacman and ghost sprites can move smoothly in. The collision detector did not much the positions of the walls, and the sprites kept on stopping or get stuck in empty places. Therefore, I decided to draw the maze myself with mathematical precision.

    I redrew the maze about three times, until I reached the perfect maze without the walls that looked like this.


    With the routes drawn above, it was easier for me to draw the walls, and add precise measurements on where the wall colliders will be. So, I ended up drawing this:

    PacmanLevel 1

    So, sprites and animation took a lot out of my time, especially since my skills in graphics design is not so great. It is an aspect of the project that I underestimated, but am glad to understand better. I have more respect for artists now than I used to.

  2. Planning and designing make development easier
    Although this seems like an obvious thing to say, I didn’t expect this to also apply when emulating another game or software. Even though Pacman is already established and has the schematics, I had a harder time designing and programming it when I had no plans made at all. I had a hard time creating the sprites, programming the AI, working on Pacman’s movement…etc.There were times when I had to plan things out at parts where I was struggling. As you can imagine, I got over these parts accurately and easily.
  3. Pay attention to details when recreating or cloning a game
    When creating a clone of a game or remaking it, we tend to avoid studying the game well due to our assumption on the depth of our knowledge of the game. I certainly thought that I got the rules and gameplay of Pacman all locked down. However, while I was programming, I keep missing significant details of the original Pacman game from the clone I created. This made me take an even longer time developing, since I have to readjust the code in order to make room for the features I keep missing.While constantly missing features from the original Pacman in the clone emphasizes the importance of planning, it also highlights the significance of studying the games you wish to emulate well, and not just purely rely on your own knowledge of the game. It saves you time, helps organize your code, and it also helps plan the game better based on the details in it
  4. Avoid reusing foreign game assets as much as possible
    Reusing game assets from other developers too much can create a visual, audio, and maybe even functional mess, if you are not careful. Since the game is developed by you and not the original programmer, plainly reusing the assets can result in mismatching your code with the assets and can end up making everything seem out of place. Making foreign assets match is actually even more work than matching your own (if you care enough to make your games look good). By creating your own assets, even if it is a recreation of another, you can configure them more easily in your code and game design because they seem more thematic. It might take longer to do than just simply getting an asset from the Unity store or download them from the internet, but it pays off in the long run when you want to easily manage your game design or functions.
  5. Artificial Intelligence has Personality
    When I worked on the AI for the Pacman ghosts, I initially applied a path finding algorithm to all of the ghosts. However, because the ghosts use the same path algorithm, they all ended up going on the same trail while chasing Pacman without any of them spreading out. This caused the game to be too easy, strange, and completely different than the original ghosts. The game looked like this.

    The ghosts will end up going through the same trail if they have the same algorithm.

    The ghosts will end up going through the same trail if they have the same algorithm.

    So, I looked up on how to resolve this kind of issue, and I ended up with this blog post or article about ghosts’ behaviors. What caught my attention in the post was that each ghost AI had a “personality”, and had behaviors different from each other. So, as I kept reading, I learned more and more about how the ghosts acted independently, and how different the algorithms are for each of the ghosts.

    So, I took the article to heart, and applied some of the differences of the ghosts mentioned in the article into my code, and noticed a huge contrast between the behaviors of the ghosts before and after the change of the algorithm. They can now move separately from one another, and can even corner you more easily.


This project has helped vastly improve my skills in programming skills in Unity, and in game design in general. From learning the effort for graphics and arts, to adding personalities to enemies with artificial intelligence, this project is a huge step for me to become closer to being a video game designer.

If you are interested in checking out the game, please go back at the top, check the links above, and either play the game on the site, or download the game and/or the source code.