Lua

A* Pathfinding: Give Enemies a Brain

Implement A* so your game's enemies find the smartest route across a tile map, dodging walls. The algorithm behind real game AI.

LuaAdvancedFor fun, and portfolio-worthy

What you'll be able to build

Implement A* so your game's enemies find the smartest route across a tile map, dodging walls. The algorithm behind real game AI. Along the way you pick up real, transferable Lua skills, not just this one project:

  • modeling a tile grid as a graph
  • the open set as a priority queue (sorted table)
  • g/h/f cost functions and a heuristic
  • tracking came-from to rebuild the path
  • neighbor expansion and wall blocking
  • reconstructing and drawing the route

A course like this one

Yours is built from your own placement, so module count and depth will differ. This map shows what a advanced-level Lua learner building A* Pathfinding actually gets.

  1. Module 1: Idiomatic Lua and string patterns5 lessons

    Builds the production-ready version of the script for your a* pathfinding.

  2. Module 2: Closures, upvalues, and varargs5 lessons

    Builds the production-ready version of the reusable module for your a* pathfinding.

  3. Module 3: Metatables, OOP, and coroutine schedulers5 lessons

    Builds the production-ready version of the metatable behaviour for your a* pathfinding.

  4. Module 4: Sets, lookups, and sparse tables5 lessons

    Builds the production-ready version of the table model workflow for your a* pathfinding.

  5. Module 5: Iterators and stateful loops5 lessons

    Builds the production-ready version of the function that powers your a* pathfinding.

  6. Module 6: Sandboxing and production hardening3 lessons

    Builds the production-ready version of the release package for your a* pathfinding.

How the lessons actually work

Leans on:tablemath

Every lesson has you predict what a piece of Lua code will output before you run it, then run it for real in your browser and fix what you got wrong. Each module ends in a challenge gate with hidden tests, so you can't advance until your code actually works. The course closes with a capstone that assembles everything into A* Pathfinding, and a runnable proof page tied to your own code.

Common questions

How long does the A* Pathfinding: Give Enemies a Brain course take?

about 7 hours, across 6 modules and 28 lessons, at roughly 15 minutes per lesson. Your own course may run shorter or longer, since it's sized to your placement result, not a fixed template.

Do I need experience?

Yes. This is an advanced-tier Lua project, so it assumes you're already comfortable writing and reading Lua before you start.

How much does it cost?

$15 one-time, no subscription. The first module is free, so you can see exactly how the course teaches before you pay for the rest.

No subscription. Module one is free.

Build my A* Pathfinding