https://github.com/jason80/dragonfly
Interactive Fiction Game Engine in Javascript
https://github.com/jason80/dragonfly
adventure-game game-development game-engine interactive-fiction interactive-fiction-engine javascript narrative-engine storytelling text-adventure text-games
Last synced: about 1 month ago
JSON representation
Interactive Fiction Game Engine in Javascript
- Host: GitHub
- URL: https://github.com/jason80/dragonfly
- Owner: jason80
- License: mit
- Created: 2024-09-24T22:12:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-04-28T02:26:45.000Z (about 1 month ago)
- Last Synced: 2026-04-28T02:29:14.737Z (about 1 month ago)
- Topics: adventure-game, game-development, game-engine, interactive-fiction, interactive-fiction-engine, javascript, narrative-engine, storytelling, text-adventure, text-games
- Language: JavaScript
- Homepage:
- Size: 1.95 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.es.md
- License: LICENSE
Awesome Lists containing this project
README

*Versión actual: 0.7.0*
[English](./README.md) | Español
## ¿Qué es Dragonfly?
Dragonfly es un motor de juegos de ficción interactiva. Permite crear y jugar aventuras de conversacionales directamente en el navegador.
## Filosofía
- **Desarrollo sencillo**. Para ello, Dragonfly utiliza **DFML**: un lenguaje simple y fácil de entender (el uso de JavaScript es prácticamente innecesario).
- **Sin compilación, sin motores, sin máquinas virtuales**. Se ejecuta directamente en el navegador. No necesitas ningún programa especial para ejecutar tu juego. Puedes integrarlo fácilmente en cualquier sitio web.
---

---
## Juegos de ejemplo
| Juego | Descripción | Temas abordados
|---|---|---|
| [El Bosque](https://jason80.github.io/dragonfly/samples/es/bosque/bosque.html) | Un juego simple con cinco locaciones | Básicos: Movimiento, atributos, contenedores, final |
| [Chooser](https://jason80.github.io/dragonfly/samples/es/chooser/chooser.html) | Prueba de diálogo de objetos | Básicos: Diálogo, objetos, contenedores, inventario |
| [Manto de Oscuridad](https://jason80.github.io/dragonfly/samples/es/manto/index.html) | Port en español a Dragonfly del juego "Cloak of Darkness" de Roger Firth escrito en Inform 6 | Básicos: Movimiento, finales, oscuridad |
---
## Configuración del proyecto
La estructura inicial del proyecto es:
```sh
index.html
mygame.js
mygame.dfml
```
## Ejemplo del archivo "index.html":
```html
Mi Juego
```
## Ejemplo del archivo "mygame.js":
```javascript
import { Book } from "https://jason80.github.io/dragonfly/base/book.js"
window.onload = function() {
const book = new Book("game-area", "mygame.dfml");
book.run();
}
```
## Ejemplo del archivo "mygame.dfml":
```dfml
# Nodo del libro (cabecera del libro):
book(title: "Mi Juego", author: "Juan Pérez") {
# Indica a Dragonfly quién es el jugador:
property(name: "player", value: "-player")
# Incluye un diccionario predefinido (primera persona):
include(src: "https://jason80.github.io/dragonfly/templates/dict-es1.dfml")
}
# Todos los objetos (sustantivos) se definen en el nodo dictionary:
dictionary {
# Definición de un jardín:
noun(names: "El Jardín, jardín") {
describe-place {
"Estoy de pie en medio de un jardín lleno de colores."
}
# Definición del jugador:
noun(names: "Vincent, jugador, -player")
}
}
```
---
## Ejecutar el juego:
Ejecuta el juego en tu navegador usando un servidor local:
### Usando Python3:
En tu terminal, introduce:
```sh
python3 -m http.server
```
Copia la URL indicada y ábrela en tu navegador.
### Usando VSCode:
Abre la carpeta del proyecto y ejecuta el comando Run with Live Server
(instala la extensión Live Server si es necesario).

## Descargar Dragonfly
Puedes clonar el proyecto utilizando git de la siguiente forma:
```sh
git clone --recurse-submodules https://github.com/jason80/dragonfly mygame
```
El parámetro `--recurse-submodules` sirve para descargar el módulo `dfml` del cuál Dragonfly depende.
## Tutoriales:
[English](./tutorial/en/start.md) | [Español](./tutorial/es/start.md)
#### Mas documentación:
* [Doors](./tutorial/en/doors.md) | [Puertas](./tutorial/es/doors.md)
* [Darkness](./tutorial/en/darkness.md) | [Oscuridad](./tutorial/es/darkness.md)
* [Ambient sounds (Sequences)](./tutorial/en/sequences.md) | [Sonidos ambientales (Secuencias)](./tutorial/es/sequences.md)
* [Debug](./tutorial/en/debug.md) | [Depuración](./tutorial/es/debug.md)
* [Actions table](./tutorial/en/actions_table.md) | [Tabla de acciones](./tutorial/es/actions_table.md)
* [Responses table](./tutorial/en/responses_table.md) | [Tabla de respuestas](./tutorial/es/responses_table.md)
* [Conditions table](./tutorial/en/conditions_table.md) | [Tabla de condiciones](./tutorial/es/conditions_table.md)