Create a level from image

View previous topic View next topic Go down

Create a level from image

Post by garamond on Sun May 10, 2015 10:42 am

This is a short tutorial how to create a level from a detailed image with lots of pixels, which may be converted in mines or gold (or any other object).



Go to http://goo.gl/pvVdtF, where you'll see the code, which makes the level. On the left there is main.py, image.png and level.txt.

If you double click on image.png, you see an example image which I used to create a level called EddyMatagallos Conspiracy Theories, which I published some time ago. That's right, I made the image in Photoshop and imported it with code in N editor. However, I feel there is a huge unexplored teroritory here, in creativity of creation!

To create your own level, you'll have to change that image.
Image has to be exactly the same size 124 x 92 pixels. It has to be PNG. The color of pixels, which are used for the level is important (it's #c0a300 or 192, 163, 0)

In the website select "root" folder, go to File->Upload File, upload your image. Delete the old image and rename your image "image.png".

Then you press "Execute", double click "level.txt" and there is your level data, which you copy to N Editor. Yeah!

If you want mines, change text on line 159 from "gold" to "mine".

_____
garamond

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by patfelix on Sun May 10, 2015 2:34 pm



Last edited by patfelix on Sun Jul 03, 2016 3:22 am; edited 1 time in total

patfelix
Admin

Messages : 25
Joined : 2015-04-26
Age : 16
Location : United States

View user profile

Back to top Go down

Re: Create a level from image

Post by Nimit on Wed Mar 16, 2016 8:25 pm

Hi garamond
I made a picture in paint of required pixels. I upload it on root folder and it pops up something saying [object Object]. I click Yes. Then I delete the image.png but again [object Object] comes up. I click yes again and it doesn't delete. I need help.
Thanks.
avatar
Nimit
Admin

Messages : 42
Joined : 2016-02-03
Age : 17
Location : India

View user profile

Back to top Go down

Re: Create a level from image

Post by shomman on Wed Mar 16, 2016 9:19 pm

Dude. That is so cool. Really impressive. 

Nimit: Did you follow all the instructions? The image has to be:
"size 124 x 92 pixels."
"It has to be PNG"
Colour "#c0a300 or 192, 163, 0"

I know you said you got the size right, but if these aren't all correct it won't work, according to garamond.

_________________


Two time Npoints Winner - Npoints Season 2 Npoints Season 3

shomman
Admin

Messages : 192
Joined : 2014-06-01
Location : Australia

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Wed Mar 16, 2016 9:27 pm

I checked and the code doesn't work anymore - it wasn't saved on the website. Although it worked at the time I posted it.

However I will post the code either here - and you will have to install python etc ... or hopefully on some website which would be much easier to use (on the site from the first post I can't get it to work, and I can't find a new one trivially since it requires uploading files and PIL Libraray).

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by Trollking on Thu Mar 17, 2016 2:29 am

nice :)
avatar
Trollking
Admin

Messages : 136
Joined : 2014-04-17
Age : 19
Location : Australia

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Sat Apr 30, 2016 6:34 pm

Hello,

I made a simple Windows application for this, since it stopped working online.
Download it from here: http://www.filedropper.com/imageton

1. (once) You unzipp it, and just run the exe.
2. Select image which you created. Two sample images are included, so you can copy the exact colors for objects.
3. N Level data is generated and copied to clipboard. Paste it in N editor.


Most objects are supported. Use it for whatever (you're creative!), just don't use too many objects so the game doesn't become too slow.

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Sat Apr 30, 2016 6:38 pm

Screenshot:

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by shomman on Wed May 04, 2016 10:29 pm

Garamond - I see your example ones - damn that's awesome. It didn't work for me - When I tried and pasted the code in, nothing loaded.

"%Level name#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#"

That's all that ever comes up as the copied code.

_________________


Two time Npoints Winner - Npoints Season 2 Npoints Season 3

shomman
Admin

Messages : 192
Joined : 2014-06-01
Location : Australia

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Wed May 04, 2016 10:35 pm

What I noticed is if you close the program before you paste level code somewhere, it is empty. Try selecting an image, waiting a few seconds, pasting the code, and then closing the app (althoug it's not necessary to close it).

Use my example images first, they should work.

Yes, I did these two images (Photography I and II) with the help of this program, but I also did Photoshop script. So it automatically generates images.

I'll also post a newer version of the program which supports all objects, except exit door.

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Wed May 04, 2016 10:38 pm

Edit: strange - can you send me a picture you are trying to convert?

General thougths:
- it has to be exactly the same width and height as my picture
- it has to be .png
- probably all-color normal png, no strange black-and-white saved pngs
- better no transparency

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by shomman on Thu May 05, 2016 1:14 am

Ah, my images are not the same size. That's the issue. How can I make my image the same size?

_________________


Two time Npoints Winner - Npoints Season 2 Npoints Season 3

shomman
Admin

Messages : 192
Joined : 2014-06-01
Location : Australia

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Thu May 05, 2016 6:13 am

Hmm. I suggest you copy my image which you downloaded my program, and simply change it. Just change pixels that you don't need to background color. Pixels that you do need have to be exactly the same colour - the same RGB values.
I can help you more if you tell me which program you use for image manipulation?

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by shomman on Thu May 05, 2016 8:09 am

ah, right ok. 
I don't have a program for image manipulation.

_________________


Two time Npoints Winner - Npoints Season 2 Npoints Season 3

shomman
Admin

Messages : 192
Joined : 2014-06-01
Location : Australia

View user profile

Back to top Go down

Re: Create a level from image

Post by Nimit on Thu May 05, 2016 10:41 am

Hi garamond,
I'm glad that you actually fixed the program, however it doesnt seem to work for me :(
Whenever I open the image to n.exe file, it pop up an error saying failed to load image from the file D:/Miha/N2/creation/image to level/icons/N-icon.ico". I click ok and after that the program doesnt work. the fault isnt in my picture because I tried those pictures you gave, those also dont work.
PS: those levels were great !
avatar
Nimit
Admin

Messages : 42
Joined : 2016-02-03
Age : 17
Location : India

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Thu May 05, 2016 5:25 pm

Hello everyone, program is updated with support for all objects except exit door: http://www.filedropper.com/imagetonv2

@Nimit
That was an error in my program. Let me know if new version works for you.

@shomman
Everybody has an image manipulation program, I simply meant something like Painter in Windows. You use color picker and pencil (circled red).

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by Nimit on Thu May 05, 2016 5:45 pm

garamond wrote:Hello everyone, program is updated with support for all objects except exit door: http://www.filedropper.com/imagetonv2

All right, thanks garamond. My pc is down ATM. I'll try this as soon as it's fixed :)
avatar
Nimit
Admin

Messages : 42
Joined : 2016-02-03
Age : 17
Location : India

View user profile

Back to top Go down

Re: Create a level from image

Post by shomman on Fri May 06, 2016 10:37 am

Ahh, OK. I am no good at art, so I can't make these images. No worries, still a really cool program.

_________________


Two time Npoints Winner - Npoints Season 2 Npoints Season 3

shomman
Admin

Messages : 192
Joined : 2014-06-01
Location : Australia

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Fri May 06, 2016 5:03 pm

Well ... I did 10+ levels and only published the best 2. It took me whole day to develop the tools. (Although I can now automatically make a photography level in a few minutes.)

Shomman, your levels are also visually estetical. But you can use it for non-art levels too. For example this Fujita's level:

You can easily make drones in image and then import it. Although you would still have to change level code for different types of drones :P
Image for the program:

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Mon May 23, 2016 11:03 pm

I noticed the link for a program that I posted stopped working (from the N user level by sylvyr).
Sending a new one now: https://spaces.hightail.com/space/J2slB

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

Re: Create a level from image

Post by vrugtehagel on Sat May 28, 2016 9:40 am

I love this. I'll definitely look into this, perhaps I'm able to convert it javascript, so that I can add it to the N-CodeEditor (if I get your permission for that, of course).
avatar
vrugtehagel
Admin

Messages : 34
Joined : 2014-04-25

View user profile

Back to top Go down

Re: Create a level from image

Post by garamond on Sun May 29, 2016 10:15 am

Hi, this is the source code. Maybe you can use it or maybe it will take you the same amount of time to write it yourself - it's not documented or well written.

garamond
Admin

Messages : 21
Joined : 2014-11-16

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum