From: Jon E. <je...@mi...> - 2005-01-02 15:39:31
|
Alright, it's about time we got started on this. One thing I neglected to mention in the milestone plan mail I wrote (thanks Dan) is that we're going to need to design a language for all of the steps and then write the compiler for the language as it goes along. It's going to be really important that the non-programmer(s) involved give feedback on the language design. The whole idea is that it shouldn't be that difficult. So for Alpha 0.1, the language will need to support the following: Map name Map layout (defining paths/obstructions) Defining valid directions for the character to go Here's a sample script supporting all of this. I really really really want feedback on it. I haven't slept and the chances of this being idiotic are not slim, though the basic language format was designed with help from a well-rested Dan. Script statements end with a period. The language is, by necessity, object-oriented, meaning everything that isn't an object is an attribute of that object. Objects are the actual "things" of the game. The only ones defined at the start of the script are "Game" itself and "Player". Others, like maps, are defined as their type, and then become objects of their own. For example, the first line of this script will define the name of the game. It begins with a declaration of the object we are using, followed by the attribute we are defining, the keyword 'is' and finally the name itself. So, the way to define any attribute is: <Object> <Attribute> is <Value>. However, when defining several attributes of a single object, one can use commas, in the form of: <Object> <Attribute 1> is <Value>, <Attribute 2> is <Value>, <Attribute 3> is <Value>. For example, the following script segment: Game name is "Simple Test One". Game author is "Jonathan Eisenstein". Can also be written as: Game name is "Simple Test One", author is "Jonathan Eisenstein". Comments (further explanations of a part of the script) are C++ style, following \\, as in: Game name is "Simple Test One", author is "Jonathan Eisenstein". \\ This is the first design of the language. Anyway, here's the first script, demonstrating the requirements above. I've also added a simple NPC and a map type, even though this milestone does not call for it, to demonstrate how the language will look later. -- Game name is "Simple Test One". Game author is "Jonathan Eisenstein". Map Firstmap is in Game. \\ Defining a new object called 'Firstmap' of type Map, located in the game. Firstmap size is (10,10), type is Plains. \\ Firstmap is a grid 10 x 10 squares across, and is of type Plains, which will be defined in a later milestone. Scene Testgame is in Game. \\ Every game has at least one scene. An object can be part of the scene or the entire game. Player is in Firstmap, name is "Jon", origin is (1,5), scene is Testgame. \\ Place the player (only one can exist) at point (1,5) on Firstmap at the beginning of the game. Player movement is type4. \\ Player can move up, down, left and right. type2 is a platformer (left/right) and type8 includes up-left, etc. Obstruction Wall is in Firstmap. \\ Defining a new object called 'wall' of type Obstruction, located in Firstmap. Wall type is "Wall", placed from (3,2) to (3,7). \\ Type Wall will be defined in a later milestone. This places the wall between (3,2) and (3,7). |