UnderwareDesign
May 21, 2013, 04:56:16 PM *
News: Code Conversion - Convert Amos To PlayBASIC  (2nd,April,2013)
   Home    
Pages: [1]
 
Author Topic: Play-Pic2Map (Convert Images To maps)  (Read 1104 times)
Member
Development Team


WWW
« on: January 22, 2012, 01:07:22 PM »




  Visit www.PlayBasic.com

 
Play-Pic2Map (WIP THREAD)


   This thread will contain update information/ideas/changes etc that are being made to Play-Pic2Map application.  


 What is Play-Pic2Map?

      It's a tool to assist PlayBASIC users, convert Image into something that can be drawn as a map. The user loads the image into the program and it  exports a tile map, and an image containing the unique blocks used.  


 Features

     * Pretty Fast Conversion.


 

Beta (Work In Progress) Downloads

      None.




Release Download

      Download Play Pic-2-Map  (Home Page)



Logged

Member
Development Team


WWW
« Reply #1 on: January 22, 2012, 01:25:19 PM »

 
Play-Pic2Map V0.01 - Cut'N'Paste Application Building

       This is one of those little tools that just comes in handy every now and then.. The concept is that the users loads a (large) picture, then the tool runs through and cuts it up into a set of unique blocks with an tile map.  Pretty straight forward stuff, but handy none the less.    So far i've really just cut 'n pasted the application together from the standard frame work, with the a cleaned up version of the tile ripping routines.     Interestingly,  i've written a few of tools over the years, the last time dates back to something like like 17 or 18 years ago,  where a friend and I threw together a similar app on the Amiga to convert images into tile maps, called Jabber Blocky.    

       So far the app loads the image, cuts it up and saves it out.  It's all been pretty painless so far, it does need some settings though. So i'll need a bit of tinkering presenting the info to the user.  Just some controls to set the Block Width/Height in the grabber and a little viewer at the end..



Play-Pic2Map-V001.png (109.27 KB, 808x634 - viewed 56 times.)
Logged

Member

« Reply #2 on: January 22, 2012, 03:32:26 PM »

Here's something similar for Blitz that does the same job and spits out the map code, map data and sprites.

I'm sure it wouldn't be difficult to convert the outputted code to PB.

http://socoder.net/uploads/214/maprecon.zip

[EDIT] I should have stated that the app is a Windows .EXE (and not a Blitz program), but that it can output Blitz code for the maps, but it will still work without Blitz.
Logged
Member

« Reply #3 on: January 23, 2012, 08:06:01 AM »

I had a feeling you used a program.
This is really awesome.
I could use this for splitting up and fetching more tiles from tile rip images.
I can't wait till this tool is ready.

Btw Kevin, I changed a few things in my game engine and now it doesn't use a large image at all.
The memory consumption went from 450, 000 kb to something like 91, 000 KB
It varies depending on what sprites/images are in memory but this engine by far takes up the most memory out of everything I've had.
I think if I fixed up the image formatting it would show even more improvement.

But yeah. I WANT THIS APPLICATION Tongue it would make so many of my projects way easier in the future

When is it going to be ready?
Logged
Member
Development Team


WWW
« Reply #4 on: January 24, 2012, 03:17:36 PM »

 
Play-Pic-2-Map V0.03 - That'll Do Pig, That'll do....

       Put a bit more work into this tonight, the functionality hasn't really changed from the initial version.  You still load the image and it cuts it up and dumps out the files.  The only change has been adding some dialogs so the user can set the rippers block size, as well as a percent bar (which basically slows the process down Smiley ) and viewing mode at the end..    The ripper supports blocks as low as 2x*2y, bellow that and it's just palette mapping the image.    

        Here's a bit of video showing the entire process, will probably give it a bit of clean up pass and then release it as is..

      

Logged

Member
Development Team


WWW
« Reply #5 on: January 25, 2012, 03:18:30 PM »

 
Play-Pic-2-Map V0.04 - Double Packing Pictures

    Ok, so what these types of programs do, is they compress the original source image  by removing any redundant repetitive parts, leaving us with the unique parts and the data on how the blocks are to be reassembled, to recreate the original picture.    Now the thing is, even though your picture might be laid out on a 32x by 32y grid, this may not be the most efficient size for the blocks, as sections of the unique blocks may indeed repeat also.

    So what you can do, is re-compress the 32 by 32 unique blocks down into a smaller sizes (eg half/quarter).  Now for the sake of an example, i took the Castle Map and converted that into a 32 by32 block map with level map.  In raw terms, we're converting the 25 meg (512x * 12256y * 4 byte ) level image and compressing it down to approximately 430K total.  Now this process creates a unique block map image that's 320x*320y, which is the bulk of the 430k,   but rather than keep this block image, we then pass it back through Pic-2-Map again.  This time using a block size of 8 By 8 to further reduce, which spits out a 178x*178y block map + level weighing in at only 128K.   

   Long story short, this means the original 25 meg picture can be represented (on disc at least)  in only 145K without much effort at all.   To load the map is a little messy, since it means we've a two pass process.  First we load the 8*8 blocks + level, then render this level out to an image, thus creating the 32 by 32 block map image in the process.    Once that's created, we can delete the 8 by 8 map (don't need it anymore), create a new map, import the 32 by 32 blocks into the map, then load the 32*32 level.  

   There's a number of benefits that come to mind, but the most obvious one with such an approach, is that just by paying a little more attention to the size of source media, we can make a dramatic impact on overall size of our final game.   

   Anyway,  I've attached the example bellow...  

Map_Double_Pack.zip (31.56 KB - downloaded 4 times.)
Logged

Member
Development Team


WWW
« Reply #6 on: January 26, 2012, 01:13:20 PM »


 Released V0.05 of Pic2Map.  Download in first post


Logged

Member

« Reply #7 on: January 26, 2012, 09:57:51 PM »

Kevin I think you are the most awesome programmer I know.
I was having a hard time manually extracting the unique tiles from these large world map images of DKC2 levels, and when I first began editing them with gimp I realized alot of those resources were aligned with a 32*32 grid.
The fact that your program was able to redraw all the tiles properly proves they were sized at a proper 32*32 grid.
Which means, I can begin the process of tile ripping these images.
You saved me a ton of work with this program and I am so grateful.
Thank you.

The previous tileset I was using was incomplete, and the ones I saw online were also incomplete. This will make alot of future projects for me easier.

Logged
Pages: [1]
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2009, Simple Machines LLC | Privacy Policy Valid XHTML 1.0! Valid CSS!