1 Game a Week – Week 2

Today I finished my second game as part of 1 Game a Week! This week, I decided that I wanted to create a Pac-Man clone. The reason I did this is because I wanted to learn more about how game AI is programmed and how it fits into the design of the game. Pac-Man also works on a grid, and that meant I wouldn’t have to spend a week struggling with collision detection code.

Yep, that’s Pac Man (except the enemies are more aggressive and he teleports and there’s no audio)

Just like last week, this post will be my reflections on making this game. I’ll be talking about what went well, what could have gone better, and what I learned.

Wait, you literally just made a Pac-Man clone?

Well, not quite. I like to officially call this version of the game “Pac Man except the enemies are more aggressive and he teleports and there’s no audio”. The enemies are more aggressive because unlike the original game, the enemies don’t back off and then return to attack in waves. They are always in “chase” mode.

The “Power Pellets” also function differently. Instead of giving Pac Man the ability to eat the ghosts for extra points, they teleport him to the next pellet around the board in a clockwise direction. This means that Pac Man is always running from the ghosts. The idea of turning the tables against your enemies is not present in this version, when it’s a core mechanic of the original game.

And yes, I didn’t have enough time to implement audio. Hence the title of the game.

What went well

I wanted to learn more about how a game’s AI changes the feel of the game. Playing around with the ghost AI during development was interesting, as I could see how changing the AI behavior affected gameplay. For example, adding Inky into the game gives you situations where he will try to get ahead of you and cut you off from the other side of the tunnel. Adding in Clyde will give you situations where you can play chicken against him, because you know he’ll flee to the bottom left corner once he is within 8 tiles of Pac Man. I found it fascinating that these simple AI rules gave the game a feeling of life.

https://upload.wikimedia.org/wikipedia/en/5/51/Pacman_title_na.png
The original Pac-Man character list. Image courtesy of Wikipedia (source)

What could have gone better

At the start of this week I really wasn’t feeling up to design and I wanted a quick win. I thought remaking Pac Man in 2 or 3 days would be super easy. I was wrong.

Although the game logic wasn’t that complicated, I wasted a lot of time adding in the art assets and implementing things in a non optimal way. I did things such as placing and sorting the tiles manually in the hierarchy so they would be indexed correctly in the Level class, which kept track of the coordinates of each tile. I then manually copy and pasted the pellets, or manually changed the sprites of each wall tile in the level. A lot of this was just busywork, when I could have used something like Unity’s 2D Tile Based Editor to setup the level.

The other thing that could have gone better was thinking more about design up-front, and scoping my time so I don’t work on weekends. Because my goal was to essentially remake Pac-Man, I didn’t think about design until I needed to cut features to make the game by the end of the week. In this case, I cut the wave based AI and Power Pellets. I don’t think teleporting is a great mechanic, and it was honestly just the easiest twist I could implement at that time.

As for working weekends, I find myself pretty tired after working on this game, especially considering I worked last weekend to finish my game last week. Next week, I’m planning on working on something with a tiny implementation scope, but an interesting game design.

What I learned

I had the opportunity to reacquaint myself with some Unity features. Specifically the Mecanim animation system. I also learned that sometimes it’s worth slowing down and learning a new system rather than brute forcing a solution. Specifically, learning the 2D Tile Level Editor instead of hand-placing the tiles and sorting them in the hierarchy.

While I didn’t design this game, since it was already developed by Namco in the 80’s, I did gain some design insight while developing the game. As I mentioned earlier, seeing how the gameplay changes as the different AIs are implemented gave me an appreciation for how simple AI can improve a game. Mark Brown’s video on Pac Man and gameinternals.com were both hugely beneficial resources to have while trying to replicate the AI behavior.

I also learned how important good art assets are for changing the feel of the game. I could have shipped the game with the following programmer art, but I don’t think it would have the same emotional response:

Early version of the game with a simpler art style. Still clearly Pac-Man

I think from this, I want to explore game AI a bit more. I’d also like to see if I can make my own simple art for my next game, to see if I can get a specific emotional response out of it.

Conclusion

As always, thanks so much for reading my post! The game link is available here if you want, along with the source code below.

1 Game a Week – Week 2

Pac Man except the enemies are more aggressive and he teleports and there’s no audio

Available now to play on your browser

Source code: https://github.com/Reccy/1GAW_2

One thought on “1 Game a Week – Week 2

Leave a comment