附加工具

From DDraceNetwork
Revision as of 04:25, 19 June 2023 by Darkh (talk | contribs) (Created page with "示例:dilate ''image_file1'' [''image_file2'' ... ]")

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


dilate

示例:dilate image_file1 [image_file2 ... ]

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 Edge padding for more info.

Note this works only in RGBA image files (e.g. PNG files). So, it will fail in e.g. JPEG files.

dummy_map

 示例:dummy_map

Creates a dummy, small empty map to be used to start a server. See [1] for more info.

fake_server

示例:fake_server

Creates a fake server for testing.

map_convert_07

示例:map_convert_07 src_map_file dest_map_file

Makes dest_map_file 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:

  • an usage message if incorrect arguments are provided
  • failed to open source map if an error happens when opening the source map
  • failed to open destination map if an error happens when opening the destination map
  • error loading storage if failed to open storage for some reason
  • failed to open image file if error happens on opening PNG image
  • invalid image format if incorrectly formatted PNG.

Available since: DDNet 12.9

map_diff

示例:map_diff map_file1 map_file2

Compares two map files, reporting one of the follow:

  • no diff output, meaning the maps are the same
  • different layer numbers, if one map has more layers than another
  • different tile layers, if the number of layers is the same, but at least one layer is different
  • lastly, the index and flags positions that differ.

If there is no difference between maps, returns 0; otherwise, returns 1.

map_extract

map_extract map_file [directory]

Extracts contents from map_file into the directory. If optional argument directory is not provided, extracts to the current directory.

map_optimize

map_optimize source_map_filepath [dest_map_filepath]

Optimizes the map file in the source_map_filepath given (see how it works) and stores the output in the given dest_map_filepath; if dest_map_filepath is unset, output path defaults to out/source_map_filename.map, stripping the path and the extension of the source file.

Note the name of the embedded images optimized is changed from originalname to originalname_cut_newSHA256 (where newSHA256 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.

If failed to open source or target file, returns -1.

Available since: DDNet 15.5.4

map_replace_image

map_replace_image map_file1 map_file2 imagename image_file

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.

Please note:

  • Both map filenames must be relative to user default DDNet folder
  • New image filepath can be absolute, or relative to the current directory

map_resave

示例:map_resave map_file image_file

Updates the map file map_file.map with the provided file image_file.

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