Topic: How to test music ingame

Lastmerlin on July 18, 2010, 07:13:05 PM

Lastmerlin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 463
  • Karma: +5/-0
    • View Profile
Music made for the game can be easily tested by using the chatline (commandline). All music must be provided in .ogg format and placed in the ressources/music directory.
After starting game with an arbitrary savegame, open the chatline (Enter or m) and type:
Code: [Select]
$playMusic("themusicfile.ogg")

The dollar sign at the begin is to signal to the chatline that the message should be executed as a command. The musicfile will be played in a loop. To stop the music type:

Code: [Select]
$clearMusicList()

To integrate the music into the game, the music tracks need to be added to Regions. This is done in the WorldData XML (to be found in data/world). The syntax is as follows (all other tags omitted):

Code: [Select]









The music files are played in a loop at random order.
« Last Edit: August 03, 2010, 10:44:08 AM by Lastmerlin »
Logged
  • Read 3896 times
  • Category Sound & Music
Comments: 4

West on August 02, 2010, 09:51:26 PM
Reply #1

West

  • Moderator
  • Full Member
  • *****
  • Posts: 190
  • Karma: +5/-0
    • View Profile
I tried this, but I'm not getting any music at all. Most likely I've misunderstood how it's supposed to be done.

Obviously I shouldn't add the tracks to the region with the name "string" in world.xml. I say obviously because I tried it and nothing happens :) So, am I supposed to add new sections (like the last one in the previous post) for regions that need music? If so, how the heck do I know the ID's and names of existing regions?

Also, I was expecting TitleMusic source= to play whatever specified file when the game starts but apparently I was wrong. How do I add music for the main menu?

A little clarification would be appreciated :)
Logged

Lastmerlin on August 03, 2010, 07:30:21 AM
Reply #2

Lastmerlin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 463
  • Karma: +5/-0
    • View Profile
Ok, I will have a closer look at it this evening.
Meanwhile: Can you provide the .ogg file ? I assume that you placed it in the ressource/music folder ?

Here on my computer this folder looks like:
Quote

Dark_Exploration.ogg

And when I type $playMusic("Dark_Exploration.ogg") it works fine.

For the xml format: Of course the "string" only denotes the data type that is expected for the attributes.
For instance you could extend data/world/aisen.xml this way, to use this theme in the first region with goblins:
Code: [Select]

...






           
           

...


To get the name of the Region (in this case "aisMeadow") you can use the command
Code: [Select]

$print(getRegion())


However, I fear that something with openal is screwed up, so all this wont help x(
Logged

West on August 03, 2010, 10:02:26 AM
Reply #3

West

  • Moderator
  • Full Member
  • *****
  • Posts: 190
  • Karma: +5/-0
    • View Profile
But it did help, I added the tags to the aisMeadow region instead, and the music plays back fine (though I only started the game briefly to check, I didn't wait to see if it goes through the whole playlist). Thanks for the help!

Might be a good idea to change the first post so that it doesn't say that you add the music in world.xml as that apparently isn't the case :)

Edit: looking at the post, I think the reason for this misunderstanding is that I thought "World XMl" meant the file world.xml, but you probably mean "the world xml files".
« Last Edit: August 03, 2010, 10:04:29 AM by West »
Logged

Lastmerlin on August 03, 2010, 10:50:27 AM
Reply #4

Lastmerlin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 463
  • Karma: +5/-0
    • View Profile
It seems, that our naming convention is not really clear here ^^. When I say World XML (or Item XML for instance) I usually mean the XML format that is used to specify world data (or item data respectively). All xml files in the data/world directory are examples of World XML data.  However, there is usually one file that has the same name as the XML type (in this case world.xml) and in this file the format is explained. I agree that this might be confusing ^^.
Logged