Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation...
-
date post
21-Dec-2015 -
Category
Documents
-
view
213 -
download
0
Transcript of Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation...
![Page 1: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/1.jpg)
Project OverviewProject Overview
Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss
Mapwad: A Maze Generation language
![Page 2: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/2.jpg)
Overview and SummaryOverview and Summary
A high level language for creating mazes rendered in 3 dimensions using Quake.
Built in data structures and functions to naturally express a map.
Ability to define custom functions to ease implementation of maps
Java/C style syntax and semantics
![Page 3: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/3.jpg)
MotivationMotivation
![Page 4: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/4.jpg)
MotivationMotivation
Designing mazes by hand is tedious and error prone
Build large, complex mazes algorithmically
![Page 5: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/5.jpg)
GoalsGoals
Easy to use - intuitive syntax, simple language constructs
Flexible - few constraints on maze - walls can be at any angle to each other, etc.
Concise - able to generate complex maze with few lines of code
![Page 6: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/6.jpg)
Language DesignLanguage Design
The language is designed around high-level data types that offer an intuitive description of a map
Instead of dealing with planes you deal with rooms
Mapwad eliminates the need to specify coordinates– All objects are positioned relative to each
other
![Page 7: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/7.jpg)
Mapwad syntaxMapwad syntax
Java/C– Whitespace ignored– Comments /**/ and //– Blocks enclosed in {}– Function default parameters:
• MyFunc(int a,int b=3,int c=4) {…}• MyFunc(1,,10);• MyFunc(1,2);
– “dot” operator (built-in types only):• myRoom.Walls[0].Length = 10;
![Page 8: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/8.jpg)
Reserved WordsReserved Words
Control Flow– if, else, for, while, break, continue,
returnPrimitive Data Types– int, float, boolean, string
Values– true, false, null
![Page 9: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/9.jpg)
Object Data TypesObject Data Types
Room– Walls - Super Data Structure
Wall Location Thing
![Page 10: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/10.jpg)
Built inBuilt in
Functions– boolean Add(Room r, Wall newWall)– boolean AddAfter(Wall w, Wall newWall)– Remove(Wall w)– boolean Attach(Wall a, Wall b, string connectpoint)– boolean Close(Room r)– boolean IsClosed(Room r)– Math Functions
Variables– MapStart <Location>– MapHeight <float>– CeilingTexture <string>– FloorTexture <string>
![Page 11: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/11.jpg)
SemanticsSemantics Scoping rules
– Global scope– {} blocks have own scope– Rooms and Things automatically added to map
Primitive Types– Passed by value– Instantiated when variable is created
• int x; //creates a variable and instantiates an int Object types
– Passed by reference– Object-typed variables are references– Must be explicitly instantiated
• Room r; //creates a reference to a Room• r = Room(); //instantiates a Room object
![Page 12: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/12.jpg)
Compiler ComponentsCompiler Components
Lexer/Parser Tree Walker
– Walks the AST generated by the parser– Checks types, resolves symbols, etc.– Executes the code
Internal package– Contains code called by the tree walker to manipulate Mapwad
structures Code generator
– Creates Quake .map file - text file containing information about contents of map.
QBSP– Compiles .map file into Quake .bsp map file that the game
understands.
![Page 13: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/13.jpg)
MapwadParser
MapwadLexer
MapwadWalker
Mapwad
Builtin Functions
Block DiagramBlock Diagram
MWMap qbsp
MWGui
![Page 14: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/14.jpg)
Sample CodeSample Code//creates a regular polygon shaped roomRoom regularRoom(int walls, float length, string texture="BRICKA2_2") { Room newRoom = Room(); float angle = 180*(walls-2)/walls; int i; for(i=0;i < walls;i++) {
Wall w = Wall(length,angle,"",texture);Add(newRoom, w);
} Close(newRoom);
return newRoom;}
Map() { Room r = regularRoom(10, 15, "BRICKA2_4"); Room start = regularRoom(4, 5); Attach(r.Walls[0], start.Walls[0]);
Thing t = Thing("monster_army", Location(r.Walls[5], "center", 10));
MapStart = Location(start.Walls[3], "center", 2); CeilingTexture = "sky1";}
![Page 15: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/15.jpg)
Compiler OutputCompiler Output
"sounds" "1" "classname" "worldspawn" "wad" "quake101.wad" "worldtype" "0" { ( 0 0 0 ) ( 100 0 0 ) ( 0 0 1 ) BRICKA2_4 0 0 0 1.0 1.0 ( 0 -1 0 ) ( 0 -1 1 ) ( 100 -1 0 ) BRICKA2_4 0 0 0 1.0 1.0 ( 0 0 0 ) ( 0 0 1 ) ( 0 -1 0 ) BRICKA2_4 0 0 0 1.0 1.0 ( 100 0 0 ) ( 100 -1 0 ) ( 100 0 1 ) BRICKA2_4 0 0 0 1.0 1.0 ( 0 0 0 ) ( 1 0 0 ) ( 0 1 0 ) BRICKA2_4 0 0 0 1.0 1.0 ( 0 0 100 ) ( 0 1 100 ) ( 1 0 100 ) BRICKA2_4 0 0 0 1.0 1.0 } { ( 100 0 0 ) ( 181 59 0 ) ( 100 0 1 ) BRICKA2_4 0 0 0 1.0 1.0 ( 101 -1 0 ) ( 101 -1 1 ) ( 181 58 0 ) BRICKA2_4 0 0 0 1.0 1.0
…
![Page 16: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/16.jpg)
What does it look like?What does it look like?
![Page 17: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/17.jpg)
Error CheckingError Checking
There are three types of error checking in Mapwad
Syntax Error– Caught by the lexer/parser
Semantic Error– Caught by the tree walker
• Incorrect types, wrong arguments, etc… Runtime Error/Warning– Caught during code generation
• Invalid Geometry• Locations outside of map
![Page 18: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/18.jpg)
TestingTesting
Modular Testing– Each module was tested independently
Regression Testing– Basic test cases were reused as code evolved
Integration Testing– Modules were combined slowly and tested at
every stage
![Page 19: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/19.jpg)
Lessons LearnedLessons Learned
Don’t overextend yourself– Our initial design was too ambitious for
a one semester project
Fully define interfaces early– We had to modify all our methods late in development
Generalize your code– When we found problems we they were resolved without
major code revisions
![Page 20: Project Overview Team: Ben Smith, Avrum Tilman, Josh Weinberg, Ron Weiss Mapwad: A Maze Generation language.](https://reader030.fdocuments.in/reader030/viewer/2022032704/56649d6c5503460f94a4b1f4/html5/thumbnails/20.jpg)
Future WorkFuture Work
Support more generalized 3D structures
More sophisticated error checkingSupport for more interactive objects– Doors, Elevators, Moving platforms
Integrate into a graphical level editor