Aller au contenu

Photo

The Best Way to Make an NWN2 Tool?


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
The Fred

The Fred
  • Members
  • 2 516 messages
OK, "What's the best programming language?" is an age-old question which doesn't really get anyone anywhere, but "What's the best language for programming something to do something in NWN2?" is one which I think might be more answerable. Of course, that's a bit vague, since there are lots of things you might want to do (for example, I think tools would be different to toolset plugins) but it seems there must be pros and cons to various approaches which don't exist in the "outside world".

For example, when I made my demo Auto Content Installer I did it in C, since C is all I knew (or rather it's what NWS - Neverwinter Scripting - is, indirectly, based on, and NWS is all I knew). Recently, though, I started a course in Java, and for all its downsides, it's also a LOT nicer to use in many ways (I actually got told off for writing something like a C programmer) and it got me to thinking about whether converting to another language might be better. But anyway, what are the thoughts of the true programmers and toolmakers?

#2
Olblach

Olblach
  • Members
  • 175 messages
Programming a standalone tool is not very different than a plugin: a plugin is a DLL and a standalone is an exe. Better start by doing a plugin I think because you'll find more examples.



You can use any dotnet language, since programming uses a lot of Obsidian's dll. If you know C why not try C#? If you want an example you can download any plugin given with source (most are) or some standalone tools. RDR Wizard is in Visual Basic and TerraCoppa in C# to name just two of them.


#3
The Fred

The Fred
  • Members
  • 2 516 messages
The difference if that afaik, plugins have to work with Obsidian's stuff (I haven't done any plugins myself, but as you mention, they are DLLs and all that jazz). A standalone you can basically do what you want, theoretically from scratch (at least that's what I did). A lot of people do seem to have used C#, though, that's true.

#4
Olblach

Olblach
  • Members
  • 175 messages
You can develop a standalone tool without Obsidian dlls but then you limit your possibilities...

#5
The Fred

The Fred
  • Members
  • 2 516 messages
True, I just haven't really looked at them yet. As I mentioned, my programming experience is limited (I've literally done a short course on C and and even shorter one on Java, and everything else comes from my NWN scripting knowledge). More generally, though, I was thinking kind of in terms of whether there are any specific advantages/disadvantage to what different things can do as specifically regards NWN(2). I personally am fine with plain C, though I do think I'm making life hard for myself given I've basically been building everything from the gorund up.

#6
Olblach

Olblach
  • Members
  • 175 messages
Depends on how much time you have on your hands. That is how I add wings to a character in a bic file with C# and Obsidian DLLs, it took me a few minutes to write it:

        public void ChangeWings(string fname, byte num)
        {
            prepGFF(fname);
            if (gff != null)
            {
                if (gff.TopLevelStruct.Fields.ContainsKey("Wings"))
                {
                    GFFByteField b = (GFFByteField)gff.TopLevelStruct.Fields["Wings"];
                    b.ValueByte = num;
                    completeGFF();
                }
            }
        }
With those DLLs you can poke into BICs but also into 2DAs, HAKs and so on.

Now you could do it in C++ with the same DLLs, the difference is not so big.

Modifié par Olblach, 05 novembre 2010 - 07:42 .


#7
SkywingvL

SkywingvL
  • Members
  • 351 messages

Olblach wrote...

You can develop a standalone tool without Obsidian dlls but then you limit your possibilities...


If you're building a standalone tool without the OEI DLLs, the NWN2 Datafile Accessor Library (if you're using C++) provides a great deal of functionality for working with the various NWN2 file formats, including GFF processing support.

#8
The Fred

The Fred
  • Members
  • 2 516 messages
I did see your library which looks pretty cool, but ofc at the time I was using C and having enough trouble trying to learn what I needed/wanted to know for that to try and understand anything else. Not that I have a massive amount of time on my hands right now, but hey. I guess that is one advantage of using C++ though :-)