AmanoJyaku

Members
  • Content Count

    243
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by AmanoJyaku

  1. Been a while, time for an update! Writing code isn't as "simple" as using a modeling tool like 3DS Max or Maya (is Lightwave 3D still a thing?) to create 3D characters. A modeling tool uses physics; imagine being the coder who has to create the physics. Sir Amano Newton has spent the past two years unraveling NCS "physics", because NCS "god" (BioWare) didn't leave us precise notes. Let's look at we have to do to get started writing a reverse compiler: Binary, Decimal, and Hexadecimal Output Converting From Binary to Hex Printing Formatting to the Rescue What I Start To Work With Yes, I'm reading that and write code to reverse it. Looks like fun, eh?
  2. Rewriting the program again. But, this time.. wow.

    1. DarthParametric

      DarthParametric

      Is that a good wow or a bad wow?

    2. AmanoJyaku

      AmanoJyaku

      Good wow. The old code wouldn't have passed a professional review, it had dangerous things like pointer arithmetic.

      Which is fine since I'm not submitting this to an employer. But, the danger meant the program could and did develop bugs. These bugs might occur at an early phase in the reverse compilation process, but only present themselves later. This made it difficult to figure out what was wrong, and often meant fixing several layers of code.

      The new code is 10% smaller, and 100% clearer. Here's an example:

      Quote

              int Val;

              if (_at_least(CurPos, EndFile, sizeof(int)))
              {
                  std::reverse_copy(CurPos, CurPos + sizeof(int), _to_byte_ptr(Val));

                  return Val;
              }
              else { throw CurPos; }

      The contents of _at_least, std::reverse_copy, and _to_byte_ptr were all in one big function. Yuck.

      Finally, I can get back to solving what appears to be the last two problems for the reverse compiler.

  3. I haven't been paying attention for the past few weeks, but I've seen this issue periodically and it's annoying. Worse are the people who help despite the poster ignoring the instructions. This only encourages bad behavior.
  4. A time of joy, this is. Of friendship. Of family.

  5. Thanks! It's probably more complicated than this (I don't see any code explaining the XP drop on the Harbinger), but it supports the idea of examining scripts further.
  6. I was discussing XP with someone and we noticed StrategyWiki's entries sometimes deviate from our own experiences. Is anyone familiar with the XP granted for things like locks and mines? I know it's based on your level, but slightly more complicated. When recovering mines it's supposed to be 15*level, then drops to 10*level once you're five levels higher than the mine max. E.g. minor mines are max level 5, so 75XP at level 5 and 60XP at level 6; average mines are max level 10, so 150XP at level 10 and 110XP at level 11; etc... Is this always true in TSLRCM? The person I spoke with claimed they always got 15*level on Peragus, but that never happened to me. When picking locks it's supposed to be 5*level, but some locks give 10*level. How does this work? Are there thresholds like with mines, or is the award specific to each lock? What's confusing is in the Harbinger picking locks at level 6 gives more XP than at level 7, indicating a threshold. But I've seen nothing like it afterward. Are there any other XP awards that change when your level does? Other than combat, of course. Computer and repair come to mind, as some rewards are based on your level and others are fixed. I'm fairly certain that's controlled by scripts, like the computer console in the Peragus mining tunnels.
  7. In theory, an ERF can contain anything. In practice, the games look for things in specific places. You can download the file specifications here: https://neverwintervault.org/project/nwn1/other/bioware-aurora-engine-file-format-specifications
  8. The last few updates were light on samples, so let's address that. TSL's k_inc_treasure.nss: And the reverse compiler output: And the two overlapped for comparison, with the reverse compiled script labeled as "RCScript": In some cases, the number of RCScript statements matches that of the original NWScript statements, e.g. the assignment expression statement "str = pad + str;". [An earlier post referred to RCScript statements as proto-statements, and NWScript statements as complete statements. They're all terms I made up.] In others, multiple RCScripts statements combine to form the NWScript statement. The simplest example is a variable declaration with an initializer: the initializer is an expression statement that immediately follows the declaration. A more complicated example is the iteration statement, which is followed by a jump statement. Then, the body of the iteration statement (in the example, the assignment expression statement) is placed between them. The return statement is similar, however it has a slight quirk in that it starts off as regular expression statement that gets split in two. Then a jump statement is placed in between the two pieces, with the second being the original MOVSP. The first piece is modified with a new MOVSP that removes the result of the expression and all other values on the stack in order to clear the stack before exiting the subroutine. However, the ultimate is the switch statement. It's so complicated it needs its own post. It has optional parts... The final three RCScript statements are unprintable. The first clears all variables from the stack. However, this was already dealt with in the return statement. The jump statement inserted into the return statement jumps past this MOVSP and lands on the final MOVSP. Since the stack has already been cleared, this must be clearing arguments. And then the subroutine returns. To Do: Write code to generate expressions, e.g. ADDxx becomes <operand 1> + <operand 2> Regroup RCScript statements back into NWScript statements Integrate the value stack so variables can be referenced by unique names
  9. I'm not promising anything, but we'll see. I don't know how many people are coders, but I came across a series of articles on creating your own compiler. The articles are largely useless for writing a reverse compiler like this WIP, but they give some insight into how early design choices impact development later on. In part 4 the author wanted to make one change to a feature added in part 2, yet it led to multiple changes because so much was dependent on that one change. This has been my experience from the start: numerous rewrites from the ground up as I learned more about the NCS byte code. Finally, I'm past interpreting individual codes and on to interpreting statements and data structures. Statements are easy (except switch statements), but data structures will require some thought. Two different data structures could have the same member definitions (e.g. struct S1 {int i; float f;} and struct S2 {int i; float f;}), so I'll need logic to detect this. Finding structures is surprisingly easy, though. tl;dr The two obstacles left are switch statements and user-defined structs, and I'm nearly finished with switch statements. http://visualstudiomagazine.com/articles/2014/05/01/how-to-write-your-own-compiler-part-1.aspx http://visualstudiomagazine.com/articles/2014/06/01/compiler-basics-part-2.aspx http://visualstudiomagazine.com/articles/2014/07/01/syntax-analysis.aspx https://visualstudiomagazine.com/articles/2014/09/01/compiler-basics-how-to-part-4.aspx
  10. How is everyone? It's been a while... Several changes have been made to the reverse compiler, resulting in a rewrite from the ground up: All Opcodes are now properly decoded, including: RSADDx - Now able to differentiate variables from subroutine return values JSR - Number of subroutine arguments and return values fully deduced JZ - Now able to differentiate logical AND|OR expressions from if|while|for statements Subroutine signatures are now partially deduced: Number, but not types, of arguments and return values To do: Collection of type information is dependent upon evaluation of statements Proto-statements (I made up this term) are discovered: Input for recreating complete statements (I made up this term, too) int i = 0; is a complete statement int i; is a complete statement, and a proto-statement of int i = 0; i = 0; is a complete statement, and a proto-statement of int i = 0; To do: Proto-statements must be combined to recreate complete statements Error handling is slowly being added: Has helped discover programming and algorithm bugs Is meant to discover incorrect NCS files, which compilers can generate under certain conditions To do: "Full" error handling won't happen in the first release If anyone has questions I'll be happy to explain further. For now, I'm working to complete this before the two-year anniversary of starting this project. 😬
  11. @Dgt_V Yes, it's Panar. Afterward, you get the head by speaking with the droid. It's not in the droid's store inventory.
  12. Where are the Kreia underwear mods??? 😭😡🤡

    1. N-DReW25

      N-DReW25

      @DarthParametricIf you can just slice off her hand and add it as part of your Kreia Visible Body Models mod then we might finally be able to make the "Kreia dances for Vogga" mod.

    2. DarthParametric

      DarthParametric

      It will need to wait until we get working deepfake VO generation. Then it can be part of the Kreia romance mod that @Snigaroo has been dreaming about for years.

    3. N-DReW25

      N-DReW25

      Now THAT I can wait for!... (In a good way)

    4. Show next comments  3 more
  13. You may have been bitten by the polar academy bug. Install TSLRCM if you haven't already; it fixes that bug. Unfortunately, I think you'll have to start a new game.
  14. What do you mean "the script won't work"? Does it compile? Do you even know if the script is running?
  15. Try this: https://steamcommunity.com/app/208580/discussions/0/541906989387634015/
  16. It depends on the version you have. If you get it from Steam and choose the default install you get 4K/5K support.
  17. What about modifying autobalance.2da? From what I understand, most enemies are Set_3. So changing vpmult from 0.65 to a higher value, e.g. 1.3 to double enemy VP, might work. https://strategywiki.org/wiki/Star_Wars_Knights_of_the_Old_Republic_II:_The_Sith_Lords/Autobalance
  18. Are you sure you aren't mistaken? No source exists for either k_pend_area01.ncs or k_pend_area02.ncs; did you reverse compile them? If so, that would explain why you don't see includes. There could be a number of reasons why a script exists but is unused. For example, rushing to meet the deadline and forgetting to delete the unused script...
  19. I used to wonder about her vibroblade, as well. What I determined is it's purely an early-game weapon: Mission is supposed to use it until you free Zaalbar Zaalbar/Canderous is supposed to use it until you get something better The Prototype Vibroblade is better in every way, so your primary sword-wielder will use that. You will have a light saber. Which leaves the third member. Unfortunately, Mission's Vibroblade easily gets outclassed soon after you become a Jedi. Keep in mind vibroblades are meant to be off-hand weapons, the best damage comes from vibroswords. Mission's vibroblade is better than the standard vibroblade., but it's still weak. As for Mission herself, she makes a lousy sword-wielder because: She has low hit points as a scoundrel She starts with Dueling, wasting a feat She's a scoundrel, so she has the fewest feats She's a scoundrel, so she has 5-6 fewer points in Attack She's a scoundrel, so she doesn't have the best armor unless she also has Dexterity mod +4/5 Taking all of this into account, Mission doesn't have the levels needed to overcome the limitations of her starting class. Even if you modded out the attributes and feats, the class progression is a problem. Mission is meant to wield a singe blaster. Bump up her Dexterity and Intelligence, equip her with the Baragwin Shadow Armor and Cassus Fett's Heavy Pistol or Sith Assassin Pistol, and let the combination of Master Sniper Shot and Sneak Attack drop enemies like flies.
  20. Are you turning Mission into a badass swordsman? 🤣She's the only person I can think of who'd benefit from Finesse since the rest of the non-Jedi organics in your party are biased towards strength. In my experience, Dexterity is more significant in TSL. What kind of character are you building? I've got charts on character builds since the underlying mechanics is my greatest interest. Other modders produce HD models and textures, I calculate numbers.
  21. I have three versions of NWNNSSCOMP and would like to know which is the "correct" version for KoTOR/TSL. Are there others? The versions I have: v0.03b, Edward T. Smith, Hazard, tk102 (splint into two exe's, one for K1 and one for TSL) 1.02, Fred Tetra 1.3, Hazard Possibly an earlier version of v0.03b? I'm curious because I found two severe bugs in v0.03b, which I assumed was the latest.
  22. @iFoRias In any forum it's always a good idea to send a direct message to the OP (or whoever currently manages the thread) if the last post is over a month old. If they're still active they'll respond and/or update the post. If they're not you should create a mod request and reference the abandoned mod. It's also a good idea to read the forum's rules, as most forums explain what you should and shouldn't do. In this case: We're fairly easygoing here, and the rules help make things easy. Have fun!
  23. Seems someone at Disney realized The Bad Batch is at its best when it's telling the core story. The last two episodes were damn good.