Extra tools/zh: Difference between revisions

From DDraceNetwork
(Created page with "如果打开源文件或者目标文件出错将返回-1。")
No edit summary
Tag: Manual revert
 
(19 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>
== 获取额外工具 ==
== 获取附加工具 ==


这些工具'''不'''会在DDNet游戏内或[https://ddnet.org/downloads/ 游戏下载页]中出现。制图相关工具可以在下载页面的Graphics Tools子页面找到不同平台的版本。
这些工具'''不'''会在DDNet游戏内或[https://ddnet.org/downloads/ 游戏下载页]中出现。制图相关工具可以在下载页面的Graphics Tools子页面找到不同平台的版本。


这些额外工具可以在[https://github.com/ddnet/ddnet DDNet源码]下的[https://github.com/ddnet/ddnet/tree/master/src/tools src/tools]路径内找到。
这些附加工具可以在[https://github.com/ddnet/ddnet DDNet源码]下的[https://github.com/ddnet/ddnet/tree/master/src/tools src/tools]路径内找到。


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


下面是这些工具的详细说明。
下面是这些工具的详细说明。
Line 72: Line 72:
* 如果图片格式错误则会显示<code>invalid image format</code> 。
* 如果图片格式错误则会显示<code>invalid image format</code> 。


''自DDNet 12.9版本后可用''
* 自DDNet 12.9版本后可用


=== map_diff ===
=== map_diff ===
Line 79: Line 79:


对比两个地图文件并根据对比结果输出报告:
对比两个地图文件并根据对比结果输出报告:
* 地图相同则显示no diff output
* 地图相同则示任何消息
* 如果两个地图的图层数不一样则显示<code>different layer numbers</code> ;
* 如果两个地图的图层数不一样则显示<code>different layer numbers</code> ;
* 如果层数一致但是层中实体不一样则显示<code>different tile layers</code> ;
* 如果层数一致但是层的类型完全一样则显示<code>different tile layers</code> ;
* 其他情况显示指标和旗帜位置的差异
* 如果层的数量和类型都一致,输出具体差异,例如指标和旗帜位置的不同


当地图之间没有差异时返回0,否则返回1。
当地图之间没有差异时返回0,否则返回1。
Line 98: Line 98:
优化地图文件<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> 。
优化地图文件<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> 。


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


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


''自DDNet 15.5.4版本后可用''
* 自DDNet 15.5.4版本后可用


=== map_replace_image ===
=== map_replace_image ===
Line 108: Line 108:
  示例:map_replace_image ''map_file1'' ''map_file2'' ''imagename'' ''image_file''
  示例:map_replace_image ''map_file1'' ''map_file2'' ''imagename'' ''image_file''


<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>


=== map_resave ===
=== map_resave ===
Line 122: Line 118:
  示例:map_resave ''map_file'' ''image_file''
  示例:map_resave ''map_file'' ''image_file''


<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。


=== packetgen ===
=== packetgen ===
Line 134: Line 130:
  示例:packetgen
  示例:packetgen


<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>


=== unicode_confusables ===
=== unicode_confusables ===
Line 142: Line 136:
  示例:unicode_confusables ''string1'' ''string2''
  示例:unicode_confusables ''string1'' ''string2''


<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>


=== uuid ===
=== uuid ===
Line 162: Line 148:
  示例:uuid ''name''
  示例:uuid ''name''


<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版本後可用