Project%20Overview - PowerPoint PPT Presentation

About This Presentation
Title:

Project%20Overview

Description:

A high level language for creating mazes rendered in 3 dimensions using Quake. ... Language Design ... all our methods late in development. Generalize your code ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 21
Provided by: rw285
Category:

less

Transcript and Presenter's Notes

Title: Project%20Overview


1
Project Overview
Mapwad A Maze Generation language
  • Team Ben Smith, Avrum Tilman, Josh Weinberg, Ron
    Weiss

2
Overview 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

3
Motivation
4
Motivation
  • Designing mazes by hand is tedious and error
    prone
  • Build large, complex mazes algorithmically

5
Goals
  • 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

6
Language 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

7
Mapwad syntax
  • Java/C
  • Whitespace ignored
  • Comments // and //
  • Blocks enclosed in
  • Function default parameters
  • MyFunc(int a,int b3,int c4)
  • MyFunc(1,,10)
  • MyFunc(1,2)
  • dot operator (built-in types only)
  • myRoom.Walls0.Length 10

8
Reserved Words
  • Control Flow
  • if, else, for, while, break, continue, return
  • Primitive Data Types
  • int, float, boolean, string
  • Values
  • true, false, null

9
Object Data Types
  • Room
  • Walls - Super Data Structure
  • Wall
  • Location
  • Thing

10
Built 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 ltLocationgt
  • MapHeight ltfloatgt
  • CeilingTexture ltstringgt
  • FloorTexture ltstringgt

11
Semantics
  • 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

12
Compiler 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.

13
Block Diagram
14
Sample Code
  • //creates a regular polygon shaped room
  • Room regularRoom(int walls, float length, string
    texture"BRICKA2_2")
  • Room newRoom Room()
  • float angle 180(walls-2)/walls
  • int i
  • for(i0i lt wallsi)
  • 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)

15
Compiler 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

16
What does it look like?
17
Error 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

18
Testing
  • 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

19
Lessons Learned
  • Dont 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

20
Future Work
  • Support more generalized 3D structures
  • More sophisticated error checking
  • Support for more interactive objects
  • Doors, Elevators, Moving platforms
  • Integrate into a graphical level editor
Write a Comment
User Comments (0)
About PowerShow.com