Translations:Modding:Modding Efficiently/6/en
From Vintage Story Wiki
When writing C# mods
- 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. ColorUtil, GameMath, ArrayExtensions, DictExtensions, HashsetExtensions, JsonUtil, ReaderWriterExtensions, SerializerUtil, WildcardUtil)
- If you don't know it already, the LINQ extension, part of the .net framework, is an extremely powerful tool to make code more expressive.
- Use the Hot reload feature of Visual Studio to modify code while the game is running, to see your changes immediately without restarting the world.
- Note that this feature works if you use the official mod template and set up your mod as a "compiled" mod. It does not work if you set up your mod as a "source" mod, and it may not work with all other development environment setups.
- If you don't have already make sure the games log output ends up in the Visual Studio output window
- If you are working with shaders, you can reload them with
.reload shaders
- Do not hold static references unless its primitive data. Static references are not garbage collected when the player leaves a server / game world. Example: Holding a static reference of a
Block
will keep that block in memory, which in turn keeps the API Instance in memory, which in turn keeps the entire game world in memory. - The game client and server have a number of startup arguments to make your live easier