Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Level Design (https://forums.graalonline.com/forums/forumdisplay.php?f=6)
-   -   Nw2png (https://forums.graalonline.com/forums/showthread.php?t=134259601)

born2kill 06-24-2010 08:27 AM

Nw2png
 
2 Attachment(s)
Hello everyone ;)
I've made a new tool in java which generates an PNG Image from a given level

- The latest download is attached below -

For the developers under you I've also attached the source code
Please gimme comments + Ideas of what I should add / change =D

------------------------------------------------------------------

Latest version is 2.1, by Dusty!

Patch Notes:
Quote:

Originally Posted by Dusty
Alright, I think this is it. Added addtiledef2 img,dest,x,y; and addtiledef2("img","dest",x,y); support. However, right now it scans through the levels, and doesn't use tiledefsOffline.txt. I don't seem to have the file, so I'm assuming it doesn't work or something *shrug*. So make sure you have at least one NPC on the overworld that defines the tiledefs.

I think this is pretty complete now, should be able to render most maps efficiently :)

I also included a shortcut in the folder that increases the memory heap for the program. I'm not sure if the shortcut will work for anyone else, but you can try it. It's at 1300mb, but if you right click the short cut and go into properties you can change it via changing:

-Xmx1300m

to something like

-Xmx2000m

This will allow the program more memory to render larger maps. But if you raise the number too high the program won't even manage to run.


xAndrewx 06-24-2010 08:48 AM

HTML Code:

'java' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .


born2kill 06-24-2010 08:57 AM

@ Andrew you can download the java runtime (JRE) here:
http://java.com/en/download/inc/windows_upgrade_xpi.jsp

Oh and I just saw I had a quick typo when parsing the gmap file
(Width was Height and Height was Width)
Ive attached the changed one 1.1 now

I always prefer Java since you only have to compile it
once and you can run it under every OS

xAndrewx 06-24-2010 09:03 AM

1 Attachment(s)
Haha cool-alot quicker than using the map editor!

Can you please add a tileset changer on to it- ie the tileset you want to use (I know you can just re-name pics1.png, but would be cool of an option)

rep++

cbk1994 06-24-2010 09:09 AM

Already done it, but that's pretty cool. I'm still working on the new version of mine with GMAP support so I guess you beat me to that :p.

Nice work.

born2kill 06-24-2010 09:09 AM

The image looks so smooth <3
Thanks for repp + uploading your picture =)
The changer will be added in the next version 2.0
until then we will have an auto parse of the level to read the addtiledefs =P
Also im doing a GUI version soon

Programs written in C++ / Java gives more possibilites like you can see the
image is Rendered Intepolated (very smooth) not like the usuall horrible pixeled M map (no Interpolation rendering)

Did I already mentioned that it also supports pics1.png's with alpha =) ?
oh and you can also skip Levels when creating the gmap - just dont add the
.nw level to skip in the folder and the NW2PNG will auto skip this level if it doesnt exist
so you have an alpha hole where this level should be

Actually this is the very first Alpha version I just started with this Project a few hours ago =o

Dnegel 06-24-2010 12:31 PM

Wow, this is awesome man!

Thanks alot :D rep+

born2kill 06-24-2010 04:31 PM

NW2PNG v1.2 released
Here comes v1.2 - including several changes
+ support for Tilelayers ;)

Please read the readme.txt file in the folder

WhiteDragon 06-24-2010 04:59 PM

Add anti-aliasing ;) Maybe as an option

PHP Code:

g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASINGRenderingHints.VALUE_ANTIALIAS_ON); 

Or a higher interpolation setting -- I can't really tell.

born2kill 06-24-2010 06:01 PM

Mhm I already played around with the rendering to get the best quality
Bicubic Interpolation > everything else with the Quality
I just wish I could use the Lanczos sinc Interpolation in Java =(

WhiteDragon 06-24-2010 06:08 PM

Quote:

Originally Posted by born2kill (Post 1583824)
I just wish I could use the Lanczos sinc Interpolation in Java =(

You could write it yourself :o. The weight for a given pixel using an 8-pixel window in Lanczos is [ sin(x*.25) / (x*.25) ] * [ sin(x*.25 / 8) / (x*.25/8) ]


Edit: Here is Chromium's implementation of Lanczos in C++ http://src.chromium.org/svn/trunk/sr..._operations.cc

born2kill 06-24-2010 06:38 PM

Quote:

Originally Posted by WhiteDragon (Post 1583827)
You could write it yourself :o. The weight for a given pixel using an 8-pixel window in Lanczos is [ sin(x*.25) / (x*.25) ] * [ sin(x*.25 / 8) / (x*.25/8) ]


Edit: Here is Chromium's implementation of Lanczos in C++ http://src.chromium.org/svn/trunk/sr..._operations.cc

Haha nvm im just using Bicubic untill there is something giving a better quality xD
(Even Bicubic is already perfect)

PHP Code:

g2d.setRenderingHintRenderingHints.KEY_INTERPOLATIONRenderingHints.VALUE_INTERPOLATION_BICUBIC ); 

ftw =o

Rufus 06-26-2010 08:01 PM

I haven't downloaded the program yet as I don't really need it, but it sounds like some nice work.

born2kill 06-26-2010 10:14 PM

2 Attachment(s)
NW2PNG v1.3 released

Again a new version =)

Changelog:
- Added support for normal NPC images
- Added ignorecase for "pics1.png" npcs and npcs containing "light" in their name
(Parsing of setimgpart() not added yet)
- Small source code changes

DustyPorViva 06-26-2010 10:20 PM

Quote:

Originally Posted by born2kill (Post 1584280)
NW2PNG v1.3 released

Again a new version =)

Changelog:
- Added support for normal NPC images
- Added ignorecase for "pics1.png" npcs and npcs containing "light" in their name
(Parsing of setimgpart() not added yet)
- Small source code changes

Do you plan to add the suggestion above for supporting different tilesets, and what about addtiledef2?

born2kill 06-26-2010 10:24 PM

Quote:

Originally Posted by DustyPorViva (Post 1584281)
Do you plan to add the suggestion above for supporting different tilesets, and what about addtiledef2?

Different tilesets will be added when I finished the GUI
(Selection on beginning where you can select the default tileset
when there wasnt an addtiledef in the level-script)

But currently I dont hesitate with makeing the GUI since you
can just replace pics1.png with an other tileset image to
get this tileset as default (can have alpha) ;-)

addtiledef / addtiledef2 + npc-script parsings will be added soon

born2kill 06-28-2010 08:06 PM

Hmm Im gotta pausing this project for some time since im getting really busy with irl and other things D=

(Purrr only one download after 3 days which was a
test to see if the download counter works so far)

Im going to continue it pretty soon or do at least a few small fixes
before I continue it (currently it reads npcs x/y only as integers
-> next small fix will make it possible to have them also on decimal positions)

Maybe a few more comments to the current version (+Downloads)
would help to speed up the development =o
(If you need the tool at all >.<)

xAndrewx 06-28-2010 08:14 PM

lol well it's great- I generate bravo's map with it!! :D

Please continue :(

Deas_Voice 06-29-2010 02:17 AM

Quote:

Originally Posted by born2kill (Post 1584675)
Hmm Im gotta pausing this project for some time since im getting really busy with irl and other things D=

aww..
Quote:

Originally Posted by born2kill (Post 1584675)
(Purrr only one download after 3 days which was a
test to see if the download counter works so far)

no, its broke, ive downloaded it like 4 times now because i keep deleting it after using it :o

Quote:

Originally Posted by born2kill (Post 1584675)
Im going to continue it pretty soon or do at least a few small fixes
before I continue it (currently it reads npcs x/y only as integers
-> next small fix will make it possible to have them also on decimal positions)

does it read images?
oh and, a common way to show images on a level is with showimgpart.. so that might be a bit tricky :o


Quote:

Originally Posted by born2kill (Post 1584675)
Maybe a few more comments to the current version (+Downloads)
would help to speed up the development =o
(If you need the tool at all >.<)

i'd help you to make a "drag'n'drop" for linux OS'es if you want :o
(not sure how to do this, but i could research.)

xAndrewx 06-29-2010 10:32 PM

png2nw?? :P
http://forums.graalonline.com/forums...9&d=1033436001

WhiteDragon 06-29-2010 11:51 PM

If it were bigger that'd probably be possible.

born2kill 07-01-2010 07:07 AM

Quote:

Originally Posted by Deas_Voice (Post 1584796)
aww..
no, its broke, ive downloaded it like 4 times now because i keep deleting it after using it :o

Nope its not
The counter doesnt increase for every new download - it only counts 1 download per account

Crono 07-01-2010 07:47 AM

would be interesting if the map image was real size, as in taking screenshots of each level and just piecing it without resizing. i've always wanted this feature or atleast some kind of size toggle :(

born2kill 07-01-2010 04:02 PM

Quote:

Originally Posted by Crono (Post 1585230)
would be interesting if the map image was real size, as in taking screenshots of each level and just piecing it without resizing. i've always wanted this feature or atleast some kind of size toggle :(

I also had a personal version which did it but the problem is if we keep it original size the image becomes ( 1024 * levels ) pixel big for example a 10x10 level would have 10240x10240 pixels which has an incredible size

Umat 07-01-2010 05:06 PM

What about half-size? :)

Crono 07-01-2010 08:20 PM

Quote:

Originally Posted by born2kill (Post 1585275)
I also had a personal version which did it but the problem is if we keep it original size the image becomes ( 1024 * levels ) pixel big for example a 10x10 level would have 10240x10240 pixels which has an incredible size

i know. but thats what i want :(

dusty did it by hand in the last level collab: http://forums.graalonline.com/forums...1&d=1213546629

cbk1994 07-01-2010 08:46 PM

It probably wouldn't work very well with lots of levels, even if you had enough memory on your computer. I have a 1:1 of Era's GMAP from a week ago or so and it's 70 MB.

Crono 07-01-2010 08:47 PM

yeah but for 2x2 or 3x3 gmaps it should be fine

born2kill 07-02-2010 02:45 PM

1 Attachment(s)
Hmm lemme just modify my script to also create full / half sized gmaps

Edit:
Attached - just replace the .jar file with the NW2PNG.jar in your NW2PNG folder
Be warned you can easily run out of memory since when the image is rendered
he works with RAW data meaning a 50x50 gmap could be like 1gb of ram while generating the level image before its finaly saved as .png

Also like it is scripted now he will create two raw images one for tiles and one for npcs and just mix them together in the end -> in the next release this will be fixed (So currently its useing twice the ram you usually need =s)

Crono 07-03-2010 01:36 PM

eh tried to run it for once and it said java isnt recognized as an internal or external blahblah

i already have jre installed

xXziroXx 09-17-2010 04:01 PM

Requesting sticky on this thread, such an awesome feature. :cool:

MrOmega 09-17-2010 04:06 PM

http://forums.graalonline.com/forums...0&postcount=51
yes just look at my gmap it rendered. (Note that I had to add in the NPCs but was simple and took like 5 mins maybe :P)

Soala 09-17-2010 05:09 PM

sticky plx

Crono 09-19-2010 04:24 AM

fu this aint no democracy >:[

also i still havent got mine to work...halp :(

Seich 10-04-2010 08:42 PM

Quote:

Originally Posted by Crono (Post 1585664)
eh tried to run it for once and it said java isnt recognized as an internal or external blahblah

i already have jre installed

Try adding jre to your system's 'Path' variable.

(This is for windows 7, it should be similar for all other windows based OSs)
Go to Control Panel -> System -> Advanced system settings.
http://i135.photobucket.com/albums/q130/Seichleon/1.png
Then click on the Environmental Variables button on the Advanced tab.
http://i135.photobucket.com/albums/q130/Seichleon/2.png
Look for the Path Variable in System variables.
http://i135.photobucket.com/albums/q130/Seichleon/3.png
Once you find it click on edit then, try adding something like: ";C:\Program Files\Java\jre6\bin" to the end of the string in the variable value textbox. Make sure to have the semi-colon dividing it from the variable that's before this new one.
http://i135.photobucket.com/albums/q130/Seichleon/4.png

Then click ok and ok again and try it. Hopefully it should work now.

N01ze 11-02-2010 12:36 AM

This is great, thanks :D

cbk1994 01-18-2011 09:23 AM

2 Attachment(s)
I created a GUI for this.

http://u.graalcenter.org/i/Capture%2...17.59%20AM.pnghttp://u.graalcenter.org/i/windoze.png

The source and the binary are attached. To use it, download NW2PNG.jar.zip, and launch the JAR file inside the ZIP. Most operating systems should let you double click it to open it, otherwise launch it via a command prompt with the command "java -jar NW2PNG.jar".

Changes from the original:
  • Now cross-platform compatible
  • Fixed a bug causing a crash if NPCs were at a non-integer x/y (such as 20.5)
  • Levels and GMAPs can now be scaled to a variety of scales (1:1, 1:2, 1:4, 1:16, 1:32, 1:64)
  • Now loads images from the Graal folder; you don't have to put them in images/* now
  • You can specify the tileset (selects pics1.png by default if it can find your Graal installation)
  • You can specify the source
  • You can specify the output file

If you're generating an image for a large map or the program freezes in the middle of generating an image, you probably need to increase the heap size so it can use more memory. Open a command prompt and run the program with "java -Xmx3000m -jar NW2PNG.jar", replacing 3000 with the amount of memory (in MB) you want it to be able to use.

I tested this on Ubuntu, Windows 7, and Mac. It was able to generate a 27 MB 1:1 image of Era's map (which is 14x19), although it took about 10 minutes to generate since there was a lot of memory swapping involved.

I haven't gotten born2kill's permission to do this, but since he published his source code I assume he's okay with it. My source code is released into the public domain.

Seeya 01-18-2011 09:24 AM

noiz

Deas_Voice 01-18-2011 11:12 AM

Quote:

Originally Posted by cbk1994 (Post 1623819)
I haven't gotten born2kill's permission to do this, but since he published his source code I assume he's okay with it. My source code is released into the public domain.


i think his idea was that, this code was going to be open sourced because he was talking about putting it on github or something along those lines.
i'll tell him that you updated the code when i see him online.

DustyPorViva 01-18-2011 03:10 PM

Just stops at "Generating..." no matter what I do.


All times are GMT +2. The time now is 11:43 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.