|
|
A scripting language was one of our earliest and most revolutionary concepts. The idea was that each city and piece could have an optional "script" that it could follow automatically. Each player could also have a script superceding all other scripts automatically activated at the beginning of each day. Players could choose to play without any scripting (as in the current version), program EVERYTHING and sit back and watch, or anywhere in between. Perhaps the program itself would follow a master script in the same command language so that an advanced player could edit it in order to change the rules or improve the competition. And the computer opponent could also follow an editable script. These scripts could be attached in an object-oriented fashion to cities, continents, and oceans. They could detect bomb-events to automate the re-conquering of a bombed-out city. Instead of putting a piece on patrol, you could enter a patrol script that could be as simple or as complex as you want. City scripts could carry out complex long-term production schedules and automatically send new pieces to the front. One fighter on each carrier could be automatically directed to hunt for subs. A destroyer could carry out a long-range mapping mission automatically. The possibilities were endless. We never fully defined this scripting language, but we got far enough along to expose some of the complexities and possibilities. This page collects our discussions under various key areas to form kind of a proto-manual for this ambitious programming language.
Language Elements Language ElementsLanguage elements describe the commands and functions of the language. We wanted the language to do anything the player could do and also refer to the environment using high-level words like "shoreline" and "nearest." Additional commands would make it possible to sound an alarm or ask the player for a decision by putting up a dialog box. The language would refer to the definition tables by using standard property names (e.g. "If FUEL<12 then move to nearest city").Paul got the ball rolling at the outset of our dialog by defining some of the basic elements. Unfortunately, we never got much farther than this. Conquest Programming Language (CPL?): I have a few very preliminary and incomplete pieces of the language:
Sample ScriptsOur intention was to create scripts for all the standard menu commands. We came up with an initial list of the menu commands, but only attempted a script for one of them (patrol). We also imagined some other sample scripts that might be attached to individual pieces.
clear movement code of current piece
OTHER SAMPLE SCRIPTS:
Explorer Script (attached to Destroyer Miami 12)
Script of City London
Patrol Script (attached to fighter Chigaco 27) -- a slight variation Data DictionaryThe DATA DICTIONARY provides definitions of important data items and relationships.OBJECT IDENTIFIERS
Definition TablesThe idea behind definition tables is that the behaviour of all pieces would be governed by a table of values. The Command Language would refer to the table in making movements so that players could change the game by simply modifying the table. Also, some values could change dynamically under certain conditions for added flexibility. Paul has also suggested providing a different table for each city to provide more variation (John fears this would be complicated and difficult to implement).Concern: Does the flexibility of allowing startup-time modifications to piece characteristics complicate strategies to the point that successful general-purpose computer opponents cannot be written? To state the issue in another way, Is it possible to determine the merits of a piece by examining its definition table? If not, we must severely restrict the customization of definition tables. Ideally, the set of properties included in the table would define all possible pieces in an elegant fashion. Here is Paul's initial set of properties:
Additional properties:
In addition, each piece will require an individual set of properties
NamesContinents, Oceans, and cities should be given names. Upon encountering a new city, computer will ask player to provide name but will automatically suggest a default.Question: Will confusion arise if two human opponents are allowed to provide a different set of names? Answer: Each opponent must not be allowed to see names assigned by his enemy. The proposed default naming convention implicitly provides strategic information about production and logistics. Therefore, each human opponent _must_ have a private naming table. Neutral internal names will also likely prove necessary. This suggests an interesting scenario: A script refers to a piece by name. The player renames the piece. The player then gives another piece the first name. What happens when the script is next executed? Solution: The "neutral internal names" will be immutable, and will be referred to as ID's. The player-assignable names only will be referred to as NAMES, and may be changed at will. The scripting language must allow the use of either. It is not yet clear how to define the boundaries of oceans. Should individual ships have names? It is clear that we are trying very hard to define an object-oriented game. In that light, I believe that ALL objects should have unique, unambiguous names. FURTHER DISCUSSION (JOHN 11/18/89): This naming is a tricky business and also a critical one. It is necessary to use names in scripts in a very general way so that the same scripts can be used from one game to the next. It is also necessary to refer to objects from inside repeat loops. Perhaps we should imitate HyperCard. HyperCard assigns THREE different names to each object. First, the object can be given a name, like "Chicago". This is OPTIONAL. Second, the object is given a sequential number, which CAN be modified by the user. Thus we could refer to city 5 of continent 12. Such a labeling system is essential for structures like repeat loops. In HyperCard the order of object numbers determines which object is "on top" of the other. In our game, the order could determine who goes first in the movement list. If these numbers are frequently changed, it becomes important to refer to specific cities in scripts by name or ID number. Third, the object is automatically assigned a unique ID Number. Labeling continents and cities poses no special problems, but labeling moving pieces is more difficult. I PROPOSE that we adopt the following system for assigning automatic ID Numbers:
Continent 12 = "America" In this case, a script could refer to the "Red Baron" in any of the following ways:
When a descriptive number appears without quotes it is assumed to be a sequence number (as in the final example). These sequence numbers are VERY tricky. I PROPOSE that sequence numbers be assigned AT THE BEGINNING OF EACH MOVE. Thus fighter 3 of continent 8 refers to the third fighter located in continent 8 AT THE BEGINNING of the move, even if that fighter is currently located over open sea. If the fighter finishes his turn still over ocean 17, then in the NEXT turn he will be referred to as fighter 6 of ocean 17. The language will need to provide several counting functions for both beginning of move and CURRENT situation. The word "CURRENT" could signal the difference. Thus "Number of fighters in continent 8" would refer to the number at the beginning of the turn, and "CURRENT Number of fighters in continent 8" would refer to the number of fighters at the moment the line was executed. I provide the following script as an example: repeat with j=1 to number of continents repeat with k=1 to number of fighters in continent j if current number of fighters in continent j>2 then move fighter k of continent j 10 units east end if end repeat end repeat Of course, both naming systems can be used in the same line, as in "move fighter k of continent "America" 10 units east." Also fighters can be inside cities and continents at the same time so that fighter 7 of "America" could also be referred to as fighter 3 of "Chicago". The same applies to armies inside transports and fighters who begin their turns on carriers. And variables could always be used in place of literals. The algorithm used to assign sequence numbers at the beginning of each turn should be written in a script at program level and thus subject to modification by advanced users. Perhaps 2 or 3 different standard ordering algorithms should be available at the click of a button. And the numbering system could be changed at any time by a user or script with some kind of "Increase Priority" command. Players can also use custom scripts to affect the order of play, moving all fighters at once, or all pieces in "America", or all armies ever produced at Chicago.
This naming system is very flexible and makes all sorts of wild scripts possible.
EventsEvery script attached to an object is triggered by an event. The events percolate upward through the object hierarchy, starting with pieces and cities, then up to the continents or oceans that contain those pieces, and then up to a general world script. Any event that is not dealt with by a user script then passes to the default scripts that comprise the game itself. These default scripts can only be edited by advanced users before a game begins.Normally, if a user wants to change the effects of a given event he will simply "intercept" it by creating a script triggered by that event. He can intercept all menu commands by invoking the MENU event. Each event has a name, and the event can be passed on up the heirarchy or sent to other objects. In addition to the standard events, a user can create his own events at any time by invoking them from within a script. Following is a preliminary list of possible events:
Pathsjohn1993-10-26:
I am beginning to suspect that our notion of patrol paths might prove to be a very potent concept.
We have already discussed using moving patrol paths to achieve automated escorts. I
think patrol paths could also be used to generalize the notion of city
destinations. Actually, we shouldn't call them patrol paths, but simply paths.
Maybe we could find a way to add programmable branches to paths; if so, we
could actually control much complex behavior by simply drawing paths and
attaching pieces to the paths. This could become a kind of visual programming
language.
Messagespaul1994-10-28:Remember this thread of yours? Whenever we click and drag a piece, the game could automatically generate and store away a text "radio" message equivalent. I like this, not the least because it is "object oriented" ;-) These messages would be produced transparently and invisibly in the background and would serve two functions... I propose broadening the scope significantly; these messages should become a fundamental part of the architecture. We'll develop an object hierarchy (is this a new idea? I think so). What's an Alexander object? Each piece is an object; each city is an object; maybe each continent is an object; maybe each player is an object. And there may be others... So how would this be applied? Here's a rough example. Let's say a city is building armies. When created, the city sends a message to the new army: "Go to coordinates thus-and-so, and guard the coast." When the army arrives, it might send a message back to the city: "I'm in position." Or maybe it would just report interesting activity: "I'm being attacked by armies on a transport!" Maybe it could be sneak-attacked and killed under certain circumstances, without getting a warning out. Maybe every message sent by a piece would increase its probability of detection... (This last idea is very similar to one proposed by you.)
This idea, extended, could significantly alter many aspects of the game,
including detection: Maybe detection would become a probability rather than a
certainty - the more messages, the more likely that a nearby piece would be
detected. Hmm... interesting, if nothing else.
Enforced Automationjohn1996-06-19:One of the central problems even with the current game is that it takes too long to play. As the pieces pile up and spread across the globe it can take ten or fifteen minutes just to make a single move. One radical approach is enforced automation: limit the number of pieces a player can "interfere with" in a given move. (I think you may have proposed something like this at one point.) The theory is that even the most sophisticated central command can't make all the decisions and must sometimes rely on soldiers in the field to think for themselves. Each day of the war, a player makes a limited set of decisions and moves on so that the games moves at a brisker pace and ends sooner. In order to make this work we would have to provide easy to use yet sophisticated automatic capabilities for all pieces. Some of the features would include:
This is obviously a can of worms, and may not be entirely feasible. The goal is to provide a set of behaviors rich and varied enough so that players could feel comfortable in leaving most of their troops on automatic pilot most of the time. Ideally we would provide a range of complexity ranging from a pick list of "canned" behaviors to full-fledged programming. |