• No results found

How to Integrate Domain-Specific Languages into the Game Development Process

N/A
N/A
Protected

Academic year: 2021

Share "How to Integrate Domain-Specific Languages into the Game Development Process"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

How to Integrate Domain-Specific Languages into the

Game Development Process

Robert Walter

University of Duisburg-Essen Forsthausweg 2 Duisburg, Germany

[email protected]

Maic Masuch

University of Duisburg-Essen Forsthausweg 2 Duisburg, Germany

[email protected]

ABSTRACT

Domain-specific languages make the relevant details of a do-main explicit while omitting the distracting ones. This im-plies many benefits regarding development speed and qual-ity as well as the exchange of information between expert groups. In order to utilize these benefits for game devel-opment, we present a language engineering workflow that describes best practices to identify a reasonable domain ab-straction, illustrated by means of a language for 2D Point &Click Adventures. We discuss how this process can be integrated into an agile, iterative development process and what thereby needs to be considered.

Categories and Subject Descriptors

D.2.2 [Software Engineering]: Design Tools and Tech-niques; D.2.11 [Software Engineering]: Software Archi-tectures—domain-specific architectures, languages; D.2.13 [Software Engineering]: Reusable Software—domain en-gineering

General Terms

Languages

Keywords

Domain-specific language, model-driven software develop-ment, language engineering, game development

1.

INTRODUCTION

The development of digital games is a multi-tier, creative process in which experts from different disciplines (Art, De-sign, Writing, Programming, Acting, Music, etc.) need to join forces. Hence, game development combines the artistic challenges of multimedia productions with the engineering challenges of IT-productions [11]. Thereby, developer stu-dios strive to create something unique (be it a new art style,

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee.

Short presentation, ACE’2011 - Lisbon, Portugal Copyright 2011 ACM 978-1-4503-0827-4/11/11 ...$10.00.

a new gameplay experience or feature, a new way of story-telling, or a combination of these elements) to distinguish their game from others. In order to succeed and to control this process, more and more game studios apply agile devel-opment methodologies like Scrum and work highly iterative [5, 10, 15]. A crucial phase within this development cycle is the translation of defined game design elements into the actual game implementation. The quality of the game ex-perience depends on how well the art style, gameplay, and story can be captured within the game.

In this paper, we introduce domain-specific languages

(DSLs) as a tool to support the transition of game design to implementation. As a foundation, we briefly introduce DSLs in general. We discuss related research approaches that introduce generic DSLs and the usage of language work-benches for game development to contrast them with our approach of a language engineering workflow for game de-velopment. We present the workflow tier by tier and illus-trate each step by means of an example language for 2D Point&Click Adventures. In doing so, we show how the lan-guage engineering process can be embedded in the game design process, fostering communication between designers and developers inside the problem space. In the concluding section, we discuss how DSLs can be integrated into an agile game development process, fostering iterative processes like Rapid Prototyping and Extreme Programming. Thereby, we likewise elaborate the occurring chances and challenges. We close this paper with an outline of upcoming tasks.

2.

DOMAIN SPECIFIC LANGUAGES

DSLs have a long history in software engineering and have been implemented for various use cases [22]. In recent years, they have become more established, due to the success of model-driven software development (MDSD). In order to have a common understanding of what a DSL is, we start with the definition by Fowler [8]:

[A DSL is]a computer programming language of limited expressiveness focused on a particular do-main.

The purpose of a DSL is to let users write computer in-structions in a more natural way. Compared with general purpose languages (GPLs) like C or Java, DSLs provide a limited vocabulary and almost no control structures. In short, a DSL features exactly the elements necessary to de-scribe its domain, which makes it easier to learn and less expressive than a GPL. Like GPLs, DSLs provide a formal

(2)

syntax. Hence, a domain-specific program1 (DSP) can be

processed automatically, for example with an interpreter or generator.

DSLs are commonly subdivided intointernalandexternal

DSLs [8]. An internal DSL is embedded in a GPL, merely using a limited set of the features of the GPL. Hence, in-ternal DSLs do not have an individual grammar and thus do not need a distinct tool set to be processed. As a con-sequence, an internal DSL is bound to the grammar of its host language, which constraints the flexibility in syntax de-sign. A good example for an internal DSL is incorporated in the Google Guice framework2. It provides a language-like Java API to utilize the dependency injection pattern [6]. The most common way to define an internal DSL is through combined methods (functions, or procedures, depending on the host language). Listing 1 illustrates theMethod Chain-ing Pattern [8] to create an internal DSL. Using Guice, a “service” interface is bound to a “service” implementation as a singleton. Note that this is plain Java code.

1 b i n d ( S e r v i c e .c l a s s) 2 . to ( S e r v i c e I m p l .c l a s s) 3 . in ( S c o p e s . S I N G L E T O N ) ;

Listing 1: Internal DSL example (Method Chaining Pattern)

Internal DSLs exploit the advantages of language-like pro-gramming APIs. Hence, internal DSLs address exclusively target groups with an at least basic programming back-ground. In the game development context, we consider inter-nal DSLs as a useful technique to simplify development pro-cesses, since many domain experts (Game Designer, Sound Engineer, etc.) have a technical background and thus—even if they are not intended to use internal DSLs to develop game logic—are able to understand corresponding programs. We examine this in Section 5 in more detail.

External DSLs are self-contained languages. This means, that they feature a distinct grammar. Due to that, an ex-ternal DSL can be tailored exactly to the requirements of the domain, using semantically meaningful keywords and grammar rules. Similar to GPLs, a program written in an external DSL is processed in the form of an abstract syntax tree (AST). As a consequence, one needs to define proper processing tools in order to use an external DSL. The cre-ation of such tools is increasingly supported by language workbenches [7] like Xtext [3] or MPS3. Popular examples

for external DSLs are regular expressions and SQL. Aside from their environment, DSLs differ in their tech-nical orientation. The internal DSL integrated in Guice, for example, is atechnical-oriented DSL. It utilizes the de-pendency injection pattern, which can be used for arbi-trary application development. SQL is an example for a technical-oriented external DSL. Altogether, we categorize DSLs that abstract a technical problem space as technical-oriented DSLs (compare [12]). DSLs of this category triv-ially address target groups with programming skills. In contrast, application- and business-oriented DSLs comprise languages that describe non-technical domains. For

exam-1We introduce the term domain-specific program to refer to

a program written in a DSL.

2http://code.google.com/p/google-guice/

3

http://www.jetbrains.com/mps/

ple, Inform4, currently in its seventh installment, features

a declarative DSL with a very natural language to create interactive fiction applications. Inform 7 first and foremost addresses writers, newcomers as well as professionals, who need no programming experience to create an interactive fiction application.

1 I n s t e a d of g o i n g n ow h er e , say " The p r a i r i e 2 s t r e t c h e s s e e m i n g l y f o r e v e r in all d i r e c t i o n s . "

Listing 2: Rule description in Inform 7 Some DSLs might blur the boundaries between techni-cal and non-technitechni-cal DSLs. However, we presented this differentiation to underline the linear relation between the technical orientation of a DSL and the technical experience of its target group. We will refer to this in sections 4 and 5. Before we discuss available approaches of DSLs in game development in the next section, we would like to draft an exemple scenario to make their application value more vivid: Think of a DSL for branching dialogues, which is tailored to a game writer’s needs with the corresponding tooling tai-lored to a game studio’s technical and procedural require-ments. Thus, the game writer (the domain expert) can de-velop the dialogues within a natural environment. All sub-sequently depending artifacts, like actor scripts sorted by character for audio recording, the necessary data format for the story engine, or a dialogue tree representation, can then be derived at least semi-automatically with the aid of proper generators. The artifacts written by the game writer become the common source and documentation for the dialogues of a game, which makes the propagation of changes very sim-ple. It is also possible to integrate semantic constraints into the language, so that dialogues fulfill individual system re-quirements by definition (e.g. define that the name of a speaking character is always stated in capitals in the final game). The manual integration processes of dialogues into a game, which are often nothing but time-consuming, error-prone copy/paste tasks, would no longer be necessary.

3.

DSLS IN GAME DEVELOPMENT

Scripting languages like LUA or Python play an important role in game development. Despite their comparably small syntax, they are not DSLs, since they are not created to define a distinct problem space and therefore are not further examined in this paper.

Besides the already mentioned language in Inform 7, the Text Adventure Development System5 (TADS) features an-other language for the definition of interactive fiction games. The MOO language6and LPC7are similar languages to cre-ate multi-user dungeons (MUDs). What these languages have in common is that they are platform-specific languages for a distinct genre, i.e. they are dedicated to their corre-sponding target platform and characteristic gameplay. The <e-Game> project [14] also fits into this category. The de-velopers pursued a documental approach which uses a XML-based markup language to enrich storyboards for educa-tional adventure games. This means that game writers can

4 http://inform7.com/ 5 http://www.tads.org/ 6http://www.moo.mud.org/moo-faq/ 7 http://lpmuds.net/

(3)

enhance a storyboard with semantically meaningful mark-ers which are then processed by the corresponding engine. At first glance, this might sound closely related to our pre-sented work, especially since we use a DSL that describes a similar genre as an illustrating example. However, there are several fundamental differences that we would like to point out. First, <e-Game> is aninstancethat shows how an ex-ternal, non-technical DSL can be applied in a distinct game development context. We may use a similar language, but only for the purpose of illustrating our actual work, namely a language engineeringworkflow that describes how devel-opment studios can incorporate an arbitrary DSL into their existing development process. In addition, as the transition from the <e-Game> project to the <e-Adventure> author-ing environment [21] underlines, the documental approach targets to enable one specific, non-technical expert group (game writers) to create small but runnable games within a distinct genre. This is especially interesting in a context like prototyping or authoring for serious games (e.g. e-learning games). We, in contrast, examine the advantages and dis-advantages of DSLs in a broader scope (covering also the application of technical-oriented and internal DSLs) with the focus of integrating them into existing professional de-velopment processes.

Another commonly pursued approach is to create a DSL that enables the formal description of games on a very high level of abstraction, with the intention to make it applica-ble for a broad range of games. In [18], Reyno and Cubel introduce an approach to specify gameplay with a platform independent model. They ground their work on game def-initions by Salen and Zimmerman [20], Djaouti et al. [4], and others. Their central objective is to replace gameplay descriptions written in natural language with a platform-independent model in order to be able “to define and com-municate gameplay at a high level of technical abstraction”. Their approach might be reasonable in the very early stages of gameplay modeling. However, we consider it not practica-ble. In order to cover as many of the individual requirements of every game studio respectively of every game as possible, these languages become very generic and thus less precise. It is also unclear how the models are meant to be processed. In contrast, we pursue the goal to let developer studios create individual languages tailored to their particular demands in an efficient, effective and flexible manner.

Another approach by Reyno and Cubel is presented in [19]. The authors introduce both platform independent as well as platform specific meta-models to formally describe 2D platform game prototypes. The provided UML models offer an abstract syntax for the given context. However, the authors do not provide concepts for a concrete syntax, which is necessary to utilize the models for a target group.

An approach that combines a software factory with visual DSLs and generators to create adventure games is presented by Furtado and Santos [9]. They provide a “Game Mo-deling DSL” as well as a “HUD Creation DSL” to specify an adventure game. They developed the DSLs according to a methodology presented in [22]: analysis,implementation

(which they enhance by two additional tasks), anduse. In [13], Maier and Volk discuss language workbenches in order to facilitate language-oriented game development. They argue that language workbenches reduce the set-up costs for software factories as well as the development time of games.

In contrast to [18, 19, 9], our approach does not intro-duce a generic language for game development. In con-trast, we understand the term domain-specific in a more narrowed down scope. We think that the agile nature of game development in combination with the individuality of every developer studio requires languages that fit into their very specific environment. Hence, our language engineering workflow—along with language workbenches or other tools of choice—aims for a feasible and flexible creation, optimiza-tion, and application of DSLs, integrated into an iterative development process. It could be argued that this approach contradicts with the idea of language reusability and would therefore lead to a tremendous amount of languages, making it inapplicable. However, our workflow does not imply that created DSLs might not be reused in subsequent projects. But, as we describe in sections 4 and 5 in more detail, we consider reusability to be a natural and organic process that evolves with the growing experience of developers working with DSLs and therefore does not need to be fostered arti-ficially.

While we conform to the findings in [13] regarding the benefits of language workbenches, our approach is knowingly independent from the way a DSL tool set is built, which means that the tools (e.g. parser, generator, editor) can be implemented manually, with the help of a parser generator [17], as well as supported by a language workbench.

4.

LANGUAGE ENGINEERING

WORKFLOW

In order to facilitate the process of designing a DSL and af-terwards creating the corresponding tool set, we established a flexible yet stable bottom-up workflow (Figure 1). It can be used to define any kind of DSL (internal and external) with any degree of technical orientation.

DOMAIN SPECIFIC PROGRAMS OUTPUT ABSTRACT SYNTAX language definition CONCRETE SYNTAX REFERENCE

OUTPUT REFERENCEMODEL

reference artifacts

DSL

REQUIREMENTS GENERALCRITERIA RELATED WORK PROCESSING RULES DOMAIN CHARACTERISTICS <<determine>> <<conform to>> <<instantiates>>

Figure 1: DSL Engineering Workflow It is important to understand the positioning of the flow in context of the game development process. The work-flow comprises three plus one tiers. The three lower tiers rep-resent the actual language engineering process. This process becomes part of the game design phase. This means that, in an iterative process where the game design is refined step-wise, the used DSLs might also be refined to fit the new

(4)

requirements best. As we outline in Section 4.3, DSLs can even be used as a tool for refining game design. The top level tier of the workflow illustrates the interface to the im-plementation or prototyping phase.

In the following subsection, we introduce two roles that have to participate in our language engineering process. Sub-sequently, we describe the workflow tier by tier. To illustrate every tier, we created an external DSL which allows game designers to describe and prototype a 2D Point&Click Ad-venture in a very natural (yet formal) way. Note that this language only serves as workflow illustration. It does not define how 2D Point&Click Adventures should be defined in general. For the language tool set, we used the Xtext lan-guage framework in combination with the Modeling Work-flow Engine (MWE, [1]) and the Xpand template language [2]. The DSPs created in the language are finally translated to a runnable XNA game.

4.1

Roles

In [12], the author distinguishes between language user

(“the person who simply uses a software language to create an application”) and language engineer (“the person who creates software languages”). For our game-oriented work-flow, we consider these two roles to be more tightly inter-twined and therefore propose another assignment of roles.

GENERATOR/ INTERPRETER EDITOR ANALYZER DEBUGGER FRONT-END BACK-END

Domain Expert Language Engineer

Figure 2: Role Assignment of DSL Engineering

Workflow

First, we definedomain expertas a person with extensive domain knowledge and expertise. The domain expert is in charge of identifying and defining the entities and semantics of the domain. Depending on the target platform and fur-ther processing of the DSPs, the domain expert might also participate in designing the back-end of the tool set. How-ever, he or she is not in charge of developing any tools for language processing. For this responsibility, we redefine lan-guage engineeras a person with extensive knowledge in lan-guage design and tool creation for various environments and purposes. Common tools that have to be built for working with a DSL are editors, transformers, executors and analyz-ers (compare [12]). Depending on the scope of the domain, it is reasonable that more than one domain expert or lan-guage engineer participate in the lanlan-guage engineering pro-cess. Furthermore, the described tasks of a domain expert could be sub-divided in front-end and back-end tasks. This means that there is a front-end domain expert, for example a

game writer, who defines the features of a story-writing lan-guage. A first back-end domain expert, a developer of the story engine, covers the design of the intended outcome and further processing, while another back-end domain expert, a professional voice actor, determines which information is necessary for their work. The language engineers take this information and synthesize it in a language definition and a corresponding tool set.

4.2

DSL Requirements

When defining a new language, the workflow starts with the definition of the language requirements. The require-ments are determined by domain characteristics, which means that we need to find a proper abstraction of the domain. The domain characteristics should at least comprise the cen-tral domain entities and cencen-tral terms with clearly confined semantics for the given domain. As described in Section 4.1, this process should be led by domain experts. Lan-guage engineers should interpret their role in a predictive, hence moderating way during this phase in order to create both a sound domain outline and a solid foundation for the forthcoming tasks. In addition, general criteria, like general language development guidelines we used in our develop-ment (see Table 1), also influence the DSL requiredevelop-ments. As the bidirectional relationship between the DSL require-ments and the reference model points out, we propose a small iterative process between these two artifacts. Thus, the DSL requirements are meant to capture the domain so that both domain experts and language engineers are aware of the vocabulary, purpose, scope, and target group of the domain.

For the Adventure DSL example, we initially identified ba-sic entities to describe the visible structure of 2D Point&Click Adventures.

Room describes a self-contained area which can be entered and left by the playercharacterthroughdoors; it is illustrated by a background image and contains (optional) background music as well as an arbitrary amount ofobjects andcharacters.

Doordescribes a portal to change theroomin which the playercharacteris; a door has a position, always belongs to two rooms, is either in state “opened” or “closed”, and thus has at least two sprites to illustrate the corresponding state.

Character describes the playable and non-playable characters in the game, illustrated by at least one sprite; a character is always assigned to exactly one room and one position at a time.

Object describes useable and non-usable objects in a room; an object is also illustrated by at least one sprite, assigned to a distinct room and a position.

Inventorydescribes a virtual place in which the player manages all collected objects.

Action-Verb Menudescribes a set of interaction pos-sibilities the player can apply to objects and charac-ters.

Context Information provides information about the position the player points to.

(5)

Note that this first visual consideration abstracts from technical issues. We deliberately omitted aspects like file formats and game resolution in order to shape an indepen-dent domain description. With that in mind, we also defined gameplay related entities.

Taskdescribes puzzles and challenges the player faces during the game.

Goaldescribes a state the player has to reach in order to gain further progress.

Constraint checks if goals are achieved in order to describe causal relationships between tasks.

Actiondescribes an action that has to be performed by the game; it is either triggered by the player or by the game.

Dialoguedescribes verbal interaction between the pla-yer character and non-plapla-yer characters.

Again, we omitted issues like character movement or dia-logue implementation since they are of no concern for game designers.

As mentioned, we enhanced our DSL requirements with language engineering guidelines taken from [12]. In addition, we considered two criteria of the software-ergonomic princi-ples of system design, stated in EN ISO 9241-110, namely

self-descriptivenessanderror tolerance.

Principle Description

Simplicity An easy-to-learn language is easy to use Consistency Choose a suitable design and hold [on] to

it

Flexibility Give the user flexibility in how to formu-late a DSP

Homogeneity Show related concepts in the same way, and keep them together; show unrelated concepts differently and [separately] Color Use color sparsely

Testing Test the language design on language users Table 1: Language Engineering Guidelines Based on these DSL requirements, we developed a refer-ence model and a referrefer-ence implementation as described in the following subsection.

4.3

Reference Artifacts

We define two ephemeralreference artifacts that have to be created in the second engineering tier. The intention is to find an exemplary instance of the front-end (→reference model) and the back-end (→reference output) of the tool set. It might well be reasonable to create more than one reference artifact each in order to cover all DSL requirements.

4.3.1

Reference Model

The reference model is an example program written in the intended language. The central issue is to think of a representation that covers all DSL requirements in a tar-get group-oriented way, which makes this a very front-end-oriented process. Thereby, the reference model serves as communication platform between domain experts and lan-guage engineers in order to combine and manifest their ex-pertise in the reference model and thus in the final tool set.

In other words, the reference model is the vehicle to map the DSL requirements to the concrete syntax of the language. Again, the language engineers should moderate the creation of the reference model, always keeping the back-end in mind. We also used the reference model as a brainstorming tool and propose to incorporate this into the game design pro-cess when working with DSLs. The task of finding a repre-sentation that separates a game concept from its technical realization in a multi-expert group implicitly leads to a re-consideration of existing design ideas and might even create new approaches.

Listing 3 shows a reference model excerpt for our Ad-venture DSL. First, a room named cafeteria is created. Its background image is defined by a relative path to an image file and its background music by a path to a sound file.

1 The c a f e t e r i a is a r o o m . 2 Its b a c k g r o u n d is " S p r i t e s / c a f e t e r i a . png " . 3 The b a c k g r o u n d m u s i c of the c a f e t e r i a is " S o u n d s / c a f e t e r i a . wav " . 4 5 The f o r k is an o b j e c t . 6 Its i m a g e is " S p r i t e s / f o r k . png " . 7 Its p o s i t i o n is ( 4 0 0 , 3 0 0 ) . It c a n n o t be p i c k e d up . 8 Its d i s p l a y n a m e is " A d i r t y f o r k " . It is in the c a f e t e r i a .

Listing 3: Reference Model Excerpt (a) Afterwards, a fork is defined as an object. It is placed in the cafeteria at a distinct position with the initial property that it cannot be picked up by the player.

In order to provide a simple language, we defined short, clear sentences (Simplicity). The user should be able to re-fer to the last created element using possessive (“Its”) and personal (“It”) pronouns, but it should not be mandatory (Flexibility). As illustrated in lines 2–3, for example, related concepts are expressed in related ways (Homogeneity). An issue that we discuss in Section 5 in more detail is the ar-rangement of objects and characters using a mere textual language. So far, we use Cartesian coordinates (compare line 7) for positioning. Listing 4 shows another excerpt from the reference model.

First, the characterProfessor Einstein is created. Note that, compared to the previously defined fork, the room and the position of the character are arranged differently, which shows another instance of flexibility in the language.

1 P r o f e s s o r E i n s t e i n is a c h a r a c t e r . 2 His d i s p l a y n a m e is " P r o f . E i n s t e i n " . He is in the c a f e t e r i a . 3 His i m a g e is " S p r i t e s / e i n s t e i n . png " . His p o s i t i o n is (200 , 3 0 0 ) . 4 5 D i a l o g u e w i t h P r o f e s s o r E i n s t e i n :

6 1 " Hello , how are you ? " - " I ’ m h u n g r y ! " - E i n s t e i n is h u n g r y

7 1.1 " Me too . " - " Let ’ s f i n d s o m e t h i n g to eat . " 8 1.2 " Sorry , I h a v e n o t h i n g to eat . " - " Bye bye . " 9 2 " Sorry , I h a v e to go . "

10 The d i a l o g u e e n d s h e r e .

Listing 4: Reference Model Excerpt (b) Starting with line 5, a dialogue with Professor Einstein is defined. Each dialogue line starts with a numeric identi-fier, followed by an option–answer–information tuple.

(6)

De-pending on the option the player chooses in the game, the corresponding NPC answer is supposed to be triggered and an information is received, if available. The corresponding lower-level dialogue lines are triggered subsequently. Thus, dialogue trees can be defined. The dialogue ends with the statement in line 10. The structure for writing dialogues that way was developed in an iterative process. Initially, we had no intention to provide branching dialogue since we thought that this would be inconsistent with the idea of a simple language. Creating and refining the reference model stepwise, however, led to the presented structure, which no-ticeably enriches the gameplay options.

We also utilized the verb-object design paradigm—well-known from several Lucasfilm Games like “Maniac Mansion” or “The Curse of Monkey Island”—as illustrated in Listing 5.

1 P i c k up f o r k ( E i n s t e i n is h u n g r y ) : 2 Say " I won ’ t t a k e t h a t fork , it ’ s d i r t y . " 3 E i n s t e i n s a y s " H a n g on , I ’ ll c l e a n it for you . " 4 The f o r k can be p i c k e d up . 5 Its d i s p l a y n a m e is " A c l e a n f o r k " . 6 F o r k g o a l a c h i e v e d . 7 P l a y " S o u n d / g o a l a c h i e v e d . wav " . 8 The a c t i o n e n d s h e r e .

Listing 5: Reference Model Excerpt (c) In the first line, the combination of pick upand fork is declared as a possible action, only available if the player has gathered the information that Einstein is hungry. Af-terwards, it is defined what happens in the game when the player tries to perform the action. So far, the language provides a set of pre-defined action-verbs. Furthermore, the user is able to define own action-verbs whose semantics must also be provided by the user in the generator templates.

After this action in Listing 5, the fork is no longer dirty and the player can finally pick it up as defined in the last reference model excerpt (Listing 6).

1 P i c k up f o r k ( e n a b l e d ) :

2 Say " Thanks , E i n s t e i n , you m u s t h a v e b e e n r e a l l y h u n g r y ! " .

3 The a c t i o n e n d s h e r e .

Listing 6: Reference Model Excerpt (d)

4.3.2

Reference Output

In general, DSPs can be processed in two different ways (compare [12], [8]). It is either possible to execute a DSP directly with a dedicated interpreter or to process it with a generator, for example to generate code or configuration files.

In case of generation, the reference output has to rep-resent the desired generated artifacts corresponding to the reference model. In case of interpretation, the reference out-put has to mirror the desired results and actions described in the reference model. The reference output has to be de-fined for every target platform and every reference model. That way, the language engineers can derive the process-ing rules necessary to fill the gap between both abstraction layers. Actually, the gap correlates to the applied degree of abstraction in DSL. In other words, the processing rules have to add the target platform-relevant details that are omitted

by the corresponding DSL.

In the Adventure use case, we decided to use Microsoft’s XNA Game Studio as the target platform. Hence, we cre-ated a 2D Point&Click Adventure game, implemented in C# within the XNA framework that corresponds to our refer-ence model. Although with limited scale, the game contains all features both the DSL as well as the generator are in-tended to provide.

4.3.3

Related Work

In most cases, there exists related work that can help de-fine the reference artifacts. This can address approaches the target group uses in its daily business. For example, game writers often organize dialogue lines in tuples, using IDs to tag and refer to these tuples. We mapped this structure to our reference model and finally utilized it in the adventure language. Regarding the reusability aspect, related work can also refer to similar DSLs created for a former project, which can expedite the language engineering process very much.

4.4

Language Definition

The language definition is directly derived from the refer-ence model. The language engineers have to identify syntax rules and static semantics based on the reference model. Depending on the technology used to create the language tool set, small adaptions—in comparison to the reference model—are inevitable. However, the language engineers should always confer with the domain experts in order to find an adequate solution. Despite the fact that the language is created in a target group-oriented process, we propose to create rich tool support. Language workbenches support the creation of smart editors, which, for example, feature syn-tax highlighting, text completion, and synsyn-tax analysis by default.

Just like in GPLs, the abstract syntax is the structural de-scription of a DSL. In its representation as an AST, a DSP can be processed by a parser. The user, however, writes DSPs in a concrete syntax, using defined keywords in a dis-tinct notation. The concrete syntax can therefore be seen as an instance of the abstract syntax. This means that it is possible to create several concrete syntax definitions for the same abstract syntax, for example a visual and a textual representation.

We used an EBNF8-similar language, provided by Xtext,

to define one concrete syntax. Based on this artifact, Xtext creates the abstract syntax as well as a default language editor with syntax highlighting, code completion and other features automatically. Figure 3 shows an excerpt of the reference model written in the final language.

We applied minor changes compared to the reference mo-del. Our language does not support multi-word identifiers like Professor Einsteinor Einstein is hungry. Although it would be possible to provide such identifiers, it would neg-atively affect cross-referencing and code generation. Hence, we decided to only support standard identifiers which might slightly affect the readability of the language.

However, we managed to incorporate the usability as well as structural requirements defined in the reference model in our current language. Thus, our language provides the definition of rooms, characters, doors, objects, action-verbs,

8

(7)

context information as well as tasks, goals, constraints, ac-tions and branching dialogue, to name the main features.

Figure 3: Example Written in Adventure DSL

4.5

Processing Rules

In case of code generation, processing rules determine how the input model (DSP as AST) is transformed into another form. The output is simply a set of files, for example C# code. In case of direct interpretation, the interpreter rules determine how a DSP command is executed. This means that the type of output can be manifold, ranging from vi-sual responses in the game world to internal data alteration. In both cases, the processing rules have to close the gap between DSL and target platform. To illustrate this, we provide an example in the next paragraph.

An Adventure DSP is transformed to an XNA game by the Xpand generator. A DSP is therefore first translated into its AST form by an ANTLR9 parser. The parser is created by the Xtext framework automatically. The transformation rules for the Xpand generator have to be provided by gen-erator templates. An Xpand gengen-erator template contains three kinds of information: (1) AST-invariant text, which is always exported in the same way; (2) Wildcards, which are replaced during the generation process with information gathered from the AST;(3)Commands and techniques (con-ditions, loops, polymorphism, functional extensions, aspect oriented programming) to control the generation process de-pending on the content of the DSP. Listing 7 illustrates some Xpand code. 1 ... 2 // Add R o o m s to r o o m L i s t 3 <<F O R E A C H s t a t e m e n t s . t y p e S e l e c t ( R o o m ) AS r o o m>> 4 r o o m L i s t . Add ( new R o o m ( "<<r o o m . b a c k g r o u n d . p a t h>>" ) ) ; 5 <<E N D F O R E A C H>> 6 ...

Listing 7: Xpand Template Excerpt

First, an AST-invariant C#-comment is declared. Then, a loop iterates through all rooms that have been defined in the DSP. For each room, an instance ofRoomis added to the

9ANTLR stands for “ANother Tool for Language

Recogni-tion”, see [16]

roomList-object. For example, this template excerpt would

lead to the transformation depicted in Listings 8 and 9.

1 T h e c a f e t e r i a is a r o o m. 2 I t s b a c k g r o u n d is " S p r i t e s / c a f e t e r i a . png ". 3 T h e h a l l w a y is a r o o m. 4 I t s b a c k g r o u n d is " S p r i t e s / h a l l w a y . png ". 5 T h e a t r i u m is a r o o m. 6 I t s b a c k g r o u n d is " S p r i t e s / a t r i u m . png ". Listing 8: DSP Excerpt 1 // Add R o o m s to r o o m L i s t 2 r o o m L i s t . Add (new R o o m (" S p r i t e s / c a f e t e r i a . png ") ) ; 3 r o o m L i s t . Add (new R o o m (" S p r i t e s / h a l l w a y . png ") ) ; 4 r o o m L i s t . Add (new R o o m (" S p r i t e s / a t r i u m . png ") ) ;

Listing 9: Generated C# Code Excerpt The game designer does not have to care about the in-ternal data structure when defining the rooms in the DSP. That is because it is a detail that has been left out when defining the DSL. Moreover, the example points out how software generation can be used to assure high code quality. Language engineers and back-end domain experts can utilize their software architectural knowledge in generators. This way, the same concepts on DSP-level are always realized the same way. This is also especially beneficial for boilerplate code, which is nothing but error-prone.

5.

DISCUSSION AND OUTLOOK

Domain-specific languages have a great potential for game development, but it is important to understand how to un-leash this potential best. Instead of searching for a generic language that describes games or a game genre entirely, we interpret the term “domain” in a more narrow way. On the front-end, DSLs need to be tailored to the demands of the dedicated target group, whilst the back-end needs to fit the individual system requirements. To ensure a positive ROI, however, the problem addressed by a DSL must not be too specific. Hence, we introduced a language engineering work-flow that facilitates the creation of DSLs as part of the game design process. That way, developers are able to create and optimize languages for their specific needs. The created lan-guages are meant to close the gap between the game design and its implementation. DSLs achieve this through different characteristics. First, by definition, DSLs describe a clearly determined problem space. As a consequence, irrespective of the technical orientation of a DSL and hence the tar-get group, DSPs represent a communication platform where designers and developers are able to create solutions using a common vocabulary. For example, an internal DSL can enable developers to write programs that are easy to under-stand for designers with no programming skills.

1 e q u i p ( B a r b a r i a n ) - > w i t h ( B a t t l e A x e ) - > and ( H e l m e t ) ; 2 set ( B a r b a r i a n ) - > in ( A g g r e s i v e M o o d ) ;

Listing 10: Internal DSL example

Vice versa, external DSLs allow designers and developers to describe game logic on a higher level of abstraction. Car-rying this thought a bit further, a new kind of Extreme

(8)

Pro-gramming, where designers and developers implement game elements together, is introduced. DSLs can also foster ag-ile development. Through proper code generation, applied changes can be made visible within seconds. Furthermore, the application of DSLs can increase the development speed and quality over time. Regarding speed, languages as well as generators can be reused, which especially applies for game series. Using code generators instead of repeated manual implementation ensures that a concept described in a DSP is always realized the same way, which ensures a consistent level of code quality. DSLs can also be designed for the pur-pose of Rapid Prototyping. For this use case, it might be feasible to create a more generic language like the presented Adventure DSL or the languages defined in [9].

DSLs also bear some downsides. Like with every new tech-nology, its usage is connected with a training period, that slows down the overall development velocity at the begin-ning. While every studio should have several domain experts who are able to define their domain characteristics, the role of the language engineer is especially hard to cast. This is especially true for external DSLs, where the corresponding tool set has to be created. However, we think that DSLs can show a positive ROI very fast because of the aforemen-tioned advantages. Although we focused on textual DSLs in this work, a DSL might also use a graphical concrete syn-tax. Regardless of the representation form, DSLs cannot and should not be used for the entire game development process. This means that the application fields of DSLs in game development are limited.

In our future work, we are looking forward to evaluate the language engineering workflow on larger projects than the presented Adventure DSL in order to improve it. An-other object of our current research is the usage of internal DSLs for Extreme Programming and Rapid Prototyping in game development. In order to facilitate the agility of the language engineering process, we also examine projection-based approaches to create modular language sets. That way, we expect a higher degree of language reusability.

6.

ACKNOWLEDGMENTS

We would like to thank Katja Neuwald and Robin Meyer for their research and development support and Heiko von Drachenfels for the helpful discussions.

7.

REFERENCES

[1] Eclipse Modeling; MWE reference.http:

//www.eclipse.org/modeling/emft/?project=mwe.

[2] Eclipse Modeling; Xpand reference.http:

//www.eclipse.org/modeling/m2t/?project=xpand.

[3] Xtext User Guide.http://www.eclipse.org/Xtext/

documentation/1_0_1/xtext.html.

[4] D. Djaouti, J. Alvarez, J.-P. Jessel, G. Methel, and P. Molinier. A Gameplay Definition through Videogame Classification.International Journal of Computer Games Technology, 2008.

[5] C. Esmurdoc. Postmortem: Behind The Scenes Of Brütal Legend, 11 2009.http://www.gamasutra.com/ view/news/25799/Postmortem_Behind_The_Scenes_

Of_Brutal_Legend.php, last access: 04.02.2010.

[6] M. Fowler. Inversion of Control Containers and the Dependency Injection Pattern, 2004.http:

//martinfowler.com/articles/injection.html.

[7] M. Fowler. Language Workbenches: The Killer-App for Domain Specific Languages?, 2005.

http://martinfowler.com/articles/

languageWorkbench.html.

[8] M. Fowler and R. Pearson.Domain-Specific Languages. Addison-Wesley, 2010.

[9] A. W. B. Furtado and A. L. M. Santos. Using Domain-Specific Modeling towards Computer Games Development Industrialization. Federal University of Pernambuco, Informatics Center, 2006.

[10] K. Graft. Racing Evolution: Forza 3 and the Changing Driving Sim.

http://www.gamasutra.com/view/feature/4144/

racing_evolution_forza_3_and_the_.php, last

access: 04.02.2010.

[11] J. Hight and J. Novak.Game Development Essentials: Game Project Management. Thomson Delmar Learning, 2008.

[12] A. Kleppe.Software Language Engineering : Creating Domain-Specific Languages Using Metamodels. Addison-Wesley, 2009.

[13] S. Maier and D. Volk. Facilitating Language-Oriented Game Development by the Help of Language

Workbenches.Proceedings of the 2008 Conference on Future Play Research, Play, Share - Future Play ’08, 2008.

[14] P. Moreno-Ger, I. Martínez-Ortiz, and

B. Fernández-Manjón. The <e-Game> Project: Facilitating the Development of Educational Adventure Games.Proceedings of Cognition and Exploratory Learning in the Digital age (CELDA 2005), 2005.

[15] C. Nutt. Q&A: Valve’s Swift On Left 4 Dead 2’s Production, AI Boost. http://www.gamasutra.com/ view/news/25701/QA_Valves_Swift_On_Left_4_

Dead_2s_Production_AI_Boost.php, last access:

04.02.2010.

[16] T. Parr.The Definitive ANTLR Reference: Building Domain-Specific Languages. Pragmatic Bookshelf, 2007.

[17] T. Parr.Language Implementation Patterns: Create Your Own Domain-Specific and General Purpose Languages. Pragmatic Bookshelf, 2010.

[18] E. M. Reyno and J. A. Carsí Cubel. A Platform-Independent Model for Videogame Gameplay Specification. InBreaking New Ground: Innovation in Games, Play, Practice and Theory: Proceedings of the 2009 Digital Games Research Association Conference. Brunel University, 2009. [19] E. M. Reyno and J. A. Carsí Cubel. Automatic

Prototyping in Model-Driven Game Development.

Computer Entertainment, 7, 2009.

[20] K. Salen and E. Zimmerman.Rules of Play. MIT Press, 2004.

[21] J. Torrente, A. Del Blanco, E. J. Marchiori, P. Moreno-Ger, and B. Fernández-Manjón. <e-Adventure> Introducing Educational Games in the Learning Process, 2010.

[22] A. van Deursen, P. Klint, and J. Visser. Domain-Specific Languages: An Annotated Bibliography.ACM SIGPLAN Notices, 35, 2000.

Figure

Figure 1: DSL Engineering Workflow It is important to understand the positioning of the  flow in context of the game development process
Figure 2: Role Assignment of DSL Engineering Workflow
Figure 3: Example Written in Adventure DSL

References

Related documents

In essence, this study validates instructional coaches because the study results revealed that professional development provided by instructional coaches is effective because

Figure 2-3 OSTA 2.0 hardware data table relation [Cluster ID] ADD CLUSTER ADD NODE [Cluster ID] [Module number] [Node ID] [Cluster ID] [Node ID] ADD REMOTENODE [Frame number]

(b) Calculate the average atomic mass of an element given the relative abundance of isotopes or a mass spectrum.... The relative molecular mass of a compound is the

Make 5 on the Five Frame K.OA1 Represent addition and subtraction with objects, fingers, mental images, drawings, sounds (e.g., claps), acting out situations, verbal

Order_Id Number 8 Product Id Primary Key User_Id Number 8 User_Id Not Null Billing_Address Text 50 Billing Address Not Null Series Text 20 Series Not Null Product_Name Text 8

Sales volumes: FY14 total volumes increased by 37% led by the accelerating usage of stevia by Food and Beverages companies and underpinned by PureCircle’s proprietary Stevia 3.0

The Digital Privacy and Security Statement made by the Global Commission on Internet Governance (2015) was scrutinized with a cosmopolitan focus in order to prove its

Problem behavior was main- tained on a continuous schedule of rein- forcement during baseline, and reinforcer delivery under NCR was systematically thinned from relatively