Use your measuring tape to measure the desired size of your dungeon walls. Remember, this is a crude dungeon and not a Victorian dining room--the walls don't need to be cut to exact shapes. For the purposes of building an effective set, however, your walls should probably be somewhat uniform and fit within the space where you intend to stage your play or shoot your film.
Mark the dimensions of the dungeon walls on the foam boards with a pencil. Cut the walls to their desired shape with a boxcutter. Be very careful to keep your fingers clear when cutting, and rest the foam board on a surface that you don't mind scratching.
Use a scraping device, such as a knife, spoon or screwdriver, to cut some grooves in your foam boards. The goal here is to create the appearance of individual stones and rocks making up the composition of the dungeon wall. The grooves should be narrow and asymmetrical. Rough up the surface of the foam boards with heavy grit sandpaper. This makes it more receptive to paint and give it a worn appearance.
Paint the grooves you cut into the foam board with matte black paint. The rest of your foam boards can then be painted as well. Use a dark gray color to give your dungeon walls a darker, more realistic look. You can randomly sand areas of the wall to make it look more worn and ancient after the paint dries.
Connect your dungeon walls together with hot glue. Hot glue will dry rather quickly, but it might be a good idea to use a heavy weight to hold the walls in place as they dry initially. Wipe away any excess glue before it dries.