Graal Forums

Graal Forums (http://forums.graalonline.com/forums/index.php)
-   Level Design (http://forums.graalonline.com/forums/forumdisplay.php?f=6)
-   -   Nw2png2.0 (http://forums.graalonline.com/forums/showthread.php?t=134265086)

DustyPorViva 11-23-2011 03:20 AM

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!

Crono 11-23-2011 03:30 AM

Awesome!

ff7chocoboknight 11-23-2011 04:21 AM

Used wrong tiles for inside of caves. :(

DustyPorViva 11-23-2011 04:36 AM

Quote:

Originally Posted by ff7chocoboknight (Post 1675127)
Used wrong tiles for inside of caves. :(

Elaborate?

Luda 11-23-2011 09:10 AM

Nice!

DustyPorViva 11-23-2011 09:11 AM

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

DustyPorViva 11-23-2011 03:21 PM

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.

fowlplay4 11-23-2011 06:48 PM

An option to just render each level of a GMAP as a separate file might be nice.

cbk1994 11-23-2011 07:14 PM

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.

ffcmike 11-23-2011 07:23 PM

There's a few problems with this latest version for me.

Quote:

Warning: Could not parse: startx+10.5;
Warning: Could not parse: starty-7;
Warning: Could not parse: startx+2.5;
Warning: Could not parse: starty-9;
Warning: Could not parse: starty-13;
Errors like this I think are occurring because of scripts that contain stuff like:

Graal Script Code:

this.this.starty 5;
this.this.startx 16;
this.startx this.x;
this.starty this.y;

this.shadow.-= 1

I believe it's with levels containing stuff like that where I've had errors such as:

Quote:

Error: Couldn't load the file classic_overworld_masterlis_03.nw
Error: Level was unable to be rendered for an unknown reason.
In this instance 2 images were randomly cut despite not containing setimgpart:
http://img88.imageshack.us/img88/359/error3.gif

There's also been several instances of:

Quote:

Warning : Couldn't render the gani "classic_player_idle_01".gani
Could the problem be usage of GS2?

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.

xAndrewx 11-23-2011 08:34 PM

http://img717.imageshack.us/img717/6217/test2cg.png

lmao

DustyPorViva 11-23-2011 11:10 PM

Quote:

Originally Posted by ffcmike (Post 1675197)
Errors like this I think are occurring because of scripts that contain stuff like:

Graal Script Code:

this.this.starty 5;
this.this.startx 16;
this.startx this.x;
this.starty this.y;

this.shadow.-= 1


Most definitely, I can only provide basic parsing, but I doubt I'd be able to do anything complex like variable tracking. However if it's causing levels not to render I will have to look further into it.

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:

Originally Posted by ffcmike (Post 1675197)
In this instance 2 images were randomly cut despite not containing setimgpart:
http://img88.imageshack.us/img88/359/error3.gif

I believe this is from me changing the method of rendering gmaps. It's where the level boundaries end, and since levels are rendered individually the NPCs aren't being rendered outside of the boundaries. Fixing this would be pretty difficult, but I think I might have to figure something out because I don't think that's passable. I guess I could make a function to scan for all setimgpart in each level of a gmap and return the list.

Quote:

Originally Posted by ffcmike (Post 1675197)
There's also been several instances of:

Could the problem be usage of GS2?

Seems I forgot to remove quotation marks when parsing GS2. Will work on that.

Quote:

Originally Posted by ffcmike (Post 1675197)
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

I never parsed character data in GS2. It was very easily to catch

Quote:

Originally Posted by ffcmike (Post 1675197)
Aswell as a slight issue with layering, though I imagine it would be difficult to resolve:

I can't say it'd be difficult, I'd just have to sort the list, but it'd be more intensive work in an already intensive function.

Quote:

Originally Posted by ffcmike (Post 1675197)
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.

Well as you can see I already plan to implement a class -> image function. I may be able to add support for character data in the format of:
ninja=skin:black,belt:black,coat:black,sleeves:bla ck,shoes:black,headimg:head17.png,shieldimg:no-shield.png,gani:idle,dir:1

DustyPorViva 11-24-2011 05:29 AM

Quote:

Originally Posted by DustyPorViva (Post 1675213)
Most definitely, I can only provide basic parsing, but I doubt I'd be able to do anything complex like variable tracking. However if it's causing levels not to render I will have to look further into it.

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.

This is fixed in the next version. Now instead of always overwriting the x/y with modifiers it first checks if it's returning a valid value.

Quote:

Originally Posted by DustyPorViva (Post 1675213)
I believe this is from me changing the method of rendering gmaps. It's where the level boundaries end, and since levels are rendered individually the NPCs aren't being rendered outside of the boundaries. Fixing this would be pretty difficult, but I think I might have to figure something out because I don't think that's passable. I guess I could make a function to scan for all setimgpart in each level of a gmap and return the list.

Fixed as well, saved the NPCs to an external list and I render them after the gmap is rendered.

Quote:

Originally Posted by DustyPorViva (Post 1675213)
Seems I forgot to remove quotation marks when parsing GS2. Will work on that.

Also fixed.

DustyPorViva 11-24-2011 06:52 PM

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!

ffcmike 11-24-2011 07:03 PM

No errors were returned for me this time which is good for generating a basic map, however no characters/ganis were rendered.


All times are GMT +2. The time now is 12:27 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.