附加工具

From DDraceNetwork
Revision as of 11:58, 22 June 2023 by Darkh (talk | contribs) (Created page with "用提供的图片文件''image_file'' 更新地图文件''map_file.map'' 。")

额外工具用于执行玩家游玩行为之外的其他任务,例如地图作者对地图进行优化,或是开发者进行测试和故障排除。不管是先添加它们的路径到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

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

  • 地图相同则显示no diff output ;
  • 如果两个地图的图层数不一样则显示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

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.

packetgen

示例:packetgen

Generates and sends network packets to 127.0.0.1:8303 (localhost, in default server port) to test communication with a local server instance.

unicode_confusables

示例:unicode_confusables string1 string2

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 are confusable (á was considered as a), while aa and ab are not.

If they are confusable, it returns not_confusable=0, otherwise, returns not_confusable=1.

Available since: DDNet version 10.3.5

New in DDNet version 12.9: Unicode 12.0 support and the tool name was renamed from confusables to unicode_confusables.

uuid

示例:uuid name

Prints uuid for the provided name.

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.

Exits with error status 255 if name is not provided.

Available since: DDNet 10.6.1