Modding:Modding Efficiently: Difference between revisions

From Vintage Story Wiki
m (add translate tag)
(Marked this version for translation)
Line 1: Line 1:
<languages/><translate>
<languages/><translate>
<!--T:1-->
{{GameVersion|1.15}}
{{GameVersion|1.15}}


<!--T:2-->
Modding and even Game development itself usually requires a lot of trial & error. The more time you can save on those iteration times the better, as it accumulates quickly. Besides being quick to start up, VS offers a bundle more tricks to help you mod fast and efficiently. Here are some of the tricks every serious modder should use.
Modding and even Game development itself usually requires a lot of trial & error. The more time you can save on those iteration times the better, as it accumulates quickly. Besides being quick to start up, VS offers a bundle more tricks to help you mod fast and efficiently. Here are some of the tricks every serious modder should use.


== Shortcuts ==
== Shortcuts == <!--T:3-->


<!--T:4-->
* Use macros! Switching from/to creative/survival mode and <code>/time set day</code> bound to a keyboard shortcut is a must have. Hit CTRL+M to open the macro manager which will let you set those up!
* Use macros! Switching from/to creative/survival mode and <code>/time set day</code> bound to a keyboard shortcut is a must have. Hit CTRL+M to open the macro manager which will let you set those up!
* When you edit textures and shape files - these can be reloaded without restart using the commands <code>.reload textures</code> and <code>.reload shapes</code>. The latter may require you to place&remove a block so that the chunk gets redrawn
* When you edit textures and shape files - these can be reloaded without restart using the commands <code>.reload textures</code> and <code>.reload shapes</code>. The latter may require you to place&remove a block so that the chunk gets redrawn
Line 17: Line 20:
* If you modify a json file and want to include only the changes in your mod, you can create a [[Modding:JSON_Patching|JSON patch]]. Usually you can even save the time writing it yourself by using the ModMaker 3000™, a command line tool that ships with the game, to build the patches for you
* If you modify a json file and want to include only the changes in your mod, you can create a [[Modding:JSON_Patching|JSON patch]]. Usually you can even save the time writing it yourself by using the ModMaker 3000™, a command line tool that ships with the game, to build the patches for you


== Finding Issues ==
== Finding Issues == <!--T:5-->
* If you are stuck with an asset problem, look through the server-main.txt and client-main.txt! The engine is very talkative when it comes to asset errors.
* If you are stuck with an asset problem, look through the server-main.txt and client-main.txt! The engine is very talkative when it comes to asset errors.
* Permanently enable the error reporter via <code>/errorreporter 1</code> to save yourself the work of finding and scouring through the log files for problems. This feature will make it so that a dialog pop ups during after up of the game if any errors were encountered.
* Permanently enable the error reporter via <code>/errorreporter 1</code> to save yourself the work of finding and scouring through the log files for problems. This feature will make it so that a dialog pop ups during after up of the game if any errors were encountered.


== When writing C# mods ==
== When writing C# mods == <!--T:6-->
* Use break points for debugging
* Use break points for debugging
* Browse through the many utility classes provided by the VS API, you might be able to save a lot of coding efforts! (e.g. [https://github.com/anegostudios/vsapi/blob/master/Math/ColorUtil.cs ColorUtil], [https://github.com/anegostudios/vsapi/blob/master/Math/GameMath.cs GameMath], [https://github.com/anegostudios/vsapi/blob/master/Util/ArrayExtensions.cs ArrayExtensions], [https://github.com/anegostudios/vsapi/blob/master/Util/DictExtensions.cs DictExtensions], [https://github.com/anegostudios/vsapi/blob/master/Util/HashsetExtensions.cs HashsetExtensions], [https://github.com/anegostudios/vsapi/blob/master/Util/JsonUtil.cs JsonUtil], [https://github.com/anegostudios/vsapi/blob/master/Util/JsonUtil.cs ReaderWriterExtensions], [https://github.com/anegostudios/vsapi/blob/master/Util/SerializerUtil.cs SerializerUtil], [https://github.com/anegostudios/vsapi/blob/master/Util/WildcardUtil.cs WildcardUtil])
* Browse through the many utility classes provided by the VS API, you might be able to save a lot of coding efforts! (e.g. [https://github.com/anegostudios/vsapi/blob/master/Math/ColorUtil.cs ColorUtil], [https://github.com/anegostudios/vsapi/blob/master/Math/GameMath.cs GameMath], [https://github.com/anegostudios/vsapi/blob/master/Util/ArrayExtensions.cs ArrayExtensions], [https://github.com/anegostudios/vsapi/blob/master/Util/DictExtensions.cs DictExtensions], [https://github.com/anegostudios/vsapi/blob/master/Util/HashsetExtensions.cs HashsetExtensions], [https://github.com/anegostudios/vsapi/blob/master/Util/JsonUtil.cs JsonUtil], [https://github.com/anegostudios/vsapi/blob/master/Util/JsonUtil.cs ReaderWriterExtensions], [https://github.com/anegostudios/vsapi/blob/master/Util/SerializerUtil.cs SerializerUtil], [https://github.com/anegostudios/vsapi/blob/master/Util/WildcardUtil.cs WildcardUtil])
Line 32: Line 35:
* The game client and server have a number of [[Client startup parameters|startup arguments]] to make your live easier
* The game client and server have a number of [[Client startup parameters|startup arguments]] to make your live easier


=== Efficient Search Methods ===
=== Efficient Search Methods === <!--T:7-->


<!--T:8-->
More often than not, you'd want your code to find something in the game world. As you might already know, computers are not exactly the best at parallel processing like human eyes are, so they have to sequentially look through the entire search space. When doing so, keep in mind that, first and foremost, the most efficient search method is one that never runs, within a search space that is of size zero ;-)<br> In other words, sometimes you can avoid searches altogether through other clever means! If you still need to do a search, here's some more optimal ways than the brute force way:
More often than not, you'd want your code to find something in the game world. As you might already know, computers are not exactly the best at parallel processing like human eyes are, so they have to sequentially look through the entire search space. When doing so, keep in mind that, first and foremost, the most efficient search method is one that never runs, within a search space that is of size zero ;-)<br> In other words, sometimes you can avoid searches altogether through other clever means! If you still need to do a search, here's some more optimal ways than the brute force way:


<!--T:9-->
<ul>
<ul>
<li><strong>Entity Search</strong><br>
<li><strong>Entity Search</strong><br>
Line 46: Line 51:
</ul>
</ul>


<!--T:10-->
{{Navbox/modding|Vintage Story}}
{{Navbox/modding|Vintage Story}}
</translate>
</translate>