![]() |
Png2nw
2 Attachment(s)
So I worked out how to take a png and turn it into a playable level. I figured I would share.
I took this level(I don't think Bartholomew will mind-- I doubt he even has this level anymore): http://forums.graalonline.com/forums...ad.php?t=75934 And produce a level(attached)! Notice how the npcs that were in the screenshot lay down the corner of a block, so this isn't really feasible with a level that has lighting effects or tons of npcs. Not much else here-- just figured I'd share what I've been working on. If you have a level that you want recovered from a screenshot throw it in here and ill have a run at it. |
Good work. Now release the source. ;)
|
That's awesome :D Have you tried inputting a screenshot of something that doesn't have a actual tileset?
|
Pretty cool
|
wait i just realized it said png2nw and not nw2png, is this for real?
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
You used to be able to hit alt + 5 to save an online level. Level stealing wouldn't be a problem.
|
Brilliant concept ! Have you thought about making a map image converter?
|
Quote:
|
Quote:
For example -- if two tiles shared the same pixels just arranged in a different fashion(a mirrored version of the same tile like roof corners) it'd be impossible to differentiate. Quote:
|
How is this possible? How do you define the actual tile orgins since not all screenshots are aligned? What is the average time it takes to compile a image to level? Say a 640x480 png for example.
|
Quote:
Scan the tileset: Scan each pixel and put the RGB in to a string: So RGB(0,0)+RGB(0,1).....+RGB(16,16). Since each tile is 16x16 pixels. After the tileset is scanned it saves the information to the computer so you don't have to rescan for each level. Then it loops through and checks each pixel of each tile in the screenshot(which is aligned and 1024x1024 pixels). If it matches a tile it adds that tile to a "recently used" array of tiles which get priority checking(so you don't have to loop back through the entire set of tiles after it gets cooking). Each tile is synced up with the tile hex value(like "AE", or "/3". When it finds the tile it plops down the hex value in the level string. Right now it doesn't save files but outputs them as plaintext which you can copy paste in to a graal file and save with a text editor to get your level. If the tile is unknown it puts a blackness tile so you can easily tell which tiles are missing. All in all if the tileset is already scanned IIRC(it has been a few weeks since I generated a level from this). It pumps out the plaintext level in like (EDIT) 50 seconds which I have recorded in a video. (Does this even make sense to anyone else?) tl;dr: 1. Tileset scanned-->in order of the corresponding tile hex values. 2. Level is scanned tile by tile and plops out the hex value of the tileset tile that it matches. 3. Plaintext level is made and copy pasted in to a .nw with a text editor. Again, this is probably not the best way to do this-- but it works. (EDIT)Main problem here is I have it set up to do multiple levels in a row and as there are more tiles added to the priority list it begins to slow down-- I have a video of generating 6 levels in a row in 6:35 seconds. |
I've seen this in action, it's impressive!
|
I'm truly impressed, brilliant!
|
Pretty awesome, Zippy.
|
so if the screenshot is a normal screenshot anything blocking the tiles (GUI, char, etc) are colored black while the rest is fine? hmm!
|
Quote:
|
Quote:
Here is an example of ripping tiles due to this perk: Step 1: Find a level to rip: http://i.imgur.com/YAcios.jpg Step 2: Run it through without a defined tileset: http://i.imgur.com/ctzhcs.jpg Step 3: Build the level from the output. Yellow tiles are unique tiles that appear for the first time. Any time another one of these tiles shows up it is colored green: http://i.imgur.com/0un1fs.jpg Step 4: Overlay the built level with unknown tiles and rip the unique tiles(which were colored yellow in this example). http://i.imgur.com/p9tXAs.jpg From there you jump in to photoshop and put the tiles in their right behavioral spots(block/not) and regenerate until you have no missing tiles. Plus side to this is that there are no duplicates when ripping them out. |
I miss that level, lol
|
are you still doing this in flash?
|
This is truly, really impressive. I'm not sure how much practical use this would have, however, other than possibly reviving old levels from screenshots people might have laying around.
Regardless, this is really something. Well done. |
Quote:
This can help you build a tileset from screenshots of levels because it can identify the first time each unique tile is used. |
so hot man so hot
|
Quote:
|
Quote:
|
That's cool. There are a lot of levels I have posted on here that I don't have anymore.
|
| All times are GMT +2. The time now is 06:09 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.