Ballr: A 2D Game Generator. Language Reference Manual

Similar documents
VENTURE. Section 1. Lexical Elements. 1.1 Identifiers. 1.2 Keywords. 1.3 Literals

GridLang: Grid Based Game Development Language Language Reference Manual. Programming Language and Translators - Spring 2017 Prof.

ARG! Language Reference Manual

Crayon (.cry) Language Reference Manual. Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361)

FRAC: Language Reference Manual

BoredGames Language Reference Manual A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

M/s. Managing distributed workloads. Language Reference Manual. Miranda Li (mjl2206) Benjamin Hanser (bwh2124) Mengdi Lin (ml3567)

Typescript on LLVM Language Reference Manual

Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual

GOLD Language Reference Manual

CHIL CSS HTML Integrated Language

JME Language Reference Manual

YOLOP Language Reference Manual

COMS W4115 Programming Languages & Translators GIRAPHE. Language Reference Manual

1 Lexical Considerations

Lexical Considerations

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 2: Basic Elements of C++

SSOL Language Reference Manual

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Language Reference Manual

Slang Reference Manual

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010

Computer Programming : C++

Expr Language Reference

Decaf Language Reference

easel LANGUAGE REFERENCE MANUAL

Lexical Considerations

AN OVERVIEW OF C, PART 3. CSE 130: Introduction to Programming in C Stony Brook University

Objectives. In this chapter, you will:

GBL Language Reference Manual

GAWK Language Reference Manual

Visual C# Instructor s Manual Table of Contents

BASIC ELEMENTS OF A COMPUTER PROGRAM

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

GeoCode Language Reference Manual

SEAMScript Language Reference Manual. Sean Inouye (si2281) Edmund Qiu (ejq2106) Akira Baruah (akb2158) Maclyn Brandwein (mgb2163)

UNIT- 3 Introduction to C++

SCoLang - Language Reference Manual

Petros: A Multi-purpose Text File Manipulation Language

Java+- Language Reference Manual

CGS 3066: Spring 2015 JavaScript Reference

Full file at

The C++ Language. Arizona State University 1

Twister: Language Reference Manual

Cellular Automata Language (CAL) Language Reference Manual

The pixelman Language Reference Manual. Anthony Chan, Teresa Choe, Gabriel Kramer-Garcia, Brian Tsau

Turtle Tango (TT) Language Reference Manual

Java Primer 1: Types, Classes and Operators

XQ: An XML Query Language Language Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Computational Expression

AN OVERVIEW OF C. CSE 130: Introduction to Programming in C Stony Brook University

Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006

Language Reference Manual simplicity

La Mesa Language Reference Manual COMS 4115: Programming Languages and Translators Professor Stephen Edwards

Lecture 9. Assignment. Logical Operations. Logical Operations - Motivation 2/8/18

Sprite an animation manipulation language Language Reference Manual

VLC : Language Reference Manual

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

Data types Expressions Variables Assignment. COMP1400 Week 2

Lesson 3: Basic Programming Concepts

Photogram. Programmable Photoshop Language Language Reference Manual. ( ), Group Leader. (

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

EMPATH LANGUAGE REFERENCE MANUAL

CS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

Chapter 2: Introduction to C++

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

The PCAT Programming Language Reference Manual

RTL Reference 1. JVM. 2. Lexical Conventions

corgi Language Reference Manual COMS W4115

Lecture Set 2: Starting Java

3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.

PLT Fall Shoo. Language Reference Manual

DaMPL. Language Reference Manual. Henrique Grando

Senet. Language Reference Manual. 26 th October Lilia Nikolova Maxim Sigalov Dhruvkumar Motwani Srihari Sridhar Richard Muñoz

Key Differences Between Python and Java

GOBLIN. Language Reference Manual. Kevin Xiao, kkx2101. Bayard Neville, ban2117. Gabriel Uribe, gu2124. Christina Floristean, cf2469

Ruby: Introduction, Basics

Lecture Set 2: Starting Java

Programming with Java

egrapher Language Reference Manual

CHAD Language Reference Manual

Your first C++ program

4 Programming Fundamentals. Introduction to Programming 1 1

Programming Language. Functions. Eng. Anis Nazer First Semester

Chapter 4: Making Decisions

IT 374 C# and Applications/ IT695 C# Data Structures

LCSL Reference Manual

TML Language Reference Manual

Use of scanf. scanf("%d", &number);

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

C-Major Language Reference Manual

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

Chapter 4: Making Decisions

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

CHAPTER 3 BASIC INSTRUCTION OF C++

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

Lecture 3 Tao Wang 1

Transcription:

I. Lexical elements: 1. Identifiers Ballr: A 2D Game Generator players gonna play Language Reference Manual Noah Zweben (njz2104) Jessica Vandebon (jav2162) Rochelle Jackson (rsj2115) Frederick Kellison-Linn (fjk2119) Identifiers are for naming entities, gameboards, colors, and other data types. They are defined as at least one lowercase letter followed by any combination of letters, numbers, and underscores. 2. Reserved Keywords & Symbols The following case sensitive keywords are reserved for specific purposes and cannot be used as identifiers: entity func time restart load gameboard click keypress add remove float int bool >< -> event clr pos mov if while self color vec size click_pos init frame include 3. Literals 1. Integer literals Sequences of one or more digits (ex. 253) 2. Float Literals

4. Operators Sequences of one or more digits containing a. with at least one digit before the. and at least one digit after the. (ex. 1.23) *, /, % multiplication, division, modulo +, - add, subtract >, >=, <, <= inequality operators ==,!= equal, not equal = assignment!, &&, not, and, or. access 5. Delimiters 1. Parentheses Parentheses are used to enclose arguments in function calls as well as to force precedence orders in expression evaluations. 2. Commas Commas are used to separate arguments in function calls and to separate values in color and vector data types. 3. Semicolons Used to terminate a statement. 4. Curly braces Used to enclose a series of statements in conditional blocks, loops and entity, gameboard and function definition blocks 6. Whitespace Whitespace is only used to separate tokens. 7. Comments Only single line comments are allowed and are started with // II. Data Types 1. Primitive Data Types

Integers: Most numbers will be declared as type int (all numbers relating to position of entities within a gameboard will be implicitly rounded to an int) Floats: Floating point numbers will be declared as type float, and can be used in mathematical expressions Booleans: Boolean values will be declared as type bool and can be True or False 2. Non-Primitive Data Types Color A color is a built in datatype composed of a red (r), green (g), and blue (b) value. Many predefined colors available in the Standard Library. The values of the red, green, and blue components are integers between 0 and 255 and are enclosed in () and separated by commas. Color s r,g,b components can be accessed or set using. notation. Syntax color <name> = (r,g,b); //set entity color equal to new color entity.clr = <name> //change color <name>.<r/g/b> = <val>; Example color blue = (0,0,255); //set entity color equal to new color player.clr = blue; //unnamed color allowed player.clr = (255,0,255); //change color player.clr.g = 255; Vector a vec is a built in datatype composed of an x and a y value. The values in the vec may be constructed with or ints, but everything will be rounded to int. The values of x and y are enclosed in () and separated by a comma. A vector s x and y component can be accused or set using. notation. Syntax vec <name> = (x,y); //move player to vector <entity>.pos = <name> //change vec <name>.<x/y> = <val>; Example vec teleport = (100,100); //move player to vector player.pos = teleport; //unnamed vector allowed player.pos = (100,100);

//change vec teleport.x = 42; Vector Operations Available operators for vectors are as follows. All operations are component-wise: Symbol Name Definition Example + Vector Addition vec1 + vec2 = (vec1.x+vec2.x,vec1.y+vec2.y) - Vector Subtraction vec1 - vec2 = (vec1.x - vec2.x,vec1.y - vec2.y) * Vector Multiplication vec1 * vec2 = (vec1.x * vec2.x,vec1.y * vec2.y) / Vector Division vec1 + vec2 = (vec1.x / vec2.x,vec1.y / vec2.y) vec new = (100,50)+(25,30); //(125,80) vec new = (100,50)-(25,30); //(75,20) vec new = (100,50) * (2,1); //(200,50) vec new Gameboard gameboard is the data type that represents the current window that a user is playing in and interacting with. Only one gameboard is allowed per file and the name must match the filename. gameboard.size The size represents the size of the window the user will interact with and is of type vector. The vector encodes information about the playable window s width and height. gameboard.init The init event is a reserved event keyword that is triggered at the very beginning of the game (see section? for description of events). Behavior needed to set up the game such as adding players is contained in the gameboard s init event. Syntax gameboard <name> { size = (width,height); clr = (r,g,b); init -> { setup code Example gameboard <name> { size = (200,100); clr = (255,255,255); init -> add(player(),(100,50));

Entity An entity is a rectangular component within a gameboard. An entity is composed of a color and a size. Users may also define additional variables to be associated with the entity. Event driven behavior can be added to entities. Events are described in the following section. In addition, users may define movement for an entity to set up automatic motion. Entity.size (required) All entities must possess a size variable of type vec. The size encodes the dimensions of the entity as width and height. It can be both read and set. Entity.clr (required) All entities must posses a clr variable of type color. This variable sets the color of the entity when it appears on the gameboard. It can be both read and set. Entity.pos Once entities are placed on a gameboard they contain a variable called pos of type vector encoding the x and y position of the entity center. entity.pos can be set or read from. Entity.init_pos Entities possess a member called init_pos of type vector which contains the position at which they were initially placed. entity.init_pos member is read only, and is useful for setting up parametric motion around a point (see example) Entity.frame (optional) Entities frame event is triggered every frame. This allows you to apply frame by frame changes to color or position. Syntax entity <name> { //required size = (width,height); clr = (R,G,B); //optional frame -> <change> //adding non-required variables <type> <name> = <init. val>; Example entity player { size = (10,10); clr = (255,255,0); //parametrically sets up circular motion frame -> self.pos = self.init_pos+(10*cos(time),10 *sin(time)); //adding non-required variables int score = 10;

To create an instance of an entity you call it's name using the syntax entity(). For example obstacle obs = obstacle(); add(obs, (50,30)); To refer to an entity within its own body, use self. When referring to entities from within functions, you pass the entity name. Then the function checks against every game piece of that type. For example, player >< obstacle -> remove(obstacle) III. Functions 1. Built-in Functions add(entity, vec) - adds an entity at specified position remove(entity) - removes from gameboard load(gameboard) - loads a different gameboard file, useful for switching between levels restart() - restarts gameboard from init 2. User-Defined Functions Defining a named function: To call a named function: func function_name(args) return return_type function_name(args) IV. Events 1. <event trigger> -> <behavior> (Event Operator) An event trigger is a boolean expression which appears on the left hand side of the -> symbol. This can be a collision between two objects, keyboard input, and win conditions. Any statement to the left of a -> operator is interpreted as an event trigger, and must evaluate to True or False. Named events are useful for composing more complicated events, but not all events must be named. Event triggers get checked every frame in an unspecified order. Event driven behavior specific to an entity is defined within the entity block. For example: entity main_character{ size = (10,10); clr = (255,0,0); int damage = 0; keypress(key_up) -> pos.x+10

keypress(key_down) -> pos.x-10 onclick -> add(self,click_pos) (self.damage > 100) -> remove(self) Built-in Events keypress(int key): triggered when the user presses a key self >< <entity>: triggered when the object collides with an entity of type <entity> onclick: triggered when the user clicks in the screen (with global click_pos storing the location) frame: triggered once every frame for each object that defines a behavior V. Control Flow Statements 1. Conditional Statements: if (<bool>) { <expr> elsif (<bool>) { <expr> else { <expr> 2. While loops: while (<bool>) { <expr> VI. Program Structure and Scope All code for a program is to be contained within a single file. This file must have one gameboard with the same name as the file. Within a program file, the globally scoped values are functions and gameboards, and global values defined by the standard library (KEY_UP, etc.) or user. Names of entities can also be referenced globally within the file. To link in global libraries use the syntax include <library name> Within blocks (entities, functions, etc), scope is determined by curly braces (variable shadowing not allowed). Behavior blocks and event expressions declarations can also reference a special local variable self which refers to the current entity.

VII. Sample Program entity obstacle { clr = blue; size = (20,20); mov = mymov; func pos mymov(ent){ return(ent.pos.x, ent.pos.y + sin(time)); entity player{ size = (20,20); clr = red; bool has_pickup = false; keypress(key_rt) -> pos.x++; keypress(key_lf) -> pos.x--; keypress(key_up) -> pos.y++; keypress(key_dn)-> pos.y--; >< obstacle -> restart(); >< pickup -> { self.has_pickup = true; >< endzone -> { if (self.has_pickup) { load game2; entity pickup { clr = yellow; size = (20,20); >< player { remove(self);

entity endzone { size = (30,50); clr = green; gameboard game1 { size = (200,100) init { int i = 0; while (i < 6) { obstacle obs = obstacle(); if (i%2) {obs.mov = obs.mov * (1,-1); add(obs,(20+20*i,50)); i += 1; add(player(), (10,50)); add(pickup(), (100,50)); add(endzone(), (175,50)); ;