Contents
The Whimsy Of Domain-Specific Languages
 
 
Printer-Friendly VersionPrinter-Friendly Version
 


Part of:



[More information...]
 

Latest News
spacer View All spacer
 
July 17, 2009
 
Sony Online Entertainment Lays Off 41 [8]
 
Sega's Bayonetta Moved To 2010 Release [1]
 
Nintendo Again Dominates NPD Top 20 [5]
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
July 17, 2009
 
SGN
Art Director
 
Telltale Games
Gameplay Programmer/Software Engineer
 
Sucker Punch Productions
Lead Character Artist
 
SGN
Game Designer
 
SGN
Producer
 
Warner Bros Entertainment
Sr. Envrionment Artist
 
NetDevil
Project Manager
 
Insomniac Games
FX Artist - CA
spacer
Latest Features
spacer View All spacer
 
July 17, 2009
 
arrow Ken Levine on Studio Culture: From Looking Glass to 2K Boston
 
arrow The History and Theory of Sandbox Gameplay [3]
 
arrow Anatomy of a Combat Zone [7]
 
arrow The History of Defender: The Joys of Difficult Games [13]
 
arrow Lighting The Ignition: Jumping From Niche to Triple-A? [9]
 
arrow The Facebook Doctrine: Gaming And The Future [3]
 
arrow Sponsored Feature: Two Brains Are Better Than One -- How to Thread Game AI
 
arrow The Designer's Notebook: Sorting Out the Genre Muddle [9]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
July 17, 2009
 
Make Your Bed, Eat Your Veggies, and Comment Your Code
 
Epic Scale [2]
 
Sexy Tiles: Sidescrollers [9]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  The Whimsy Of Domain-Specific Languages
by Mick West
del.icio.us del.icio.us digg this! digg this! reddit! reddit! stumble it! stumble it! RSS
 
 
September 3, 2008 Article Start Page 1 of 3 Next
 

[In this technical article, originally published in Game Developer magazine, Neversoft co-founder Mick West explores making your own mini-languages for games by making Whimsy, a DSL that creates art based on the abstract paintings of Parappa creator Rodney Alan Greenblat.]

A domain-specific language (DSL, also called a "little language") is a language that's intended for a very specific use. It can be a programming language such as the Turtle aspects of LOGO that defines a very limited set of actions (drawing lines).

Alternatively, it can be a data definition language that encapsulates the representation of some presentable data, such as graphics or sound. HTML can be thought of as a domain-specific language as it's limited to describing the presentation of a web page.

This article looks at the potential uses of DSLs in games. I'll look at a specific domain and create a language for it, as well as discuss some of the problems I encountered.

Specific vs. General

A DSL differs from a general-purpose language in that the latter must support a large amount of functionality, including: variables, data structures, conditional expressions, looping constructs, and functions. General-purpose programming languages may also support various forms of abstraction, object-oriented programming, lambda expressions, and so on.

DSLs can be classified as either internal or external. An internal DSL is simply an extension of an existing general-purpose language. You can think of an internal DSL as simply being a set of functions, data structures, and conventions applied to an existing language, such as C++ or Ruby.

This set of functionally is still specific to one problem domain. A typical internal DSL might be one used to define state transitions for AI using a set of query functions and a switch statement. Many games have implemented this kind of system in the game code in C++, as AI is often the responsibility of a programmer rather than a designer.

An external DSL is an independent language that has been entirely created for this specific purpose. Generally, a DSL program will be a text file, which is then interpreted (or perhaps compiled) by some part of the game engine or tool chain.

Again, AI is a common usage of a DSL-when programmers hand off AI to a designer, they will frequently make it more data-driven, often to the extent that they supply a "little language" to script the AI transitions.

The Domain

In experimenting with domain-specific languages for this article, I defined my domain as the works of Rodney Alan Greenblat, the artist responsible for the unique characters and world design in Parappa the Rapper, Um Jammer Lammy, and the upcoming Major Minor's Majestic March.

Greenblat has a large body of artwork with a very distinctive whimsical style. For my specific domain, I picked the artwork from his Elemental tour, a collection of semi-abstract paintings in a distinctive brightly colored and geometric style.

The idea was this: If such a style of artwork were to be used in a video game, then it might be very useful to have a DSL that encapsulated that style and allowed for easy creation of similar pieces for use in-game.

The first step in creating a DSL is to get a rough idea of the elements that the domain comprises. Looking at the Elemental works, we can see a number of common aspects. There are concentric oval shapes, with petals adjoined to various sections.

Many of the works have segmented circles with colored circles inside them. There are little propellers and various other shapes that repeat both within individual works and within Greenblat's overall collection.


Figure 1: Rodney A. Greemblat's "Lunar Module" is part of the domain for a new domain-specific language.

I decided the best way to approach creating this DSL would be to pick one piece and attempt to replicate parts of it. I chose the painting "Lunar Module" (see Figure 1).

Many common elements hold the piece in its style: solid circles, concentric ovals with color gradients, petals, and stars. Being even more selective, I isolated one corner of the painting, the purple box with blue petals (see Figure 2).


Figure 2: This detail from the lower left corner of "Lunar Module" serves as the basis for the code used to replicate its style.

 
Article Start Page 1 of 3 Next
 
Comments

none
 
Comment:
 


Submit Comment