Music modding:修订间差异

本页面讲述的内容长期有效
(merge from offical wiki)
(没有差异)

2022年3月6日 (日) 23:41的版本


Creating a mod that adds music to Stellaris is rather easy. Following this guide, you'll create a mod that is essentially a modular music pack. That is to say, if you create a music pack as described in this guide, then create another, a user could download either or both from the Steam Workshop, install them both concurrently and have all the music that was included in both mods.

Essentially, one music pack does not override the other - you can install multiple over top of one another and so build a whole library of music to listen to in-game.

Getting Started

Let's take a look at the required folder structure and files. These are the contents of the base game's music folder:

Stellaris/music/

Folder/File Summary
*.ogg A music file.
songs.asset Controls the assignment of music to a code name, and sets the volume of playback.
songs.txt List of the code names mentioned in songs.asset.

We will use this same structure in our mod in order to add foreign music files to the game.

Setting Up

First of all, follow the step-by-step modding guide to create the folder structure for your mod and enter all the relevant data in the newly created "YOUR-MOD-NAME-HERE.mod" file.

Once you've done that initial set up, it's time to create the folder structure for your music pack mod.

In quick overview, your created mod's folder will by the end of this guide contain this:

  • a "descriptor.mod" file;
  • a "music" folder containing:
 * music files in .OGG format;
 * a "YOUR-MUSIC-PACK.asset" file;
 * a "YOUR-MUSIC-PACK.txt" file.
  • and finally a "YOUR-MOD-THUMBNAIL.jpg" image for the Steam Workshop.

Mod structure

So create a folder inside your music pack mod's main folder and call it "music". Add to this folder two files:

  • a "YOUR-MUSIC-PACK.asset" file;
  • a "YOUR-MUSIC-PACK.txt" file.

Call them whatever you like.

However, you generally should not call it "songs.asset" and "songs.txt", because this is the name that Stellaris uses for its own files and doing so might overwrite the base game's settings and songlist.

In order to ensure that no other music packs will overwrite your own songlists, call it something unique like I did for my "shrooblord-musicpack.asset".

Next, put music files in Ogg Vorbis format (.OGG) in this same "music" folder. If you have music files in a different file format, convert them to Ogg Vorbis (44.1 kHz) first. A tool you could use for this is Audacity, which is free.

That's all for the main structure of the mod! Now, let's edit those ".asset" and ".txt" files so that Stellaris actually loads our music pack into the game.

Creating the List of Songs

To know which file names should be displayed as what song title in-game, Stellaris uses the syntax described below. Follow this same syntax and your music will show up in-game and be automatically played by the music player!

songlist.asset

First, let's build the ".asset" file; we'll call it "songlist.asset" for sake of simplicity.

So say I have placed in my "music" folder two songs I want to add to the game. One is called "LemonDemon-DinosaurchestraPartOne.ogg" and the other is "FoolsGarden-LemonTree.ogg". To get them to show up in-game, I have to put the following in the "songlist.asset" file:

songlist.asset

music = {
 	name = "Dinosaurchestra - Part One"
 	file = "LemonDemon-DinosaurchestraPartOne.ogg"
 	volume = 0.50
}

music = {
 	name = "Lemon Tree"
 	file = "FoolsGarden-LemonTree.ogg"
 	volume = 0.50
}

What are these entries? The first variable "name" is the name that will show up in the Music Player*. The "file" variable is the exact filename of the song as it appears in the "music" folder that's in the mod's main folder you created for this music pack mod. "volume" is a relative volume for the music to play at. With it you can normalize volume for your tracks and avoid one getting louder than another. 0.5 is a standard value for it.

  • If the music file got a name in his metadate, it's is this name that'll show up in the Music Player. If two song got the same name in metadata, only the first one will appear in game.

songlist.txt

Next, we write the following to the "songlist.txt" file: songlist.txt

song = {
   name = "Dinosaurchestra - Part One"
}

song = {
   name = "Lemon Tree"
}

These are simply the same "name" variables as described in the "songlist.asset" file.

In the references I've seen, the order of the songs in both the "songlist.asset" and "songlist.txt" files are identical; I'm not sure if this is crucial, but it's probably best to follow that example.

Tools & utilities

  • Audacity - Powerful, well-documented and free audio processing program that allows you to, for example, convert between music file types.
  • dir2ogg - For Linux users, a very easy command line tool for converting mp3, m4a, wma, and wav files in bulk into the ogg-vorbis format.
  • soundconverter - Also for Linux users, Soundconverter is a no Terminal based bulk converter for the most common formats into the Stellaris needed ones.

See also

References


帝国 帝国思潮政府 • 国民理念 • 起源承诺议程传统 • 飞升天赋法令政策遗珍科技自定义帝国
人口 岗位派系
领袖 领袖领袖特质
物种 物种物种特质
行星 行星行星特征 • 轨道矿藏建筑 • 区划行星决议
星系 星系恒星基地巨型结构虫洞 • 星门地图
舰队 舰队舰船 • 部件
地面战 陆军轰炸姿态
外交 外交 • 联邦 • 星海共同体评价修正宣战理由 • 战争目标
事件 事件异常现象特殊项目考古遗址
游玩 游玩定义研究 • 经济游戏开局
动态修改 动态指令效果触发条件作用域修正变量AI
媒体/本地化 Maya 导出器图形肖像旗帜事件图片界面图标音乐本地化
Other 控制台命令存档编辑Steam 创意工坊模组制作教程