Skip to content
AI-powered appsNewChat, vision, voice, generationBookings & schedulingAppointments that book themselvesShops & sellingA storefront in every pocketClient & businessRun the operation from one placeCommunities & clubsA home that is not a group chat
Health & wellnessHabits, tracking and calmGames2D, 3D and multiplayerPersonal & toolsThe tool you wish existedInternal toolsThe tool ops never had time for
See all use cases
ArcadeNewPricingSecurity
EngineThe game engine and World EditorHow it worksFrom one sentence to a live productDocsGuides for building and publishingBlogStories, guides and newsChangelogWhat shipped latelyStatusUptime of every serviceSupportGet help from the team
AI-powered appsBookings & schedulingShops & sellingClient & businessCommunities & clubsHealth & wellnessGamesPersonal & toolsInternal tools
See all use cases
ArcadeNewPricingSecurity
EngineHow it worksDocsBlogChangelogStatusSupport
Language
Blog
GamesNovember 22, 20266 min read

How to make a game like Pac-Man

Maze chase games are about four chasers that each think differently and one moment when the hunter becomes the hunted. Here is how to build the movement and the AI.

Startbase Team
Editorial ink illustration of a wooden labyrinth tray with seed beads in its corridors and felt mice at the corners, the marble in ember orange

Key takeaways

  • Movement is tile-based with turns buffered before junctions. Smooth cornering is most of the game feel.
  • Give each chaser a different idea of where to go, and alternate chase phases with short retreat phases so pressure breathes.
  • A power-up that reverses the chase is the emotional peak. Its name, character, ghosts, maze layouts and sounds belong to its owner.

Pac-Man defined the maze chase: the player moves through a maze collecting every dot while several chasers hunt them, and eating a special power-up briefly turns the chasers vulnerable so the player can hunt back. Clear every dot to finish the level. To make your own, you need tile-based movement that turns smoothly, a maze, chasers that each behave differently, a rhythm of chase and retreat, and that reversal moment. All of it is achievable in a weekend; tuning it to feel great takes longer.

Pac-Man, its yellow hero, its ghosts and their names, its maze layouts, its sounds and its exact rules belong to its owner. The maze chase genre is a design pattern many games have used since. Your game needs its own characters, mazes and chaser behaviors.

Why maze chases are so tense

  • Total visibility. The whole maze is on screen, so the player is always planning routes and reading threats.
  • Different chasers, emergent traps. When each chaser follows its own logic, they accidentally coordinate, and the player feels hunted by a team.
  • Reversal. The power-up flips fear into greed for a few seconds. Few game moments feel as good.
  • Clear progress. Dots disappear as you eat them. The maze literally empties as you play.

The maze as a tile map

Store the maze as a grid of tiles, for example 28 by 31, where each tile is wall, path, dot, power-up, chaser home or tunnel. A string array is the easiest way to author it:

  • `#` for walls, `.` for a dot, `o` for a power-up, a space for an empty path, `T` for tunnel ends that wrap to the other side.
  • Precompute a list of junctions (tiles with three or four open neighbors). Chasers only make decisions there, which keeps AI cheap.
  • Mazes should have no dead ends, several loops and one or two tunnels. Dead ends are death traps that feel unfair.

The tilemaps explained guide covers rendering and authoring tile maps. You can lay out mazes yourself in the World Editor once the agent sets each maze up as a level.

Movement and cornering

The player moves continuously along corridors, but always aligned to the grid. The key feel rule is turn buffering: when the player presses a direction that is blocked right now, remember it and take the turn the moment it opens.

  • Speed: around 7 to 8 tiles per second for the player. Chasers start slightly slower and catch up over levels.
  • Buffer: hold a queued direction for about 0.25 seconds, or until it is taken or replaced.
  • Cornering grace: allow a turn when the player is within a few pixels of the tile center, snapping them onto the new axis. Without this, turns feel sticky.
  • Reversal is instant: turning back the way you came never needs to wait for a junction.
  • Eating slows you slightly (a few percent) on dot tiles, so empty corridors are faster than full ones. This creates an interesting choice: clear dots or escape quickly.
  • Touch: swipe to queue a direction; no on-screen pad needed. See grid-based movement for snapping details.

Chasers that think differently

The secret of the genre is not smart chasers, it is different chasers. At each junction, every chaser picks the exit that brings it closest (straight-line distance) to its personal target tile, and it is not allowed to reverse. Different targets create different behaviors, and together they form traps no one designed. Your own target rules might be:

  1. 01The tracker targets the tile where the player was two seconds ago, following the trail.
  2. 02The cutter targets the junction the player is heading toward, trying to get there first.
  3. 03The guard patrols a loop around the power-ups and only chases when the player is within 6 tiles.
  4. 04The wildcard picks a random target each time it reaches a junction, then commits.

Use straight-line targeting rather than full pathfinding: it is cheaper and makes chasers beatable, because they make readable mistakes. The pathfinding for games and enemy AI behaviors articles cover when full pathfinding is worth it.

Chase, retreat and the reversal

If chasers hunt constantly, the game becomes exhausting. Alternate phases on a timer: chase (each chaser uses its personal target) for about 20 seconds, then retreat (each heads for its own corner of the maze) for about 7 seconds. Shorten retreats as levels rise. When phases change, chasers reverse direction once, which tells experienced players a phase changed.

The power-up starts a vulnerable phase: chasers turn a distinct color, slow to half speed and wander randomly at junctions. Catching one sends it home and scores points that double for each catch in the same phase. The vulnerable phase lasts around 6 seconds early and shrinks with each level, and chasers flash for the last 2 seconds. The doubling chain is the risk-reward heart of the genre: chase a fourth catch or play it safe.

Three twists that make it yours

  1. 01The maze changes. Walls slide every 30 seconds, opening new routes and closing old ones. Players stop memorizing routes and start reading the maze.
  2. 02Light and dark. The maze is dark except for a circle around the player; chasers show only as eyes until close. Same rules, horror tension.
  3. 03You leave something behind. The player lays a trail that chasers slip on, or blocks a corridor for a few seconds once per level. One new verb changes the strategy.

A brief to paste into Startbase

A 2D maze chase game for phones (portrait) and desktop called Seed Run. The hero is a round hedgehog collecting seeds in a hedge maze at dusk; four garden cats chase it. The maze is a tile grid (about 21 by 27) authored as a text map, with no dead ends, two wrap-around tunnels and four glowing acorns. Movement is grid-aligned with turn buffering (a queued swipe or key is taken as soon as the turn opens) and a small cornering grace; reversing is instant. Cats only decide at junctions, never reverse, and move toward their own target: the tabby follows the tile the hedgehog was on two seconds ago, the black cat heads for the junction ahead of the hedgehog, the white cat guards the acorns and only chases within 6 tiles, and the kitten picks a random target at each junction. Cats alternate 25 seconds of chasing with a 5-second nap on their own corner cushion. Eating an acorn makes the hedgehog roll into a spiky ball for 6 seconds: cats flee, slow down, and can be bumped home for 150 points each, with a seed shower bonus if all four are bumped in one roll. Every 30 seconds one hedge wall slides to open a new route. Clear all seeds to finish the level; 3 lives. Swipe controls on phones, arrow keys on desktop. 5 mazes, editable as levels.

Publish it with one click and share it to the Arcade.

Common mistakes

  • Sticky cornering. Without buffering and grace, the game feels broken on touch screens.
  • Identical chasers. Four copies of one AI form a conga line behind the player. Give each its own target.
  • Perfect pathfinding. Chasers that always take the shortest path feel unfair and predictable at once.
  • Dead ends. Every corridor should connect at both ends.
  • Copying the classic maze. Design your own layouts; the original maze is part of the owner's game.

Frequently asked questions

How do the chasers work in maze games?

A common approach is that each chaser picks, at each junction, the exit that brings it closest to its own target tile. Giving each chaser a different target creates different personalities that combine into traps.

Should maze enemies use A* pathfinding?

Usually not. Straight-line targeting at junctions is cheaper and makes enemies beatable and readable. Full pathfinding makes them feel relentless and unfair.

How do I make turning feel smooth?

Buffer the player's next direction for a fraction of a second and take the turn as soon as it opens, with a small grace window near the tile center.

Can I use Pac-Man ghosts or mazes in my game?

No. The characters, mazes, sounds and name belong to their owner. Design your own characters, mazes and chaser rules.

On this page

  • Why maze chases are so tense
  • The maze as a tile map
  • Movement and cornering
  • Chasers that think differently
  • Chase, retreat and the reversal
  • Three twists that make it yours
  • A brief to paste into Startbase
  • Common mistakes

Keep reading

More in Games
Editorial ink illustration of a wooden toy figure jumping between two stone ledges, the coin above the gap in ember orange
GamesNovember 22, 2026

How to Make a Platformer Game with AI

A platformer lives or dies on its jump. Here are the numbers behind a jump that feels fair, how to build levels around it, and how to get an AI agent to build both.

7 min read
Editorial ink illustration of a tin wind-up runner on track pieces laid down ahead of it, the next track piece in ember orange
GamesNovember 22, 2026

How to Make an Endless Runner Game

An endless runner is a level generator with a character on top. Get the chunks, the speed curve and the controls right and the rest is art.

6 min read

Read less. Ship more.

Everything in this post is one prompt away. Describe your app and watch it build.

Start building

Apps, games, backends and publishing from one conversation.

Product

  • Features
  • Use cases
  • Pricing
  • Changelog

Resources

  • Blog
  • Docs
  • Support
  • Status
  • Security

Contact

  • w@startbase.ai
  • X / Twitter
  • LinkedIn
  • Instagram

Legal

  • Terms
  • Privacy

© 2026 Startbase. All rights reserved.