sábado, 7 de julio de 2012

Tutorial 04: How to add your own music

Today we will see how to add music to our map. To do this, we have to use the "sound layer" in the world editor.


This tool allows us to "paint" a zone of the world and, when the player enter in that zone, an effect will be showed. The "Layer" tool is used for six differnet effects:
   - Fog/Lighting: With this type of layer is possible to add fog to a zone and to change the intensity and the color of the light.
   - Name Layer: This is used to determine the name of the zone. When the player enters in the layer, the name will be showed in the screen.
   - Boss Layer: It seems that this layer is obsolete. I think that originary was used to add a sound effect when a boss appears, but now that functionailty is covered in the Quest Editor.
   - Day/Night Cycle: This layer is used to affect the normal day/night cycle of the game.
   - Bloom Layer: This layer is used to add a "bloom" efect. This is, to add a blinding light.
   - Sound Layer: The one that i will explain in this tutorial.

When we create a sound layer, we have three options:


   - Ambient Music: This is the music that will sound in background in some places. Note that normally the game doesnt have background music. The music only should be used in determinated zones, to increase the tension, for example.
   - Ambient Sounds: These are the sounds that you can hear in background. Like the farm sounds, the sing of the birds, the wind over the trees, etc.
   - Event Music: Event Music is played if you enter a sector for the first time. After that the music is only played again, if you restart the game.

When you click in the button at the side of each type of layer, the editor will show the music explorer and you can select the music or ambient sound that you want.



In this explorer you can find all three types of sounds, so you can search in these folders depends on what kind of sound you need:
   - sounds/ambientpak/: In this folder there are the ambient sounds.
   - sounds/musicpak/*random: In this folder there are the music files.
   - sounds/musicpak/*event: In this folder there are the event sounds.

As you can see, all these files are DBR files. As we saw in the previous tutorial (Tutorial 03: Introducción a los ficheros DBR) all the objects, including sounds, that you place in the world editor are defined as a DBR files.

If you want to use the standard sounds and musics, with this you have enought. But, well, if youre creating a new mod, the funny is to add your own music. So, the first thing you must do is to import an existing DBR file in the Art Manager to add in it your own music.


To do this, follow the next steps:

  1. Open the Art Manager
  2. Import records/sounds/ambientpack/(choose pak) (for example it would be records/sounds/ambientpak/ambgrassland.dbr)
  3. Import records/sounds/sounds/musicpack/(location event)/(musicpak) for example records/sounds/musicpak/greekevent/grkeventhelostheme.dbr
  4. Import one more record records/sounds/musicpak/(location random)/(musicpak) for example records/sounds/musicpak/greekrandom/grassland01mpakgrk.dbr
  5. Build / (F7)
  6. Exit out of Art manager and open Editor
  7. Open your mod
  8. Select the region you want to add the music to and open in Editor mode
  9. Select the area painter (I forget the exact name for it, it's the one in the middle with the red yellow green and blue shapes in it)
  10. For Layer, choose sound layer
  11. Click on new and change default style name to something more descriptive
  12. Click on the elipsies next to the Ambiant music box
  13. In the window that opens choose the ambiant music file you imported to the database (if this window is blank something went wrong with the import and build)
  14. Do the same for Ambiant sound and Event music boxes
  15. Follow current procedures to save and build mod or maps.
  16. Play test, if all went well you should hear some music.


Only one important note. When you import the files in the stes 2, 3 & 4, do not move the DBR files from the folder that the system created. I know that in the tutorial about DBR files i said that you can organize your folders as you want. Well, this is an exception. If you move these DBR files, the world editor will now show them.

With this, we have our own DBR files that will add to our mod. But first we need to import our own music. To do this, we need to follow the next steps:


  1. In Art Manager, Sources Tab right click in the folder list area (left side) on the top item (modename)/sources and choose Create Folder
  2. Name your new folder something painfuly obviously for your sanity (I.E. InGameMusic)
    • Note: Do not name the folder "Sounds" or "Music" by itself
  3. On the right side right click and choose import.
  4. Browse your way to the .mp3 or .wav that you want to use.
  5. Click on on open.
  6. Right click on your now imported file and choose Auto-Create Asset
  7. Repeat until all the files you want are imported.
  8. Build
  9. Your music/sound files should now be avaiable for use in the sounds and music type Database records.
The last step is to include our imported MP3 or WAV file into our own DBR files. When we open the DBR files in the art manager, the most important fields are the following:

Ambient Sound
   - enableNightSounds: If 1 (true) the night parameters are used during nighttimes. Otherwise only the other sounds are used.
   - ambientLoop + volume: Base ambientLoop and Volume
   - frequentSound parameters: A ll noises that are heard often.
   - moderateSound parameters: All noises that are heard not so often.
   - uniqueSound parameters: All noises that are played only once.
   - night parameters: All noises that are played during night time.

Ambient Music
That DBR has a base (drone) theme and the melody files. The melody files are played randomly and always parrallel to the Drone music. You can select only a drone theme and clear the melody selections, but not otherwise.

   - randomizeMelodies: Really i dont know.
   - drone parameters: The drone is the base theme of the music.
   - melody parameters: One melody at a time is play parallel to the drone music.
   - percussion parameters: ?




domingo, 1 de julio de 2012

Tutorial 3: Introducción a los ficheros DBR


En este pequeño tutorial vamos a familiarizarnos con algo básico en el modeo del Titan Quest, los ficheros .DBR. Digo que son algo básico porque cualquier cosa que veáis en el World Editor, tiene por debajo un fichero .DBR que lo define.

Un NPC, por ejemplo, tiene por debajo un fichero .DBR que es el que le da nombre, dialogo, etc. Un monstruo (a los que abreviadamente se les llama MOBs) tiene un fichero .DBR que contiene sus características (puntos de vida, habilidades, etc.)

Echad un vistazo a la imagen siguiente. En ella vemos un fragmento del poblado donde se inicia la historia del Mod que estoy creando. Ahí podemos ver unos niños, un malabarista, un pozo, un árbol, etc


Si seleccionamos, por ejemplo, al malabarista, podéis ver que en la parte inferior de la pantalla se puede ver el fichero .DBR al que apunta.


Si habéis leído los anteriores tutoriales ya estaréis más o menos familiarizados con el World Editor, y sabréis que todo elemento que queráis colocar sobre el mapa se encuentra en la parte de la derecha.


Pues bien, todo elemento que se encuentra en esa sección, tiene un .DBR por debajo.

Cuando construyamos nuestro mapa, iremos usando los elementos que tenemos disponibles en el editor pero, tarde o temprano, llegaremos a un punto en que queramos añadir algo nuevo y que no se encuentra ahí.

En estos casos podemos hacer dos cosas, la opción difícil y no recomendable o la opción menos difícil y más recomendable.

La opción más recomendable es buscar un elemento parecido al que queremos añadir, hacer una copia y modificar su fichero .DBR para adaptarlo a nuestras necesidades.

La opción no recomendable es la de crear un fichero .DBR desde cero, usando los templates que nos instalamos tal y como expliqué en el Tutorial 01: Primeros pasos. Esta opción no es recomendable porque los .DBR pueden ser, desde muy sencillos (por ejemplo, el .DBR de una piedra) hasta increíblemente complejos, como el .DBR de un cofre aleatorio.

Así pues, intentar crear algo más o menos complejo desde cero usando un template no es buena idea.

Dicho esto, vamos a ver la opción más recomendable. Para hacer una copia de un .DBR ya existente debemos hacer lo siguiente: primero buscamos el elemento que nos interesa duplicar en el world editor. Vamos a hacer la prueba cogiendo un NPC y cambiándole el nombre, que es algo fácil.


En la parte inferior podéis ver la ruta donde se encuentra el .DBR seleccionado. Con esa ruta en mente, abriremos el Art Manager.

En el Art Manager seleccionamos la opción Database à Import y se nos mostrará la misma estructura de carpetas que teníamos en el world editor.


Abrimos la carpeta donde está el .DBR que nos interesa, y pulsamos OK.


Ahora iremos a la pestaña “Database” y vemos que se nos ha creado una estructura de carpetas igual a donde estaba el fichero .DBR seleccionado.

Antes de continuar, decir que la estructura de carpetas que debemos tener en esta pestaña es totalmente libre. Cada uno se puede hacer las que le interesen y con las que se sienta más cómodo.

Como idea, yo lo que hago es crearme una carpeta por área que vaya a tener mi Mod. Y dentro de cada área creo 4 carpetas:

-          Una llamada “NPC” donde meto los .DBR de los NPC.
-          Una llamada “Dialogos” donde meto los .DBR de los diálogos.
-          Una llamada “Monstruos” donde meto los .DBR de los enemigos (llamados Mobs).
-          Una llamada “Objetos” donde meto los .DBR de cualquier otra cosa que vaya a usar como cofres personalizados, puertas, objetos de misión como llaves, anillos, etc


Como digo, es sólo una idea y cada uno puede organizar sus carpetas como más le plazca. De hecho, en la imagen de antes hay una carpeta extra llamada "Merchant", que es donde metí los ficheros específicos de los mercaderes, porque tienen un tratamiento especial que veremos en detalle en otro tutorial.

Este inciso me sirve para mostraros una de las (muchas) cosas que tienen las herramientas del Titan Quest que me mosquean bastante. Como decía antes, al importar el .DBR se nos ha creado una carpeta igual a la carpeta donde estaba el fichero importado.

Esto nos obliga a seleccionar el fichero importado, copiarlo a la carpeta que nos interese y borrar todas las carpetas creadas por el programa. Y esto hay que hacerlo cada vez que importemos algo…

Bien, con nuestro fichero .DBR importado, lo podemos renombrar para darle un nombre más acorde al nuevo uso que tendrá el fichero.


Ahora hacemos doble-click sobre él y vamos a ver el contenido. No voy a entrar en mucho detalle porque próximamente haré tutoriales específicos para modificar .DBR de diferentes tipos, pero sí os voy ha indicar las partes más significativas para que os vaya sonando.


En la sección "Header" tenemos los datos generales del fichero. Estos datos no tienen impacto en el juego y son únicamente para que podamos identificar el fichero.

El campo que sí requiere de explicación adicional es el "Class" que identifica la clase del DBR. Como explicamos anteriormente, siempre duplicaremos ficheros DBR, así que tampoco debemos preocuparnos mucho por ésto.


En la sección "NPC Static Dialog" se insertará el fichero que contiene el dialogo del NPC. En un tutorial posterior explicaré la parte de los diálogos, pero de momento nos quedamos con que aquí ponemos el fichero que contendrá los textos del NPC.


La sección "Character" define las característicias del NPC. Tales como el nivel, el daño que hace al atacar, si es invencible (con la opción "Invincible"), etc. 

Como veis, esto no tiene mucho sentido en un NPC normal. Pero sí lo tiene cuando estemos definiendo un DBR de monstruo, o un DBR de un NPC que deba atacar monstruos, por ejemplo.


La sección "Actor Variables" sí es importante, así que vamos a ver los campos un poco en detalle. Esta sección es exactamente igual en todos los DBR, independientemente de que estemos definiendo un NPC, monstruo o una simple roca.

- Description: Este texto es el que dará nombre al objeto, NPC o lo que sea. Es decir, lo que sale en pantalla cuando pasemos el cursor por encima. No es un texto, sino un "tag" que identificará el DBR.  Posteriormente, en el fichero de textos deberemos relacionar el "tag" con el texto que saldrá por pantalla.

- Mesh, Base Texture, Bump Texture: Esto es lo que define la forma y el aspecto del DBR. Más adelante entraremos en detalle. Pero quedaros con que la textura del objeto y la forma 3D del mismo se definen con los ficheros que pongamos aquí (los. TEX).

- Scale, Actor Radius, Actor height: Esto define el tamaño del objeto. Si estamos creando un monstruo, y queremos que sea como un sátiro normal pero gigante, deberemos aumentar la escala.


Character Bio: Aquí se definen las resistencias, atributos, vida, maná, etc del NPC. Nuevamente, no tiene mucho sentido en un NPC, pero sí en un monstruo.


Reward: Aquí se define el oro que suelta el monstruo al morir.


Initial Equipment: Aquí se define el equipo que tendrá el NPC o monstruo. Como veis en la imagen, esto se define a base de un porcentaje de llevar el objeto equipado "chancetoequip" y luego se define el "loot" que es un fichero especial que tiene la fórmula de cálculo de los objetos que puede tener equipados.

Y con esto creo que ya podéis tener una idea general de como funciona un DBR. Si os ponéis a investigar un poco y revisáis algún DBR de los que trae el juego podréis descubrir alguna otra cosa interesante. 

Al fin y al cabo, esto se trata de probar y copiar los ya creados para poder crear los nuestros.