Leaderboard
Popular Content
Showing content with the highest reputation on 02/06/2020 in all areas
-
2 pointsPresumably you want to ask @DrMcCoy. Xoreos has done the most recent and thorough (publicly available) work on it. I gather you have perused their repo? I'd advise against any incorporation of "DeNCS" in the name. Xoreos has already taken "ncsdis" and "ncsdecomp". You could perhaps go with something like "NCS2NSS". That's fine. The Xoreos tools are all commandline, and real men compile directly with nwnnsscomp which is commandline as well. Batch scripts are easy enough to write. And as with nwnnsscomp, if someone was keen enough they could always write a GUI front-end for it (ask @JCarter426 - he'll need a GUI project for his course later in the year presumably). Yes. It's presumably due to the way that DeNCS interprets the bytecode, since there's obviously not a 1:1 match between it and the source NSS. I would suggest you try decompiling some of the global scripts that have Bioware source available and compare DeNCS's output with the original NSS. There are certain quirks in the way DeNCS likes to format things, which, while functionally the same, may introduce the subtle differences it complains about with partial matches.
-
1 pointI put my original mod on hold since someone else is making it. And, wow, does it look good! So, on to the most neglected project: a new DeNCS. It's currently able to interpret op codes and arguments, so the next step is the higher-level control flow. Here's where you can help: Byte Code - I obtained a list of op codes from here. I need to make sure it's complete and correct. NWScript - I am compiling a list of operators, punctuators, and keywords from here, and here. I need to make sure it's complete and correct. Mapping - This is the big one, making sure script converts to byte code, and vice versa. 100% identical conversion, every time. No pressure. DOT Diagram - I need a program that can make diagrams from DOT DOT Generator - I can generate the DOT from my code, but it would be helpful if something could do this for me, as well. Name - Right now, it's called DeNCS 2020. Narrowly edging out NewNCS. Please, give it a good name. A couple of things I want to address. DeNCS sometimes reports a partial-byte mismatch. At first, I ignored this just like every other modder. However, while testing this tool I compared the output of an NCS file straight from the game to the output DeNCS generated... Well, it looks like DeNCS attempts to convert the NCS to source code, then attempts to convert the source code back to an NCS file. Then, it compares the original NCS to the new one. And, if they don't match? Partial-byte mismatch. I don't know why DeNCS doesn't always perform a perfect conversion, but it's something to investigate. Particularly, since there are reports that even NCS files generated by Bioware and Obsidian had bugs in them. Troubleshooting the NCS files will make this longer since I have no way of knowing what the original files should have looked like. (But, I can guess just like DeNCS seems to do.) This is command-line only. There was never any intention to make this a stand-alone tool. However, development will take longer than I expected, which means a GUI is the least of my priorities. At some point, I want to merge this into a toolset, maybe even the one up above. So, no GUI. (That also means the stand-alone tool won't be around for very long.) Got any feedback? Thanks! Edit: I just downloaded Graphviz, so I am covered with DOT diagrams. I think the included library will allow me to generate DOT, too.
-
1 pointAs for operators, you should probably also make sure you know the precedence rules. I'm not sure NWScript follows the C rules there exactly. I haven't yet looked at that, since it's unambiguous in the bytecode. Oh, and also, there's another bug I've found, but I'm not sure in which games it was present. It had to do with parameter shadowing. I.e. void foobar(int blah) { int blah = barfoo(blah); } (excuse the quirky formatting, this editor is weirder than I remember) I've seen the produced bytecode use the uninitialized value of the just created local variable blah as in input for barfoo(), instead of the parameter of foobar(). Maybe something to have an eye on. Hmm, depends on how DeNCS operates. Does it also try to decompile functions that are not called? I.e. if you have an include with foobar1(), foobar2() and foobar3(), and the script itself just calls foobar1() (and that doesn't call the other functions), does DeNCS also decompile foobar2() and foobar3()? Because IIRC ncsdis completely ignores foobar2() and foobar3() in that case and wouldn't see any recursion there.
-
1 pointInterestingly though, most scripts that DeNCS chokes on do not appear to be due to recursion, at least judging by running said scripts through ncsdis, which reports the presence of recursion. In my experience, it's the use of per-planet includes that trips it up the most. The module OnEnter and OnHeartbeat scripts for Tatooine in K1 are a particularly good example of this.
-
1 pointYeah, do have a look at the nwscript directory: https://github.com/xoreos/xoreos-tools/tree/master/src/nwscript Specifically, the instruction.h: https://github.com/xoreos/xoreos-tools/blob/master/src/nwscript/instruction.h , which contains a list of opcodes (including 2 each that were introduced by Dragon Age: Origins and Dragon Age II). You might also want to look at https://github.com/xoreos/xoreos-tools/blob/master/src/nwscript/game_kotor.h and https://github.com/xoreos/xoreos-tools/blob/master/src/nwscript/game_kotor2.h for a list of engine functions and their signatures (return type + types of parameters). Alternatively, you can parse the nwscript.nss from the games yourself. If you haven't already, have a read over my blog post about disassembling the bytecode: https://xoreos.org/blog/2016/01/12/disassembling-nwscript-bytecode/ . It also shows a bug in BioWare's compiler (though that particular bug is not present in the KotOR scripts, it was fixed before KotOR development started it seems). If you want to decompile all scripts, you'll find that you're going to have problems with recursion, i.e. functions that call themselves. You need to analyze how a function leaves the stack to be able to continue with the code after the call, so you need to branch into a callee first before continuing with the caller. If the callee is the caller itself (or A calls B calls C calls A again)... that's a problem. This is essentially the halting problem, and there's no general solution, unfortunately.
-
1 point
-
1 pointSince the critical multiplier can be increased in the second game, I decided to investigate whether this would affect any Massive Criticals bonus. While Massive Criticals bonuses were added to, but not multiplied by, critical hits with ranged and melee weapons as expected, with lightsabers the bonus damage (as recorded in the Combat section of the Journal's Messages Log) was higher than expected, for both a main character and Kreia. This wasn't a result of multiplication, since bonus damage added was still within the same range as a x2 critical with Perseverance (Shien) lightsaber form active or Power Attack (x3), or both (x4), and other than Power Attack there were no other sources of bonus damage (none on normal hits or without a Massive Criticals bonus). However, a lightsaber with a Discharge Energy Cell added 3-15 bonus damage rather than the expected 1-3, which is 2-12 more: although I didn't keep track of the distribution, values approaching minimum and maximum were much rarer, which suggested something more like a normal distribution with 1d3 and 2d6 (108 outcomes) rather than 1d3 and 1d12 (only 36 outcomes). Tests with other Massive Criticals bonuses (Improved Discharge Energy Cell (1-6), Opila crystal (2-12) and black Name Crystal at level < 12 (1-4) and level > 32 (3-30)), albeit with much smaller sample sizes so far, also had bonus damage higher than expected, and didn't refute 2d6 being added. Can anyone confirm this is what's happening, and why it's happening? I know that these games are based somewhat on Neverwinter Nights, and a preliminary internet search suggests it may be something similar to overwhelming critical.
-
1 pointAfter further testing with a character using Master Critical Strike with a Keen Short Lightsaber (Nextor crystal), I'm now pretty sure Master Criticals: 2d6 (+2-12) is added to any lightsaber which already has a Massive Criticals bonus: Massive Criticals: 1d3 (+1-3) added bonus damage 3-15 Massive Criticals: 1d4 (+1-4) added bonus damage 3-16 Massive Criticals: 1d6 (+1-6) added bonus damage 3-18 Massive Criticals: 1d8 (+1-8) added bonus damage 3-20 Massive Criticals: 1d10 (+1-10) added bonus damage 3-22 Massive Criticals: 1d12 (+1-12) added bonus damage 3-24 Combining a black Name Crystal focused at level < 12 (Massive Criticals: 1d4 (+1-4)) and a Discharge Energy Cell (Massive Criticals: 1d3 (+1-3)) added bonus damage 5-18, within the now expected range of 4-19 (the chance of 4 or 19 is 1/432 apiece), so I'm also pretty sure that this bonus is only added once, and not once for every Massive Criticals bonus. As far as I can tell, the only prerequisites are using a lightsaber with a Massive Criticals bonus (any off hand (Short) Lightsaber must have its own bonus for this to be added to it as well): unlike Neverwinter Nights' overwhelming critical, level 21, Strength > 22, a Keen bonus (Improved Critical) and Power Attack aren't required.