How Mazeworld Works
Each Mazeworld game is a PDF file which is generated by distilling a PostScript file. The PostScript program was written by me. Ignoring the information pages which were trivial to do, the meat of the program works like this:
- Define a 2D matrix representing the plan of the maze. There is one number for each square, and this simply represents which sides have exits.
- For each square of the maze generate the four possible views (north, east, south and west) on consecutive pages. The perspective projection is textbook stuff.
- Add links for the rotate left and rotate right buttons (usually to the
previous and next pages respectively). The Distiller
pdfmark
operator is used for this. - If there is an exit on the side being faced, add a link to the appropriate page. This is a relatively simple calculation given the size of the maze and the order in which the pages are generated.
The PostScript program for the whole lot, including the info pages, is 12K long. You give it to Distiller and it sits there for a few minutes generating all the pages.
The advantage of doing things this way is that virtually everything is automatic. To produce a different maze, all you need to do is change the matrix at the start of the program. Nothing has to be drawn by hand, and no links have to be inserted with Exchange.
Noddy's Guide from PDF Corner gives a more general explanation of PDF and Acrobat products.
Addendum - Turbo Rendering
On 23rd October 1995 I replaced the original versions of Mazeworlds 1-3 with new TURBO RENDERED files. These are generated by a modified version of the postscript program which omits rendering of hidden surfaces. In the first version, surfaces outside the viewing area were omitted (in fact Distiller does this for the clipping area), but there were still some redundant drawing commands for surfaces which would get completely covered by others. By not drawing these surfaces, the PDF file size is reduced and drawing time is also reduced for many views. I've written some more waffle about this for anyone who's interested.