MOD制作指南

From Space Engineers Wiki
Revision as of 06:56, 22 August 2023 by Someme (talk | contribs) (着色器脚本 Shaders)
Jump to: navigation, search

说明

本页主要提供入门模组制作前的基本信息,辅助了解各种模组制作可涉及的范畴和能力。
可先阅览 官方的模组制作指引页面(英文),基本上大部分过去的维基内容都包括进去了🐶。

模改想法

颜色不行;纹理不合理;模型真丑;功能有问题;使用不方便;想加入某某需求系统;PS.中文机翻是不是说明Good.AI😇无用;微软拼音一身反骨。
通常都是体验过游戏的玩家才会提出各种希望改进私人体验的梦想作为前提。

游戏目录结构

游戏是对各种数据合理组织后才能将内容表现出来的程序。模改则需要尽可能多的了解这些内容相互影响的程度才能在改动时,避免不必要的结果(比如:做到一半行不通或出现了自己都无法理解的崩溃)。
1.202.124版本

各数据文件格式简要说明

模组制作需知

mod文件夹必须包含一个名为Data的子文件夹,其中包含添加或更新的mod的定义文件。几乎所有内容都可以由modder替换/更新(音频、视频、纹理、模型、gui等)。Mods仅限于一个世界,不能改变这个世界范围之外的任何东西。例如,虽然你可以替换块mod的GUI图标之类的东西,但你不能替换整个UI的图形,因为它存在于加载mod的世界之外。?

着色器脚本 Shaders

版本1.202.124 着色器脚本 是 hlsl 和 hlsli
旧版游戏着色器脚本由 fx fxh 组成每次执行会根据 fx 编译 fxo在游戏目录\Content\Effects2\中

材质贴图 Textures

几乎所有材质都是DDS格式(DXT压缩). 你需要一个编辑程序操作他们. 如果你使用Adobe Photoshop, 我们推荐安装这个插件: developer.nvidia.com/nvidia-texture-tools-adobe-photoshop并使用这个设置导出::

材质导出设置

材质可以在这里找到: steamapps\common\SpaceEngineers\Content\Textures\ 这里有多种材质文件:GUI, 粒子, 灯光, 模型, voxels(体素), 等. 模型材质文件名中有“_ns”的文件是“法线贴图”在RGB通道和Alpha通道中的“高光”。 模型材质文件名中有“_de”的文件是“漫反射( diffuse)”在RGB通道和Alpha通道中的“发射率”

Some textures are in the DirectX *.dds format (DXT5 compression). You will need an editing program that can manipulate them. If you use Adobe Photoshop, we recommend installing this plugin and using these settings for exporting:

Settings for exporting textures

Textures can be found in: steamapps\common\SpaceEngineers\Content\Textures\. There are multiple categories of texture files: GUI, particles, lights, models, voxels, etc. Model textures with “_ns” in their name contain the "normal map" in the RGB channels and the "specular map" in the ALPHA channel. Model textures with “_de” in their name contain the "diffuse map" in the RGB channels and "emissive map" in the ALPHA channel.

The textures which can use the above method are limited primarily to GUI Graphics such as Block or menu icons.

随着Space Engineers从DX9 PBR纹理转移到DX11 PBR纹理,创建纹理的方法发生了变化

The easiest method is to create PNG or TIFF files for each texture and use the Texture Packing Tool to compile them into a .dds texture. DX11 textures use a different compression type (BC3 to BC7), therefore the plugins for DX9 will not work to open or save textures in this format. The DX11 textures are:

  • “_cm” - Color(albedo) and Metalness map (alpha).
  • “_ng” - Normal map and Gloss map (alpha).
  • “_add” - Add texture - AO (Red channel), G (emissive) and B channels are not specified yet and Custom Color mask (alpha channel).
  • “_alphamask” - alpha map.

More information can be found here. While this link is for Space Engineer's sister title, Medieval Engineers, the games share a common code base and the modding process is nearly the same for both games.

3D建模

MwmBuilder是由fbx文件生成mwm模型的工具。

注意:你可能需要管理员权限在Program Files文件夹里复制或创建文件;你可以复制MwmBuilder 和dll文件到一个不同的文件夹(话说steam版这个文件也没在PF里啊 = =)。

MwmBuilder位置(看吧 - -): {Steam安装目录}\SteamApps\common\SpaceEngineers\Tools\MwmBuilder.exe

模型存储在: steamapps\common\SpaceEngineers\Content\Models\

用法说明: 1) 复制FBX模型到MwmBuilder.exe所在文件夹 2) 创建一个与FBX模型同名的XML文件. 例如你有一个Giraffe.fbx就创建一个Giraffe.xml. 3) 运行MwmBuilder.exe 4) 你将看到.mwm文件出现在文件夹里,没有就出错了 嗯嗯>_< MwmBuilder is the utility built by the devs for converting fbx files to mwm models.

Note: You may need administrator rights to copy or create files in Program Files folder; you can copy MwmBuilder and dlls into a different folder.

MwmBuilder Location: {Steam installations directory}\SteamApps\common\SpaceEngineers\Tools\MwmBuilder.exe

Models are stored in: steamapps\common\SpaceEngineersModSDK\OriginalContent\Models\

Models have been moved to the SpaceEngineers ModSDK. For information on obtaining the SDK on Steam check here

SIMPLE USAGE:

  1. ) Copy FBX models to the same directory as MwmBuilder.exe
  2. ) Create an XML file with the same name as the model. Giraffe.fbx will have Giraffe.xml.
  3. ) Run MwmBuilder.exe
  4. ) You'll find .mwm files in the same folder

For advanced usage see here: ADVANCED 3D MODELS GUIDE

Moddable collision models: Adding new model with collision geometry.

可编程功能支持库 API

Creating a working script is a difficult process for a single individual to do, and to facilitate easy creation of scripts an API is required to guide a prospective modder in the correct direction. Initially the community did this themselves with the Mod:SEModAPI, but in Update 01.048 Keen released an official API as well. SEModAPI is no longer in development and should no longer be used. This guide and others like it on the official wiki will only discuss how to use the official API.

There are three planned "levels" of script modding for the official API:

  • Plug-ins(DLLs) - will be the most powerful (and most difficult to create). This involves creating a set of custom methods, objects, and interfaces in Visual Studio and compiling the project into a .DLL file.
  • ModAPI script mods - will allow access to objects at the world level as opposed to a single ship grid with in-game scripts. This level of script can, for example, add an effect to all blocks of a certain type on all ships regardless of owner. One such early script mod was used to create a teleporter.
  • In-game scripts - will provide the quickest form of modification for simple or low-scope scripts. These are loaded via the Programmable Block's Menu. They can be written directly into the the text panel of the block or downloaded from a subscribed script in the workshop by clicking on a button in the same panel.


The current implementation of the API includes all three methods. Since these mods can be subscribed to and downloaded within Steam's infrastructure, certain limitations are in place to make sure that malicious mods cannot do irreversible damage (such as deleting files on the hard drive, etc). As such, not every in-game or out-of-game function can be used. See the Scripting Whitelist page for more information.

插件模组 Plug-in DLL mods

These can bypass all protections in place in the game for preventing malicious code. That is what makes them so powerful as they can use functions normally restricted. They can do things like changing the GUI menus to add custom screens or add custom functions to blocks which are normally hard coded in the game. They are not available as workshop mods and are manually downloaded and loaded in the game with a specially created shortcut to SpaceEngineers.exe. It is advisable to only use plugins from a trusted programmer, or one that has the plugin source publicly viewable. Some plugins also have their own mods that need to be subscribed and added to a world through the Steam Workshop in addition to manually installing the plugin. Because of the potential for plugins to cause damage to not only the game saves, but to an individual PC, they are not officially supported by KSH.

教程和指引 Tutorials/Guides

另见 See also


工具

There are many different workflows used by various modders. There is also not a universal workflow that works for everyone. However, the following tools are recommend by most modders and make it much easier to create mods:

  • Notepad++ (For XML, SBC, and general text editing)
  • Visual Studio (For scripting)
  • Blender (For creating 3d models)
  • Harag's plugin for easily configuring blender and exporting 3d models into VRage format.
  • Paint.NET (Photoshop also works if you have this plugin for exporting in the dds format)