peedeeboy

Members
  • Content Count

    82
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by peedeeboy

  1. I wonder if the X-Wing Virtual Machine will be hit next?
  2. Another teeny-tiny update: Project properties now allow user to select location of Fred Tetra's nwnnsscomp.exe Ant build script + action to compile .nss files to .ncs using nwnnsscomp.exe (right-click on .nss file -> Compile file) Added control flow snippets to Palette of .nss editor (drag and drop into code to insert snippet .nss files now open in CP1252 (Windows) encoding, so now more warning when Netbeans implicitly tries to convert to UTF-8
  3. Very small update to Project Support: Added basic Versioning support (Git, Mercurial, SVN) inc. undelete Implemented Copy, Move & Rename of Projects
  4. Amazing work, @Blue. Simply amazing :D
  5. Had a free afternoon, so added basic Netbeans Project support: Project Support Create a new OENS project with skeleton structure (working directory and target folders) Netbeans recognizes project folder and creates appropriate logical view complete with custom icon Basic actions skeleton added (new file, copy project, delete project) Project preferences skeleton ready to be extended with user preferences To Do Implement project action (copy project, rename project, delete project etc.) Extend New Project Wizard to capture KOTOR & TSL installation locations, 3rd party tools etc (nwnnsscomp et al) Add KOTOR & TSL installation locations to Netbeans favourites when new OENS project created, and open favourites window so users can drag/drop files from KOTOR/TSL to their project and vice versa Add preferences for installation location of 3rd party tools (nwnnsscomp etc.), syntax highlighting colours and so on
  6. Just finished reading the Marvel comic Thrawn #6, and noticed a little nod to the Ebon Hawk in there. The ship in the comic is just really in the background, and it isn't a perfect replica (its symmetrical) , but it seems clearly based on the Ebon Hawk design - but I thought it was a nice Easter Egg if it was planned. I wouldn't be surprised if it is deliberate, given the comic is a prequel to the Rebels cartoon, which featured the Hammerhead Corvettes On page #17 when an insurgent fleet drops out of lightspeed, we see the back of what looks like the Ebon Hawk, flying next to what looks like a YT-2000: Then on page 20, we get frontal views of the ship (there are actually two ships of this class on the page): Anyways, I thought I would share as somebody else might also get a kick out of this
  7. OENS (pronounced like the Welsh name Owens), the Odyssey Engine Netbeans Solution is/was something I've been working on. There are already a lot of great tools other authors have put a lot of hard work into - so I thought I would try and create something that has the full 'rich-client' experience that would run multi-platform, and the best way I could think to do that was to create a plugin for an existing IDE. OENS is a plugin for Netbeans 8.2 w/ Java8 designed for editing Odyssey Engine files. Sadly, it may not go much further - I'd hoped my current job would be a lot quieter than previous jobs and I would have a lot more time for my own fun projects, but sadly not Here's where I've got to (not that far): 2DA Editor Open, edit and save binary 2DA files Full Undo/Redo support! Add/remove rows and columns Move rows/columns up,down,left & right Auto-resize column width for content Rename row and column headers To Do Text 2DA support Maybe add a descriptive box at the bottom for known 2DA columns à la TlkEdit NWScript Editor Open/edit/save .nss NWScript files Full undo/redo support Basic (not 100% perfect) syntax highlighting based on the deprecated Netbeans language specification (basically regular expressions..) The palette (can) contain code snippets that can be dragged & dropped into the code (working - but I only have #Include at the moment. Suggestions?) To Do Write real lexer and parser Syntax checking Intellisense/code completion Code folding Allow user to specify location of nwnnsscomp and compile scripts or PIPE DREAM implement a Java based compiler At this rate it may be done in oooooh, I dunno, ten years??? 😂
  8. peedeeboy

    Saving Star Wars

    I think the success of Marvel really is part of the problem, sadly Every major studio is looking at their big IPs are saying "how can we make a cinematic universe out of this and crank out a Box Office hit year on year? And rake in tons of money like Marvel?!". Shareholders love guaranteed future income. Warner tried it with DC comics, Universal tried it with revitalizing their "monsters" back catalog into the "Dark Universe", and Disney are trying it with Star Wars - announcing a whole new trilogy before they have even finished the current one! Sadly, none of them seem to understand why Marvel have been able to crank out hit after hit. And IMO it's because Marvel have people like Kevin Feige at the top who know the lore/source material, care about the lore/source material, and for whom those films are an absolute labour of love that they wouldn't release if they weren't absolutely happy with. I mean it really shouldn't have been hard for Disney/Lucasfilm to find somebody already in their ranks that was that was as passionate/knowledgeable about Star Wars (erm.. George? George?? GEORGE?!!) as Kevin Feige is about Marvel comics. They could have had different directors for each film in the new trilogy, but there should have been ONE person, whose job was oversight of all those films (and R1, Solo, Kenobi etc.) with final say on creative decisions to ensure consistency and continuity.
  9. Fair point and thanks for correcting my mistake I did say that Rey's sometimes inexplicable character motivations were one of the things I thought really bad in the film. I guess the point I was trying to make (clearly very badly), is that I can see why critics loved TLJ (its a bit "arty" for a SW film) and a lot of people hated it (half naked Adam Driver with his trousers bizarrely pulled up round his chest being just one reason out of many... I mean really, does he go outside like that?). And that it is very easy to find both good and bad in the film, and discuss it objectively, without anybody criticising anybody else personally. Play the ball, not the man as they say. I don't for a minute believe so many people disliked TLJ out of some kind of prejudice. For starters, maybe I'm naive and have too much faith in humanity, but I don't believe there are as many prejudiced people in the world as disliked the TLJ. From my experience the numbers don't tally at all.
  10. I'm going to go out on a limb and say that I liked TLJ.... just! There is both good and bad in this film, so anybody's opinion either way is perfectly valid. For me, the good just.. just, ebbed out the bad. I went in wanting to love this film. I was super stoked when I heard Rian Johnson was writing and directing TLJ. Brick is one of my all time favourite films. I didn't care much for The Brothers Bloom, but I did really enjoy (apart from a massive plot hole), Looper. One thing I've thought Rian's films have been good at is world building, and I really expected his film to expand and explore interesting corners of the Star Wars universe, rather than just retread the same beats the way TFA did.. The good I liked that TLJ had some recurring themes: Learning from failure - Obi Wan's first Padawan falls to the dark side and becomes Vader. But then he has success much later in Luke. Luke fails at first in teaching Kylo, but then finds success with Rey. Yoda explains "failure is our greatest teacher", having failed himself with Dooku. Po learns from leading a bunch of people to their deaths so that he can become a true leader. Conflict - The conflict between the Resistance and the First Order. The ongoing conflict between light and dark, always rising up to meet each other. The conflict within the main characters: Luke is disillusioned with the Jedi, yet when Yoda actually sets fire to the tree, he tries to run in to save the books. Rey is falling in love with Kylo, yet knows he's a wrong-un. Holdo hates Poe's insubordination, yet hugely admires his passion. Letting go of the past to build a better future - Luke wants to burn down the last artefacts of the Jedi so that something better might rise from the ashes. Kylo wants to tear down both the Resistance and First Order for the same reason. Kylo smashes his mask and gives up his Vader fetish. I felt like this was a direct message to the audience "if you want truly great new Star Wars films, that tell new exciting stories, you have to be prepared to let go of the old characters you hold so dear". Yoda says "We are what they grow beyond. That is the burden of all masters." Sacrifice - Po sacrifices his flight group to destroy the dreadnought and is angry with Holdo for what he perceives as a lack of action, yet Holdo doesn't hesitate in sacrificing herself to save others. Rose sacrifices herself to prevent Finn's sacrifice. Luke sacrifices himself to allow everyone to escape. I liked that I left the cinema asking myself questions: If you have the power / ability to stand up for others, are you morally obliged to? When is the time to stand and fight, and when is discretion the better part of valour? When is it acceptable to order/encourage others to their deaths? Should a teacher / parent / mentor be held responsible for the actions of their charges? (One of the reasons I *vastly* prefer TSL to K1 is because it asks some interesting questions: is it acceptable to do bad things (Malachor V) if your overall intention is good? (ending a bloody war) - see Luke considering murdering Kylo..) I liked that the callbacks to previous films are much more subtle than the plot retreads of TFA: When I twigged Luke wasn't really fighting Kylo, all I could hear in my head was Alec Guinness saying "You can't win. But there are alternatives to fighting". Rey doesn't finish her training before leaving (she only had two of the three lessons Luke promised her, right?) to help her friends. Anybody can be a hero, you don't have to be of noble birth - Rey is a nobody with the power to save the galaxy, just as Luke did as a former farmhand (before Empire made him Vader's son). Luke's line about not being the Last Jedi just made me think of Yoda saying "there is another". I liked that TLJ head-on answered a lot of my criticisms of TFA: Luke mentions that there has been 30 years of peace (so the whole original trilogy conflict wasn't completely for nothing - I once joked with somebody that the First Order is called the First Order so that in the next trilogy the heros can fight the Second Order and so on), Snoke mocks Kylo for Rey matching him in combat, Snoke mocks Kylo for the mask and wanting to be Vader. I liked that there were new ship designs like the bombers, as a direct counter to the giant Dreadnoughts. (X-Wings and TIE Fighters being the only ships in TFA 30 years after ROTJ really annoyed me). I like that they allude to the old tech being due to the Resistance having to sometimes scavenge old Rebel Alliance bases. I really liked that Kylo actually has some philosophy to his actions, and isn't just Emo Kylo Ren from TFA. I thought Adam Driver's performance vastly improved. I thought some scenes were just beautifully shot. All the being said... The bad The humour is way off. In the original and prequel trilogy, the humans are playing it mostly straight, with most of the humour between them being quippy / sarcasm, as you imagine it might be in the middle of a conflict - with the slapstick comedy left to the droids. Rogue One absolutely nailed this (and now that I think about it, so did TSL). Some of the callbacks just don't work very well. I'm sure Rian thought the super-fans would freak out with delight at his references, and imaged conversations like this: Regular Fan: 'pfft. Luke milks a space cow? WTF?' Superfan 'Dood! Luke loves blue milk! It's in A New Hope!' Regular Fan: 'pffft. cloaking tech in Star Wars. That's not a thing!' Superfan: 'Dood! Captain Needa?! "No ship that small has a cloaking device"!' Only the superfans hated those references too. I just couldn't get why Rey was so mad with Luke for *thinking* about killing Kylo, but absolutely fine with Kylo *actually* killing a bunch of children. I would have been fine with her wanting to redeem Kylo, if she hadn't got so pissy with Luke. Also, Finn saying the word 'cops' really, really jarred me. Overall though, I do want to see TLJ again, just as I wanted to see Rogue One again. So I guess I liked it. I don't ever feel the need to see TFA again, not because it was a terrible film, but because I don't feel I'll get any more out of it than I did the first time...
  11. I humbly retract my spurious, slanderous allegations against KOTORTool! In my defense, your honour, I did state that I couldn't exactly remember if it was KOTORTool I was thinking of that did a 1:1 ratio... I started looking into the 2da format 2 years ago, then got distracted... and I'm getting on a bit, and my memory isn't what it used to be... I would be very interested and grateful if you would be willing to share your knowledge of the file formats. It would be really useful for my own project - it's really difficult to find information on the Odyssey file formats, especially if there are cases where they digress subtlety from the equivalent Aurora format. Cheers!
  12. When I wrote those classes, it a quick and dirty solution whilst I was still trying to figure the .2da file type out properly. I didn't really think about the GUI - conceptually, I needed a two-dimensional array, so I used Object[][]. Also, one can construct a JTable by passing it a two dimensional Array. Using Collections (such as ArrayList) one has to extend AbstractTableModel and write implement some of the methods (such as how to set data in a particular cell) oneself. And as arrays take up consecutive space in the heap memory, its a pain to add rows in the middle... Of course - you might not want to add that functionality, as for editing the existing .2da files, I believe its generally considered best to leave the existing order of rows as is, and add any new rows to the end of the file. But if you want people to be able to create .2da files from scratch - Collections will probably be the way to go EDIT: I also stored row headings in a seprate list, as that is conceptually how they are stored in a 2da file. But in the Netbeans plugin I'm working on at the moment, I will probably add them into the first column of the table model, so the user can edit them as if they were part of the data (a la the way KOTORTool does it). Again - stylistic choice based on GUI! Its a stylistic choice on your part - but most programmers think that functions/methods should have one simple purpose. It makes code eaiser to read / maintain in the long run over monolithic scripts. E.g. in this instance, you might have a public write() method that accepts the table model, headers etc. But that method will then call several private methods for each stage writeHeader() writeOffsets() writeData() etc. This means your write() method reads more like a recipe, and you can skip to the other methods as you need. Code that reads like a recipe is easy to maintain - so the theory goes. Its a stylistic choice against for consistency in this script. I copied the hex for "2DA V2.b" from opening actions.2sa in a hex editor, (because I couldn't be bothered to look the characters up in an ASCII table) so everywhere else I referred to a byte I used the hex code, rather than an integer too. Again, I could have stored "2DA V2.b" as a string, and converted it to bytes and written it out, but it was quick and easy to store the bytes as a constant because they would always be the same writing any binary 2da.... There's no write or wrong answer there, only preference! Good luck with the project!
  13. Here's a dirty big monolithic Java script to write a binary 2da file I just bashed together. It is based on the first three rows of Actions.2da and uses a Map to ensure there is one unique entry for each string in the data section - as ndix UR suggested. Obviously, you would want to split each part of the process out into a separate function... There's no real error checking or data validation either (I think spaces/whitespace would need to be stripped from user input?) - and I'm using a List of Lists of Strings for the 2da model - I don't know much about Android UI components, but for most desktop Java GUI components you need to use Collections rather than Arrays for the TableModel if you want to add / remove rows etc. Here is the resulting file opened in KOTORTool. Hopefully you find this useful - feel free to pinch any bits of code anywhere you get stuck
  14. Newline in Unix is 10 (0x0A), no? So, if you are opening a file in a text editor looking for Unix line endings and using a UTF-8/ASCII encoding, every time it finds a 0x0A byte it will interpret that as a new line. Have you tried using a simple / small file (as per my example) and checking manually in a hex editor?
  15. This is correct! Apologies for confusing things erroneously mentioning **** earlier....
  16. Your code is basically fine! Using the following test array of 2da data: String[][] data = { {"r1c1", "r1c2", "r1c3"}, {"r2c1", "r2c2", "r2c3"}, {"r3c1", "r3c2", "r3c3"} }; We should have a file with nine offsets: 0 4 8 12 16 20 24 28 32 Followed by two null bytes at the end. Edited your code just a wee bit so I could run it: public static void main(String[] args) { /* Variables */ String[][] data = { {"r1c1", "r1c2", "r1c3"}, {"r2c1", "r2c2", "r2c3"}, {"r3c1", "r3c2", "r3c3"} }; // 2da of Test data final byte NUL = 0x0; // Constant for NUL byte File file = new File("D://Temp//test.2da"); // File to write to short offset = 0; // Stores the offset /* Do the work */ try (FileOutputStream fos = new FileOutputStream(file)) { // "Tty with resources" ByteBuffer offsetLE = ByteBuffer.allocate(2) .order(LITTLE_ENDIAN) .putShort(offset); // Must be little endian for (int i = 0; i < data.length; i++) { // Loop through rows for (int j = 0; j < data[i].length; j++) { // Loop through columns fos.write(offsetLE.array()); // Write offset String cell = (String) data[i][j]; // Cast to String offset += cell.getBytes().length; // Add length to offset offsetLE.putShort(0, offset); // Update ByteBuffer } } fos.write(new byte[]{NUL, NUL}); // Terminate offsets } catch (IOException ex) { ex.printStackTrace(); } Opening the generated file in a hex editor, we get: 00 00 04 00 08 00 0C 00 10 00 14 00 18 00 1C 00 20 00 00 00 Proof: So let's check it! By converting each pair of bytes to a 16 bit unsigned int in Little Endian byte order! 00 00 = 0 04 00 = 4 08 00 = 8 0c 00 = 12 10 00 = 16 14 00 = 20 18 00 = 24 1C 00 = 28 20 00 = 32 Followed by 00 00 at the end! So apparently, you rock dood! (12 is a new line in ASCII / UTF-8, and 15 is a carriage return - so if you open the file in a Text editor and it tries to convert the bytes to text you'll get new lines when it hits those bytes.....)
  17. Exactly! TBH, I'm not 100% sure if the text in the 2da is ASCII or UTF-8 encoded, but they are the same for the major Latin characters used in English (first 128, I think). Perhaps somebody with more knowledge of the Aurora Engine than I can confirm??
  18. Looking at my code for the data section (I wrote this ages ago!), I'm pulling off one byte at a time there: r = ds.readByte(); So that section is ASCII (one byte = one character) - I believe the header and row/column names are the same? As it is only one byte, Byte Order is irrelevant here. What you will have to be careful of, is that, as mentioned above, the Java char datatype is 2 bytes long (so it can store Unicode / UTF-16) and String also stores two bytes (or more?) for each character. Java is all about Unicode. So you will need to convert each character from you application to the equivalent one byte ASCII representation and then write that array of byte[] when you write to the file. (E.g. don't pass a String to BufferedWriter or similar, because it would write Unicode rather than ASCII to the file). Hope that makes sense??
  19. Here is my scrappy Java code: /* Get offsets */ cellCount = rowCount * columnCount; // Calculate number of offsets offsets = new int[cellCount]; // Create array to hold offsets for(int i = 0; i < cellCount; i++) { // Iterate once for each offset byte[] offsetByteArray = new byte[2]; // Create new two byte array to store 16 bit number for(int j = 0; j < 2; j++) { // Get next two bytes offsetByteArray[j] = ds.readByte(); // and put them in the array } ByteBuffer offBuf = ByteBuffer.wrap(offsetByteArray); // Stuff the byte array a new byte buffer offBuf.order(ByteOrder.LITTLE_ENDIAN); // Convert the byte order to LITTE_ENDIAN int offset = offBuf.getChar(); // Get the 16 bit number (Pop fact: char is a 16 bit unsigned number datatype!) offsets[i] = offset; // Put offset in array * You are correct - there is one offset for each data item in the table. You will have already parsed the row and column headers section, so by multiplying rows * columns you know how many offsets there are. * There is no delimiter between offsets. There is however, a section break of 2 null bytes between the offset section and the data section. * This code essentially reads two bytes into an array of type byte. Then wraps that array with a ByteBuffer. This is to use the order() method of ByteBuffer to to tell Java these bytes are Little Endian byte order (Java's primitive integers are Big Endian and signed) * I then use the getChar() to convert to the Char datatype? Why? Because Char in Java is the only unsigned datatype! And conveniently, its also 16 bits / 2 bytes long, so perfect for storing these offsets. So you can cast those Chars to int and it all works.... it seems hacky, but it gets around Java's datatypes. Side note, so you can do things like this with chars: int i = i = 10; char c1 = 'a'; // integer value of 97 char c2 = 'b'; // integer value of 98 System.out.println(i + c1 + c2); // prints 215 * And yes, you are correct again that the offsets are how far into the data section each data item is - starting from the point after those two null bytes mentioned above. (so multiple data items can point to one piece of data - e.g. if you have multiple instances off **** are the offsets point to the same place) I am pulling the bytes off a stream, so I use the mark() method of the DataInputStream class to mark that point, then for each offset I read the data at that offset, then reset() back to the mark again, ready for the next offset: /* Get Data */ this.data = new Object[rowCount][columnCount]; // Create two dimensional area to hold data ds.mark(FILESIZE); // Mark start of data area int sent = 0; for(int row = 0; row < rowCount; row++) { // Outer loop: Iterate through data rows for(int col = 0; col < columnCount; col++) { // Inner loop: Iterate through columns String value = ""; // Variable to 'gather' data value ds.skipBytes(offsets[sent]); // Skip pointer to the offset r = ds.read(); // Read next byte while(r != NULL && r != -1) { // Read until we hit a null char ch = (char) r; // Convert decimal to ASCII char value += ch; // Add char to value string r = ds.readByte(); // Read next byte } sent++; this.data[row][col] = value; // Add value to 2DA ds.reset(); } } Of course - you could just read the whole file into an array of bytes in memory, and use variables to hold the mark position etc - I just chose to do this as the bytes are coming off the Input Stream rather than load the whole lot into memory and pull it apart there... I chose not to do this in case of large 2da files, but I might change my approach in future now most PCs have loads of RAM! I hope some of that helps
  20. On my first playthrough of the HK factory, I wondered the exact same thing about the force-fields and the gas traps. I wondered if Bao-Dur's infamous "Make my sacrifice matter" line (https://www.youtube.com/watch?v=e2Tqk6x3TiU) might have something to do with shutting down the reactor... perhaps having to physically get locked in there and die from radiation? However, on my second playthrough, I realised that the HK-51 droids all refer to HK-47 in the singular - implying he is there on his own: "That is unit HK-47" "Step away from the control room. That's a good droid" etc. etc. etc. So now I think that perhaps there was supposed to be a sequence before the HK factory in which Bao-Dur sacrifices his life - one on Telos surface perhaps? And that none of it was ever developed? Which would make Bao-Dur's journey full circle if he dies where the Exile first meets him (Telos surface)? My other theory is that perhaps the HK factory was a lot less fleshed out than TSLRCM makes it seem!!!!
  21. At the moment, just reading. I noticed that the binary 2DA has a kind of built-in compression - due to the file format having a 'data section' and each item in the 2da having a 'pointer' to the data section meaning that if six items were to have a data value of say '10', then rather than '10' be stored six times, the six pointers would all point to the same data location containing the value '10'. It appears that some existing tools (KOTORTool has the behavior I think - but I may be forgetting) have a one-to-one relationship between the pointers and data, so in the above example, if one were to open a 2da file in KOTORTool and save it, you will end up with a larger file size than you started with.... I've been learning the Netbeans platform recently, as it has a lot of really useful built-in things in the framework (like built in functionality to determine a file type by the first n bytes, abstraction layer between files and editor, data loading classes, syntax highlighting etc.) along with the Netbeans module system (meaning an editor solution could be easily expanded one file type at a time) would be great for making a cross-platform editor. When I've learned a bit more, I will probably have a bash at Netbeans plugins for binary 2DA (including) and .nss editing first. It's really for my own programming satisfaction rather than as a serious project, but I will be happy to share the Java with you if it would be useful for your Android project.
  22. I've uploaded some Java wrote to parse binary (v2.0b) 2da files here for you: https://bitbucket.org/peedeeboy/2daeditor It's pretty rough and ready., but feel free to pinch any if you want - just credit me. I stopped working on this as I got frustrated using Swing for UI (you have to resize the window after loading the 2da to force a repaint), and intended to come back to it after learning some JavaFX. However, after learning some JavaFX, I actually think the best thing to do to make a complete desktop toolkit would be to learn how to make plugins for Eclipse / Netbeans.
  23. http://www.gog.com/game/kerbal_space_program