Graal Forums

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

jacob_bald6225 02-05-2011 02:56 AM

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.

WhiteDragon 02-05-2011 03:40 AM

Good work. Now release the source. ;)

Darugo 02-28-2011 04:03 AM

That's awesome :D Have you tried inputting a screenshot of something that doesn't have a actual tileset?

Luda 02-28-2011 09:06 AM

Pretty cool

Crono 02-28-2011 11:13 AM

wait i just realized it said png2nw and not nw2png, is this for real?

Fulg0reSama 02-28-2011 11:25 AM

Quote:

Originally Posted by Crono (Post 1633699)
wait i just realized it said png2nw and not nw2png, is this for real?

This, because if so I see MAAAANY good things (plausibly bad things about this) as well.

Crono 02-28-2011 11:37 AM

Quote:

Originally Posted by Fulg0reSama (Post 1633700)
This, because if so I see MAAAANY good things (plausibly bad things about this) as well.

nothing bad could possibly come of this

Fulg0reSama 02-28-2011 12:24 PM

Quote:

Originally Posted by Crono (Post 1633701)
nothing bad could possibly come of this

Think a little hard on the base concept of this and you may see something.

Crono 02-28-2011 01:17 PM

Quote:

Originally Posted by Fulg0reSama (Post 1633703)
Think a little hard on the base concept of this and you may see something.

I already know what you were implying but that's not a problem.

Fulg0reSama 02-28-2011 01:37 PM

Quote:

Originally Posted by Crono (Post 1633706)
I already know what you were implying but that's not a problem.

I suppose not now, but I'll agree to the fact there's more pros than there are cons.

Crono 02-28-2011 01:51 PM

Quote:

Originally Posted by Fulg0reSama (Post 1633708)
I suppose not now, but I'll agree to the fact there's more pros than there are cons.

When would it be o_o;?

cbk1994 02-28-2011 01:55 PM

You used to be able to hit alt + 5 to save an online level. Level stealing wouldn't be a problem.

WanDaMan 02-28-2011 07:50 PM

Brilliant concept ! Have you thought about making a map image converter?

DustyPorViva 02-28-2011 08:21 PM

Quote:

Originally Posted by WanDaMan (Post 1633733)
Brilliant concept ! Have you thought about making a map image converter?

Probably impossible. Maps lose data from being shrunken down.

jacob_bald6225 03-03-2011 06:35 AM

Quote:

Originally Posted by DustyPorViva (Post 1633734)
Probably impossible. Maps lose data from being shrunken down.

Yeah-- I can't think of any way to take a map image and turn it in to levels.

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:

Originally Posted by Darugo (Post 1633658)
That's awesome :D Have you tried inputting a screenshot of something that doesn't have a actual tileset?

Like something that I don't have the tileset for... or like a photograph?

MrOmega 03-03-2011 07:42 AM

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.

jacob_bald6225 03-03-2011 03:47 PM

Quote:

Originally Posted by MrOmega (Post 1634247)
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.

It probably isn't the most efficient technique but here is the gist:

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.

Rufus 03-03-2011 03:52 PM

I've seen this in action, it's impressive!

MrOmega 03-03-2011 04:37 PM

I'm truly impressed, brilliant!

ff7chocoboknight 03-06-2011 04:12 AM

Pretty awesome, Zippy.

Crono 03-24-2011 12:27 AM

so if the screenshot is a normal screenshot anything blocking the tiles (GUI, char, etc) are colored black while the rest is fine? hmm!

DustyPorViva 03-24-2011 12:32 AM

Quote:

Originally Posted by Crono (Post 1638504)
so if the screenshot is a normal screenshot anything blocking the tiles (GUI, char, etc) are colored black while the rest is fine? hmm!

Aye, you'd have to fill in the blanks.

jacob_bald6225 03-26-2011 05:31 AM

Quote:

Originally Posted by Crono (Post 1638504)
so if the screenshot is a normal screenshot anything blocking the tiles (GUI, char, etc) are colored black while the rest is fine? hmm!

This is also extremely useful when ripping tiles you don't have a tileset for too.

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.

Luda 03-26-2011 12:18 PM

I miss that level, lol

Mark Sir Link 03-26-2011 12:35 PM

are you still doing this in flash?

tempandrew 03-26-2011 01:53 PM

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.

Demisis_P2P 03-26-2011 02:04 PM

Quote:

Originally Posted by tempandrew (Post 1639016)
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.

Another practical sue was just posted.
This can help you build a tileset from screenshots of levels because it can identify the first time each unique tile is used.

Crono 03-26-2011 02:21 PM

so hot man so hot

jacob_bald6225 03-26-2011 10:25 PM

Quote:

Originally Posted by Mark Sir Link (Post 1638991)
are you still doing this in flash?

Ya because I'm a noob anywhere else.

Rufus 04-19-2011 11:42 PM

Quote:

Originally Posted by DARKVILLIN (Post 1644466)
For most of the Red Squares. Don't use Half Grass...it looks bad
Also for the barrels use a .png with a transparent background. Just using the tileset its fine but don't be afraid to use .pngs in levels. They can fix a lot of tile errors. Also with the path tiles that are used on the inside of a path are used better when framed out. The random water spout...delete it. This isnt zelda :) The windows. Don't use the half windows...

Besides that there weren't a lot of tile errors. Keep up the work. Hope my input willl help you.

I think you missed the point of the thread.

Aknts 04-20-2011 08:23 PM

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.