附加工具
額外工具用於執行玩家遊玩行為之外的其他任務,例如地圖作者對地圖進行優化,或是開發者進行測試和故障排除。不管是先添加它們的路逕到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
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 anotherdifferent 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 aá 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