Extra tools/zh: Difference between revisions

From DDraceNetwork
(Created page with "自DDNet 9.0后可用")
No edit summary
Tag: Manual revert
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:
<languages/>
<languages/>
'''额外工具'''用于执行玩家游玩行为之外的其他任务,例如地图作者对地图进行优化,或是开发者进行测试和故障排除。不管是先添加它们的路径到PATH变量还是直接输入路径,这些工具都必须通过命令行(例如Windows的cmd界面或是Linux的Terminal终端)运行。
'''附加工具'''用于执行玩家游玩行为之外的其他任务,例如地图作者对地图进行优化,或是开发者进行测试和故障排除。不管是先添加它们的路径到PATH变量还是直接输入路径,这些工具都必须通过命令行(例如Windows的cmd界面或是Linux的Terminal终端)运行。


<span id="Getting_the_extra_tools"></span>
<span id="Getting_the_extra_tools"></span>
== 获取额外工具 ==
== 获取附加工具 ==


<div lang="en" dir="ltr" class="mw-content-ltr">
这些工具''''''会在DDNet游戏内或[https://ddnet.org/downloads/ 游戏下载页]中出现。制图相关工具可以在下载页面的Graphics Tools子页面找到不同平台的版本。
These tools are '''not''' provided in the binary DDNet game in the [https://ddnet.org/downloads/ Downloads page]. Having that said, extra tools mapping-related can be download for different platforms in the Downloads page, under the name "Graphics Tools".
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
这些附加工具可以在[https://github.com/ddnet/ddnet DDNet源码]下的[https://github.com/ddnet/ddnet/tree/master/src/tools src/tools]路径内找到。
These and other extra tools (listed below) can be found on the [https://github.com/ddnet/ddnet DDNet source code] under [https://github.com/ddnet/ddnet/tree/master/src/tools src/tools] directory.
</div>


<span id="List_of_extra_tools"></span>
<span id="List_of_extra_tools"></span>
== 额外工具列表 ==
== 附加工具列表 ==


下面是这些工具的详细说明。
下面是这些工具的详细说明。
Line 20: Line 16:
=== config_retrieve ===
=== config_retrieve ===


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:config_retrieve ''map_file''
config_retrieve ''map_file''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
检索DDNet地图文件''map_file''内置的参数,然后写入保存到与地图名字相同的一个配置文件。例如对地图文件Kobra 4.map使用会将它的参数写入到Kobra 4.cfg
Retrieves configuration embedded in a DDNet map file ''map_file'' and stores it in a DDNet map configuration file with same filename (e.g. "Kobra 4.map" returns "Kobra 4.cfg")
</div>


自DDNet 9.0后可用
* 自DDNet 9.0版本后可用


<div lang="en" dir="ltr" class="mw-content-ltr">
=== config_store ===
=== config_store ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:config_store ''map_file''
config_store ''map_file''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
从配置文件将参数写入保存到地图文件''map_file'',如果配置文件和地图文件名字不同或者不在同一路径下将会操作失败。
Stores configuration from a map's configuration file into the ''map_file''.  Both configuration and map files must have the same filename in the same directory, otherwise the operation will fail.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
如果两个文件的参数原本就一致,则不会执行操作并显示<code>configs coincide, not updating map</code>
If there is no difference between the configuration to stored and the configuration embedded in the map, then operation will be canceled with message <code>configs coincide, not updating map</code>.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 自DDNet 9.0版本后可用
''Available since: DDNet 9.0''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== crapnet ===
=== crapnet ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:crapnet
crapnet
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
用于测试客户端和服务器的本地连接和传送请求(ping)。掉包会显示<code>dropped packet</code>,而成功则显示<code>cfg = ''number''</code>,其中''number''取值为0到2。
Tests connection by setting a client–server connection locally and running ping between them. Reports dropped packets with message <code>dropped packet</code> and successes with <code>cfg = ''number''</code>, where ''number'' varies from 0 to 2.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
=== dilate ===
=== dilate ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:dilate ''image_file1'' [''image_file2'' ... ]
dilate ''image_file1'' [''image_file2'' ... ]
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
这个图形工具对地图作者比较友好。它可以为游戏内图片描边和锐化,防止混淆不同地图结构。更多信息请查阅[http://wiki.polycount.com/wiki/Edge_padding Edge padding]
It is a graphics tool, mainly useful for mappers. It takes care of transparent areas to prevent black/white outlines around your images ingame, therefore avoiding blending and mipmap issues. See [http://wiki.polycount.com/wiki/Edge_padding Edge padding] for more info.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
注意:这只对RGBA格式的图片生效。例如PNG文件可用而JPEG文件不可用。
Note this works only in RGBA image files (e.g. PNG files). So, it will fail in e.g. JPEG files.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== dummy_map ===
=== dummy_map ===
</div>


  <div lang="en" dir="ltr" class="mw-content-ltr">
  示例:dummy_map
dummy_map
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
创建一个空的分身小地图来启动服务器。更多信息请参阅[https://github.com/ddnet/ddnet/blob/a66379918832e5ad93332bbe0475394b156b5c24/src/engine/shared/network_server.cpp#L371 github]
Creates a dummy, small empty map to be used to start a server. See [https://github.com/ddnet/ddnet/blob/a66379918832e5ad93332bbe0475394b156b5c24/src/engine/shared/network_server.cpp#L371] for more info.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== fake_server ===
=== fake_server ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:fake_server
fake_server
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
为测试创建一个临时的虚拟服务器。
Creates a fake server for testing.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== map_convert_07 ===
=== map_convert_07 ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:map_convert_07 ''src_map_file'' ''dest_map_file''
map_convert_07 ''src_map_file'' ''dest_map_file''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
对于那些只能兼容Teeworlds的6.x版本的地图文件<code>''src_map_file''</code> ,使用这一命令可以将文件转变为兼容7.x版本并保存为<code>''dest_map_file''</code> 。这一命令在不同情况下执行失败则会有不同回显:
Makes <code>''dest_map_file''</code> compatible with Teeworlds version 7.x that otherwise it would be compatible '''only''' with Teeworlds version 6.x. If successfully, it creates a valid 07-compatible destination map; otherwise, it returns one of the following:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 如果提供的参数不正确会显示用法示例;
* an usage message if incorrect arguments are provided
* 如果在打开源文件<code>''src_map_file''</code> 时出错则会显示<code>failed to open source map</code>
* <code>failed to open source map</code> if an error happens when opening the source map
* 如果在打开目标文件<code>''dest_map_file''</code> 时出错则会显示<code>failed to open destination map</code>
* <code>failed to open destination map</code> if an error happens when opening the destination map
* 如果磁盘空间不足或有其他存储问题则会显示<code>error loading storage</code>
* <code>error loading storage</code> if failed to open storage for some reason
* 如果在打开PNG图片时出错则会显示<code>failed to open image file</code>
* <code>failed to open image file</code> if error happens on opening PNG image
* 如果图片格式错误则会显示<code>invalid image format</code>
* <code>invalid image format</code> if incorrectly formatted PNG.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 自DDNet 12.9版本后可用
''Available since: DDNet 12.9''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== map_diff ===
=== map_diff ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:map_diff ''map_file1'' ''map_file2''
map_diff ''map_file1'' ''map_file2''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
对比两个地图文件并根据对比结果输出报告:
Compares two map files, reporting one of the follow:
* 地图相同则不显示任何消息 ;
* no diff output, meaning the maps are the same
* 如果两个地图的图层数不一样则显示<code>different layer numbers</code>
* <code>different layer numbers</code>, if one map has more layers than another
* 如果层数一致但是层的类型不完全一样则显示<code>different tile layers</code>
* <code>different tile layers</code>, if the number of layers is the same, but at least one layer is different
* 如果层的数量和类型都一致,则输出具体差异,例如指标和旗帜位置的不同。
* lastly, the index and flags positions that differ.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
当地图之间没有差异时返回0,否则返回1。
If there is no difference between maps, returns 0; otherwise, returns 1.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== map_extract ===
=== map_extract ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:map_extract ''map_file'' [''directory'']
map_extract ''map_file'' [''directory'']
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
提取地图文件''map_file'' 中的目录到路径参数''directory'',如果没有设置参数''directory'' 则会提取到当前路径。
Extracts contents from ''map_file'' into the ''directory''. If optional argument ''directory'' is not provided, extracts to the current directory.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== map_optimize ===
=== map_optimize ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:map_optimize ''source_map_filepath'' [''dest_map_filepath'']
map_optimize ''source_map_filepath'' [''dest_map_filepath'']
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
优化地图文件<code>''source_map_filepath''</code> (参见[https://github.com/ddnet/ddnet/pull/3201 工作原理(how it works]),然后将输出保存到<code>''dest_map_filepath''</code> 。如果没有设置参数<code>''dest_map_filepath''</code> 则将默认输出保存到路径文件<code>out/''source_map_filename''.map</code>
Optimizes the map file in the <code>''source_map_filepath''</code> given (see [https://github.com/ddnet/ddnet/pull/3201 how it works]) and stores the output in the given <code>''dest_map_filepath''</code>; if <code>''dest_map_filepath''</code> is unset, output path defaults to <code>out/''source_map_filename''.map</code>, stripping the path and the extension of the source file.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
注意优化后地图中嵌入的图片文件名会从<code>''originalname''</code> 改为<code>''originalname''_cut_''newSHA256''</code> (此处<code>''newSHA256''</code> 是嵌入地图的图片优化时采用的sha256算法)。这一重命名旨在提醒使用者:地图文件中使用的mapres ''''''在优化时被更改。
Note the name of the embedded images optimized is changed from <code>''originalname''</code> to <code>''originalname''_cut_''newSHA256''</code> (where <code>''newSHA256''</code> is the new sha256 of the embedded optimized image). It is renamed is to make clear it was optimized because this tool '''will''' make changes in the mapres used by the map file.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
如果打开源文件或者目标文件出错将返回-1
If failed to open source or target file, returns -1.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 自DDNet 15.5.4版本后可用
''Available since:'' DDNet 15.5.4
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== map_replace_image ===
=== map_replace_image ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:map_replace_image ''map_file1'' ''map_file2'' ''imagename'' ''image_file''
map_replace_image ''map_file1'' ''map_file2'' ''imagename'' ''image_file''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
使用图片路径''image_file'' 下的文件替换当前存在于地图文件''map_file1'' 中的图片''imagename'' ,然后另存为地图文件''map_file2.map''
Replaces the image ''imagename'' currently inside the map filename ''map_file1'' with the image filepath ''image_file'', and save into the map filename ''map_file2.map''.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
注意:
Please note:
* 两个地图文件都必须在使用者的默认DDNet文件夹目录下;
* Both map filenames must be relative to user default DDNet folder
* 新的图片路径可以是绝对路径也可以是当前目录下的相对路径。
* New image filepath can be absolute, or relative to the current directory
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== map_resave ===
=== map_resave ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:map_resave ''map_file'' ''image_file''
map_resave ''map_file'' ''image_file''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
用指定的图片文件''image_file'' 更新地图文件''map_file.map''
Updates the map file ''map_file.map'' with the provided file ''image_file''.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
当出现下列情况将会返回错误代码 255:
The error status 255 is returned if 1) a number of arguments different from 2 is provided, 2) if the ''map_file.map'' is not valid, or 3) if ''image_file'' is not a valid image file (e.g. it is a text file); otherwise, return 0.
* 提供了两个以上的参数;
</div>
* ''map_file.map'' 不是有效的地图文件;
* ''image_file'' 不是有效的图片文件(例如文本文件)。
其他情况则返回0。


<div lang="en" dir="ltr" class="mw-content-ltr">
=== packetgen ===
=== packetgen ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:packetgen
packetgen
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
生成并发送网络包到端口127.0.0.1:8303(默认的本地服务器端口),用以测试和本地服务器的联络。
Generates and sends network packets to 127.0.0.1:8303 (localhost, in default server port) to test communication with a local server instance.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== unicode_confusables ===
=== unicode_confusables ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:unicode_confusables ''string1'' ''string2''
unicode_confusables ''string1'' ''string2''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
对比两串字符串''string1'' ''string2'' 并报告它们是否容易混淆。例如:如果字母本身相同而差异在于变音符号或者各种角标,例如''aa'' ''aá'' 中的''a'' 有可能与''á'' 混淆。
Compares ''string1'' with ''string2'' and report if they are "confusable", i.e. if the characters are "equal" and could cause confusion. For this to work, the characters with accents or other things around them are considered the "confusable" with the base character. Therefore, ''aa'' and ''aá'' are confusable (''á'' was considered as ''a''), while ''aa'' and ''ab'' are not.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
如果容易混淆则会返回<code>not_confusable=0</code> ,否则返回<code>not_confusable=1</code>
If they are confusable, it returns <code>not_confusable=0</code>, otherwise, returns <code>not_confusable=1</code>.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 自DDNet 10.3.5版本后可用
''Available since: DDNet version 10.3.5''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
DDNet 12.9版本后更新内容:获得了Unicode 12.0支持,并且工具名称''confusables'' 改为''unicode_confusables''
''New in DDNet version 12.9:'' Unicode 12.0 support and the tool name was renamed from ''confusables'' to ''unicode_confusables''.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== uuid ===
=== uuid ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
示例:uuid ''name''
uuid ''name''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
显示指定的''name'' 的uuid。
Prints uuid for the provided ''name''.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
唯一编号识别系统(uuid)旨在独立作者之间无冲突地创作内容,例如说两个作者制作了同名的文件,则系统会通过赋予文件相互不同的编号(id)将它们区分开,这样在提及文件时不会将它们混淆,明显比旧系统中混乱的事物命名要方便合理。此系统可以在引擎、游戏信息、快照和大事件上运作。
The uuid system was implemented to be easily extended by independent authors without collisions, something that the old system – with increasing integers – did not allow. This works for engine and game messages, snapshot items and events.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
如果没有设置参数''name'' 则会返回错误代码255。
Exits with error status 255 if ''name'' is not provided.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* 自DDNet 10.6.1版本后可用
''Available since: DDNet 10.6.1''
</div>

Latest revision as of 11:07, 27 December 2023

附加工具用于执行玩家游玩行为之外的其他任务,例如地图作者对地图进行优化,或是开发者进行测试和故障排除。不管是先添加它们的路径到PATH变量还是直接输入路径,这些工具都必须通过命令行(例如Windows的cmd界面或是Linux的Terminal终端)运行。

获取附加工具

这些工具会在DDNet游戏内或游戏下载页中出现。制图相关工具可以在下载页面的Graphics Tools子页面找到不同平台的版本。

这些附加工具可以在DDNet源码下的src/tools路径内找到。

附加工具列表

下面是这些工具的详细说明。

config_retrieve

示例:config_retrieve map_file

检索DDNet地图文件map_file内置的参数,然后写入保存到与地图名字相同的一个配置文件。例如对地图文件Kobra 4.map使用会将它的参数写入到Kobra 4.cfg。

  • 自DDNet 9.0版本后可用

config_store

示例:config_store map_file

从配置文件将参数写入保存到地图文件map_file,如果配置文件和地图文件名字不同或者不在同一路径下将会操作失败。

如果两个文件的参数原本就一致,则不会执行操作并显示configs coincide, not updating map

  • 自DDNet 9.0版本后可用

crapnet

示例:crapnet

用于测试客户端和服务器的本地连接和传送请求(ping)。掉包会显示dropped packet,而成功则显示cfg = number,其中number取值为0到2。


dilate

示例:dilate image_file1 [image_file2 ... ]

这个图形工具对地图作者比较友好。它可以为游戏内图片描边和锐化,防止混淆不同地图结构。更多信息请查阅Edge padding

注意:这只对RGBA格式的图片生效。例如PNG文件可用而JPEG文件不可用。

dummy_map

 示例:dummy_map

创建一个空的分身小地图来启动服务器。更多信息请参阅github

fake_server

示例:fake_server

为测试创建一个临时的虚拟服务器。

map_convert_07

示例:map_convert_07 src_map_file dest_map_file

对于那些只能兼容Teeworlds的6.x版本的地图文件src_map_file ,使用这一命令可以将文件转变为兼容7.x版本并保存为dest_map_file 。这一命令在不同情况下执行失败则会有不同回显:

  • 如果提供的参数不正确会显示用法示例;
  • 如果在打开源文件src_map_file 时出错则会显示failed to open source map
  • 如果在打开目标文件dest_map_file 时出错则会显示failed to open destination map
  • 如果磁盘空间不足或有其他存储问题则会显示error loading storage
  • 如果在打开PNG图片时出错则会显示failed to open image file
  • 如果图片格式错误则会显示invalid image format
  • 自DDNet 12.9版本后可用

map_diff

示例:map_diff map_file1 map_file2

对比两个地图文件并根据对比结果输出报告:

  • 地图相同则不显示任何消息 ;
  • 如果两个地图的图层数不一样则显示different layer numbers
  • 如果层数一致但是层的类型不完全一样则显示different tile layers
  • 如果层的数量和类型都一致,则输出具体差异,例如指标和旗帜位置的不同。

当地图之间没有差异时返回0,否则返回1。

map_extract

示例:map_extract map_file [directory]

提取地图文件map_file 中的目录到路径参数directory,如果没有设置参数directory 则会提取到当前路径。

map_optimize

示例:map_optimize source_map_filepath [dest_map_filepath]

优化地图文件source_map_filepath (参见工作原理(how it works)),然后将输出保存到dest_map_filepath 。如果没有设置参数dest_map_filepath 则将默认输出保存到路径文件out/source_map_filename.map

注意优化后地图中嵌入的图片文件名会从originalname 改为originalname_cut_newSHA256 (此处newSHA256 是嵌入地图的图片优化时采用的sha256算法)。这一重命名旨在提醒使用者:地图文件中使用的mapres 在优化时被更改。

如果打开源文件或者目标文件出错将返回-1。

  • 自DDNet 15.5.4版本后可用

map_replace_image

示例:map_replace_image map_file1 map_file2 imagename image_file

使用图片路径image_file 下的文件替换当前存在于地图文件map_file1 中的图片imagename ,然后另存为地图文件map_file2.map

注意:

  • 两个地图文件都必须在使用者的默认DDNet文件夹目录下;
  • 新的图片路径可以是绝对路径也可以是当前目录下的相对路径。

map_resave

示例:map_resave map_file image_file

用指定的图片文件image_file 更新地图文件map_file.map

当出现下列情况将会返回错误代码 255:

  • 提供了两个以上的参数;
  • map_file.map 不是有效的地图文件;
  • image_file 不是有效的图片文件(例如文本文件)。

其他情况则返回0。

packetgen

示例:packetgen

生成并发送网络包到端口127.0.0.1:8303(默认的本地服务器端口),用以测试和本地服务器的联络。

unicode_confusables

示例:unicode_confusables string1 string2

对比两串字符串string1string2 并报告它们是否容易混淆。例如:如果字母本身相同而差异在于变音符号或者各种角标,例如aa 中的a 有可能与á 混淆。

如果容易混淆则会返回not_confusable=0 ,否则返回not_confusable=1

  • 自DDNet 10.3.5版本后可用

DDNet 12.9版本后更新内容:获得了Unicode 12.0支持,并且工具名称confusables 改为unicode_confusables

uuid

示例:uuid name

显示指定的name 的uuid。

唯一编号识别系统(uuid)旨在独立作者之间无冲突地创作内容,例如说两个作者制作了同名的文件,则系统会通过赋予文件相互不同的编号(id)将它们区分开,这样在提及文件时不会将它们混淆,明显比旧系统中混乱的事物命名要方便合理。此系统可以在引擎、游戏信息、快照和大事件上运作。

如果没有设置参数name 则会返回错误代码255。

  • 自DDNet 10.6.1版本后可用