![]() |
Nw2png2.0
3 Attachment(s)
First I want to make it clear that I did not code this tool. Alex(born2kill) originally coded it, and you can find it here:
http://forums.graalonline.com/forums...hp?t=134259601 Then Chris Vimes edited it, adding useful things such as the GUI interface and bugs. Then I took over and made some heavy modifications to it. See the original thread for basic functionality and features. Newest Features > Shows you how long in seconds it took to parse and render the map when finished. > addtiledef support, as well as subbing #L for the level name in addtiledef and addtiledef2. > Colored bodies in ganis. > Filter output toggle. Filtering the output will make resized maps look better, but it also increases the filesize by a large margin. This is enabled by default. > New input for Graal Directory. Instead of assuming your Graal Directory, it will allow you to specify it(in case it is not always in C:\Program Files\Graal\). However, it still needs FILENAMECACHE.txt to find the images, so for right now you can't simply direct it to an image folder. Features I've added > Recoded rendering. Before it was parsing and rendering NW's and GMAP's in separate functions. This meant any change to the rendering had to be worked into both functions. I've simplified the matter, making the GMAP function call forth the NW function for the levels and stitching the images together. This allows easier editing of the parsing and rendering code as well as easing up some of the heavy memory usage. > Better image scanning. It was limited in finding necessary images before, but I've changed it instead to rely on Graal's FILENAMECACHE.txt. If you need it to find an image, simply having the image in the Graal directory(doesn't matter where) will allow it to find it. This includes other resources like ganis, but does not apply to levels. The levels must be in the same directory as the gmap file! But make sure your cache is up to date. To update your cache go into your Graal folder and delete FILENAMECACHE.txt, then run Graal. It will take a moment for Graal to start up, but once it does it will have scanned its entire directory and updated the cache. > setimgpart support. It tries its best to interpret it, as well as its GS2 equivalent. > addtiledef2 support. Only if addtiledef2 is found in a script in one of the levels. As above, it does its best to interpret the GS1 and GS2 command. > Positioning code. This is in its infancy stage right now, but I'm attempting to interpret modifications to the position of NPCs via x++, x += 1, x = 32, this.x += 5 and so on. It's only as reliable as I have tested it. I'm pretty sure right now this is only applying to showcharacters, but I will soon add support for regular NPCs as well. > Basic operations parsing. Before I was simply omitting values with operations, but now I've implementing some basic math parsing, so things like x = 5*3; should work. However I can't take into account variables(at least yet, maybe in the future I can substitute some basic known variables like position into the parsing). > Gani support. I'm doing my best to interpret and render ganis. Right now they're mostly complete. I think the only thing left to do with them is to color bodies. > Browsing memory. It remembers your input selections, making it easier to get in and render. This is especially useful when working on a single map, as all you have to do is open the tool and click render, since it remembers your last options. > A batch file letting you specify a memory heap for the application. Rendering takes a lot of memory, and Java doesn't allocate very much by default. If you get a memory error, try closing and using the bat. Specify a number close to your total RAM in mb. So if you have 4GB of ram, try allocating 3600 or so. It will crash on launching if you allocate too much, so just try a lower value if it does(if you have a 64bit system, having Java 64bit will alleviate a lot of issues). > No more hanging when it runs out of memory. Now it will notify you that it ran out of memory and reenable the 'Generate!' button, allowing you to change the scale and try again. > Many bug fixes. Features Planned > Assigning images to join classes. I know a lot of servers use joins for NPCs such as doors and such, where the external class is assigning the image, leaving the parser no image info. Eventually you'll be able to keep a list of join classes, and assign them an image you want to be rendered, such as bush=bush.png. Screenshots Interface: http://i.imgur.com/Tx0vl.png Output example: Attachment 53976 This is still a Work in Progress, so expect bugs, but please let me know! The more bugs I know, the more I can address them to make this as reliable and useful as possible! |
Awesome!
|
Used wrong tiles for inside of caves. :(
|
Quote:
|
Nice!
|
Well finally got body coloring done thanks to [someone who shall not be named]! I also added a toggle for filtering the output.
http://i.imgur.com/XUIHA.png By default maps will be filtered, but filtering attempts to make distorted images(which is the case when scaling down) look better. But while they do that, they also add a lot of colors and thus can increase the file size of the map image by a large amount. For example, a filtered 1:2 map of a 3x3 gmap is ~1.5mb. A non-filtered image of the same map is only ~500kb. So it's up to you to decide if you want a better output image with a much larger filesize, or an "uglier" image with a much smaller filesize. You can compare the two images below. Filtered: http://i.imgur.com/Xtb73.png Non-Filtered http://i.imgur.com/n24hH.png |
Here's a small update.
New Features > Colored bodies in ganis. > Filter output toggle. Filtering the output will make resized maps look better, but it also increases the filesize by a large margin. This is enabled by default. > New input for Graal Directory. Instead of assuming your Graal Directory, it will allow you to specify it(in case it is not always in C:\Program Files\Graal\). However, it still needs FILENAMECACHE.txt to find the images, so for right now you can't simply direct it to an image folder. http://i.imgur.com/3ePRD.png You can find the updated files in the original post. |
An option to just render each level of a GMAP as a separate file might be nice.
|
You should put this on GitHub so it's easier to keep track of changes and contribute to. I wouldn't mind trying to fix the memory stuff if you do that.
|
There's a few problems with this latest version for me.
Quote:
PHP Code:
Quote:
http://img88.imageshack.us/img88/359/error3.gif There's also been several instances of: Quote:
It seems there's a problem with rendering multiple character ganis, they look the same for me: http://img836.imageshack.us/img836/2121/error1j.gif Aswell as a slight issue with layering, though I imagine it would be difficult to resolve: http://img577.imageshack.us/img577/2913/error2.gif Another possible future issue, is that I actually have certain common showcharacters appearance loaded via a class, like castle guard/ninja etc, which would mean their intended look not being rendered with the gani. |
|
Quote:
edit: I copied the code and put it into an NPC and the level still rendered. The NPC didn't, but that's to be expected. However, I will try to make it omit such alterations to the x/y instead of overwriting them. Quote:
Quote:
Quote:
Quote:
Quote:
ninja=skin:black,belt:black,coat:black,sleeves:bla ck,shoes:black,headimg:head17.png,shieldimg:no-shield.png,gani:idle,dir:1 |
Quote:
Quote:
Quote:
|
2 Attachment(s)
New update.
New features > The ability to split the images when you save a gmap. It will save them in a directory named after the output. So if you put overworldmap.png in the output, it will save it in parent/overworldmap/<levelname>.png. Still provide a PNG as an input though as it's expecting one. However, I will say this may be slower than generating an entire gmap since it has to create a file for each level. > Full GS2 support for Gani's/showcharacters > Fixed NPCs being cropped if they exceeded the boundaries of the level > Also fixed a bug with the scaling formula. So I've provided more scale options, and I may change it to a slider. > Parsing no longer overwrites the NPCs x/y position unless it returns a valid number. This will stop NPCs from no longer being rendered if the parser hangs on things like variables. Why can't I edit my thread anymore, dammit :( It should stop allowing edits from time of the last edit instead of time it was originally posted! |
No errors were returned for me this time which is good for generating a basic map, however no characters/ganis were rendered.
|
Quote:
https://github.com/dustyshouri/NW2PNG2.0 Quote:
PHP Code:
|
Actually it was my mistake, the gani files were not within the cache, there being no "gani file not found" error.
Edit: Now the weird thing is, I've updated filenamecache, but the program is just getting stuck on generating, there being no command prompt in the background. |
Quote:
|
1 Attachment(s)
Quote:
|
Quote:
I've made sure an older version is still working. |
1 Attachment(s)
Quote:
|
Quote:
Quote:
|
Good work dusty!
Quote:
|
1 Attachment(s)
Quote:
|
Quote:
The problem happened to be occurring with the very first top left level of the map, even if I had "Render NPCs" unticked. So I gradually removed all of the more complex NPCs to try and single out the culprit, the problem still happened, and continued until I had removed every NPC, then it managed to move onto the next level. However adding a simple image only NPC worked, whereas adding an NPC of this.join("object_bush"); caused the problem again. I hadn't actually got around to testing class images, I tried again after removing "bush=bush.png" from the text file and it's still happening. |
Quote:
|
The same thing happens if I create a blank level in the editor, add an NPC with the script this.join("object_bush");, save it as new1.nw and attempt to render that.
Error log just contained "Parsing level: new1.nw", unless I'm missing something. |
1 Attachment(s)
Quote:
Here's an updated version until the "complete" update, the render NPCs option still does nothing, but join classes are now rendered and we can see if it's fixing your issues. |
Same problem is still occurring.
|
1 Attachment(s)
Quote:
|
Will this work on terrain maps?
|
Quote:
|
Quote:
At least because of the nature of 3D terrains using the GraalEditor's mapping function the maps don't end up looking too bad. |
1 Attachment(s)
New update, and I think as far as features go I'm done. I can't think of much more to add.
New Features > The choice to disable or enable rendering and parsing(meaning quicker generation) of NPCs. It will still scan for addtiledefs. > Saving of checkbox options as well now. > Addition of error logging, you can find the logs in errorLog.txt if anything goes wrong. It will write a stack trace under the level it encountered the error in, and attempt to narrow it down to a specific function. > Definitions for join classes. You can now assign images, and even ganis, to join classes. When the parser encounters a join command it will scan ClassImages.txt for the appropriate information to render the NPC. Check the text file for more information. > Fixed more bugs pertaining to parsing. If you were having problems with it hanging on specific levels this should help. Before it was trying to parse specific variables(this.dir = 2) but was also detecting modifiers like this.dir += 2; and encountering parsing problems, causing it to hang. Fixed it by only allowing = and no operation characters to the left or right. Edit: Okay, finally got it all sorted(I hope). I think that makes all features complete, and only debugging left to do, and hopefully I've gotten rid of a lot. When most of the bugs are fixed I'll have Crono update the original post with explanations and such and the latest files. |
1 Attachment(s)
Everything appears to be running fairly smoothly now, class assigning works aswell.
One new problem which might only apply to me is that a lot of characters are facing the wrong direction, it seems to be because I also have these NPCs using a variable of "this.dirturn = true;". Another noticable error is where I was using a specific frame of a gani: Quote:
http://img191.imageshack.us/img191/8762/error1i.gif This could well be the result of setimgpart: this.setimgpart("candle.mng",0,0,32,16); A couple of things which might be useful, is the detection of a custom variable within an NPC specifically to avoid being rendered within this program, and the ability to set a different sprites.png as some servers may use a custom one, in my case the only difference is semi-transparent shadows. Being able to assign ganis to classes would be cool too. I've attached the error log incase there's anything of interest. |
Quote:
Quote:
Quote:
Quote:
PHP Code:
Quote:
Quote:
|
Quote:
Quote:
Quote:
Edit: I've tried the assigning of classes to ganis now, strangely this worked as expected: Quote:
Quote:
Quote:
Quote:
|
1 Attachment(s)
Quote:
Quote:
> I've also fixed the MNG issue > added the ability to ignore the rendering of NPCs if you use this.ignorerender = true; in the script of an NPC. However, it's a bit unreliable now, and won't apply to NPC's that aren't setimgpart or ganis, because of the way NPCs are processed(on the fly). > Fixed the setCharani(gani[frame],null) issue > I fixed the issue with this.dirturn and so on. Now only applies if the variable is this.dir. |
nice =)
you might want to get someone to edit the first post for you, and include the github link. you might as well clean the first post up a bit with bullet list of what you have added, it's hard to read what you have added, but im sure it's all awesome things (= i havent been on graal for a while, so i probably wont use it, but from what the posts in this thread can tell me, you have dont a great amount of work! ill forward the thread to Alex (born2kill) when i see him online, I'm sure he will be surprised! |
Quote:
|
| All times are GMT +2. The time now is 03:12 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.