How do you develop a mod? Best practice?
So yeah how do you do it?
I don't mean the stuff from the tutorial, but things like:
How do you find out how things work under the hood?
How do you test you code in a timely manner?
As an example:
At the moment I'm trying to figure out, if a player/client knows in which hot(key)group he is or if the client doen't know, how to tell him.
The api I found in the wiki is not really comprehensive.
So at the moment, I take the bits and pieces from the web and try stuff out. But trying my code means I have to start the game and load a map, which can take up to a few minutes.
When I have a typo I have to starte again, waiting 3 minutes, because lua is a dynamic language.
Do you guys have a few tips, how to get the information that I need, and how do speed up my development process?
Is three a way to (re)load a lua script ingame?
Thanks!
I don't mean the stuff from the tutorial, but things like:
How do you find out how things work under the hood?
How do you test you code in a timely manner?
As an example:
At the moment I'm trying to figure out, if a player/client knows in which hot(key)group he is or if the client doen't know, how to tell him.
The api I found in the wiki is not really comprehensive.
So at the moment, I take the bits and pieces from the web and try stuff out. But trying my code means I have to start the game and load a map, which can take up to a few minutes.
When I have a typo I have to starte again, waiting 3 minutes, because lua is a dynamic language.
Do you guys have a few tips, how to get the information that I need, and how do speed up my development process?
Is three a way to (re)load a lua script ingame?
Thanks!
Comments
1. Think about what i want to do and which UWE NS2 classes i will need to change.
2. Look those classes up in ns2docs (i attached the current version)
3. Write the code
4. Test the new stuff at a local server with bots. Fun fact: i played over 200 bot rounds the last few weeks to debug ns2stats
About those typo errors , mods are loaded before precacheing beginns, so watch the console while loading if there is a error type run "disconnect" to stop loading. Reload ingame use "sv_changelevel ns2_veil" . Mod files are reloaded with mapchange.
And about your idea i think you have to create something like this: if commander creates a hotkeygroup, sent a networkmessage to server which includes groupkey + groupunits, then the server has to sent a networkmessage to the grouped clients to inform them that they have been grouped ...
Thanks for the disconnect tipp^^
So sv_changelevel doesn't do anything ingame, do I have to do something else before?
But if I use a mapchange, then I still have to wait through loading and prechaching, do I not?
So you are on a first name basis with the bots?
:P
I did this like exactly, except my key is F7, and the map is from watermod. Loads super quick, because yeah don't trust hotloading, because it doesn't work very well.
https://www.dropbox.com/s/gmhghc18k3mys2r/ns2_watertest.level
If you don't want to write a new gamemode ala Combat you can also use Shine Core as Framework:
https://github.com/Person8880/Shine/wiki/Developing-a-Shine-plugin
https://github.com/Person8880/Shine/wiki/Hook-Library
https://github.com/Person8880/Shine/wiki/Plugin-network-messages
It allows you easily to create and manage Hooks,Netwokmessages, has a fail protection and many other things.
You put -hotload in the launch options (or in a shortcut, eg. "D:\Games\Steam\steamapps\common\natural selection 2\NS2.exe" -game "C:\Users\username\Downloads\Natural Selection 2\Mods\Hidden Spectator Mod\output" -hotload).
If you do this though make sure that your "\AppData\Roaming\Natural Selection 2\ConsistencyConfig.json" doesn't block anything, because you'll get kicked out of the game the moment you change a file if it does.
Why isn't hotloading reliable?
It has starnge memory leaks and produces errors you will never see if you load your mod normal. That is why most ppl don't use it.
I usually use emacs. Does Decoda bring anything to the table, thats a reason to switch?