Author Topic: Tools for converting levels to bitmap?  (Read 2555 times)

0 Members and 1 Guest are viewing this topic.

Offline Ron_Stard

  • Posts: 200
    • View Profile
Tools for converting levels to bitmap?
« on: April 25, 2017, 08:21:09 pm »
Are there any program susceptible to use for batch-converting Lemmings and Lemmings 2 levels to PNG or bitmap format?

Offline Nepster

  • Posts: 1786
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #1 on: April 25, 2017, 08:26:36 pm »
For lemmings levels, you can load them into NeoLemmix. NeoLemmix has a hotkey (default is "I") that saves the current frame (including any lemmings, ...) as a png. If you have them as a NeoLemmix level pack, then you can even press "F5" on the main screen and mass dump images of (the initial state of) all levels in the pack.

Offline Ron_Stard

  • Posts: 200
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #2 on: April 26, 2017, 10:26:16 am »
Thank you for your help! But while pressing "I" works fine on both Lemmix and NeoLemmix players, the F5 hotkey doesn't seem to work on NeoLemmix (on Lemmix, it extracts all the levels individually to .LVL format, which is not what I wanted, but is also pretty useful for me).

Offline Simon

  • Administrator
  • Posts: 2561
    • View Profile
    • Lix
Re: Tools for converting levels to bitmap?
« Reply #3 on: April 26, 2017, 11:12:25 am »
I don't know level-to-image dumpers for L2. There is L2 format documentation on Mindless's Lemmings Archive.

If you write your own image dumper from these hacking notes, feel free to ask questions. geoo has written code for PCL2ED to load tilesets and levels, and code for C++ Lix to load tilesets only. But writing your own might be too much work for what you had in mind with the images. :-)

-- Simon
« Last Edit: April 26, 2017, 11:23:43 am by Simon »

Offline Ron_Stard

  • Posts: 200
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #4 on: April 26, 2017, 11:52:00 am »
Thank you for the info! I am planning to do a simple drag and drop level2image converter in AutoHotkey. I thought I could rely on any console program some of the conversion work. But I have no problem with writing everything almost from scratch. I will have a look to those codes :thumbsup:

Offline Nepster

  • Posts: 1786
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #5 on: April 26, 2017, 04:30:31 pm »
[...] the F5 hotkey doesn't seem to work on NeoLemmix (on Lemmix, it extracts all the levels individually to .LVL format, which is not what I wanted, but is also pretty useful for me).
When creating a level pack, one has the option to disable both dumping the level files and the level images. But I am not aware of any pack that uses this option, so I forgot to mention it in my first post. Sorry.

Offline Ron_Stard

  • Posts: 200
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #6 on: April 26, 2017, 05:05:23 pm »
When creating a level pack, one has the option to disable both dumping the level files and the level images. But I am not aware of any pack that uses this option, so I forgot to mention it in my first post. Sorry.

So, there is no way to extract the .LVLs from a .NXP file?

Offline Nepster

  • Posts: 1786
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #7 on: April 26, 2017, 05:16:00 pm »
It depends: In most packs "F4" on the main menu does the job. But if the pack creator explicitely disabled that option when creating the level pack, then you are out of luck (though namida and I can get even around that).

Offline namida

  • Administrator
  • Posts: 8439
    • View Profile
    • NeoLemmix Website
Re: Tools for converting levels to bitmap?
« Reply #8 on: April 27, 2017, 10:31:18 am »
With Lemmix players (at least if they're my updated versions, which add the mass dump features), you'll want to use F5 for level dump and F6 for image dump, IIRC.

I can probably put together some kind of command-line app that does this for you if you like. Do be aware it'll be based on NeoLemmix code, so (a) special graphics levels won't be supported, as NeoLemmix doesn't support that anymore (instead, NL "special graphics" levels are created by using a custom tileset with a very large terrain piece, and handling objects by taking advantage of NL's ability to mix multiple tilesets in one level), and (b) there may be some very minor differences, such as that NeoLemmix has differently-colored one way arrows for the Snow graphic set than DOS L1 / Lemmix do.
My released level packs:
Lemmings Plus Series | Doomsday Lemmings

Offline Ron_Stard

  • Posts: 200
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #9 on: April 27, 2017, 10:54:48 am »

I can probably put together some kind of command-line app that does this for you if you like. Do be aware it'll be based on NeoLemmix code, so (a) special graphics levels won't be supported, as NeoLemmix doesn't support that anymore (instead, NL "special graphics" levels are created by using a custom tileset with a very large terrain piece, and handling objects by taking advantage of NL's ability to mix multiple tilesets in one level), and (b) there may be some very minor differences, such as that NeoLemmix has differently-colored one way arrows for the Snow graphic set than DOS L1 / Lemmix do.

That would be enough, thank you for your help! I'll post the AutoHotkey GUI code for the converter I have planned in this thread, later at night.

Offline Ron_Stard

  • Posts: 200
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #10 on: April 27, 2017, 06:46:07 pm »
This is a screenshot of the GUI I am planning to do (almost finished):



The code is attached below. For testing it, just download AutoHotkey and drop the LvL2img.ahk file into it.

(Of course, notice that it's not finished yet, since there are still no calls to any console command able to convert LVL nor NXP to images).

Offline Simon

  • Administrator
  • Posts: 2561
    • View Profile
    • Lix
Re: Tools for converting levels to bitmap?
« Reply #11 on: April 28, 2017, 06:48:25 am »
Hah, awesome. Are you planning to write all code in AHK? Or are you building the GUI with AHK and plan to call a command-line tool from the GUI?

It looks like you will outsource the hard work to a command-line program, I like this approach. Interesting that AHK is so easy to make GUIs with. I knew it had extensive scripting.

-- Simon

Offline Geoff

  • Posts: 33
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #12 on: April 29, 2017, 07:25:58 pm »
I don't know if this might be of use to anyone?




Offline Ron_Stard

  • Posts: 200
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #13 on: April 29, 2017, 07:57:49 pm »
I don't know if this might be of use to anyone?

That's great! Exactly what I wanted to program!
It seems it crashes with Holiday 93, and can't extract Lemmings 2 levels, despite including that game inside the .ZIP

Offline Geoff

  • Posts: 33
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #14 on: April 29, 2017, 08:34:58 pm »
I can't really help you with the crashes. its a unfinished program i found on the net a couple of years ago. 

Offline namida

  • Administrator
  • Posts: 8439
    • View Profile
    • NeoLemmix Website
Re: Tools for converting levels to bitmap?
« Reply #15 on: April 30, 2017, 09:10:03 am »
Here you go. :)

If you need to use any additional graphic sets other than the ones included (which is all the ones that come with NeoLemmix), just put them in the "styles" folder.

Command line parameters:
-o [path] (Sets ouptut directory; if not set, output dir = input dir for each file)
-bmp (Saves BMP files instead of PNG)
-cpm (Saved images are as the level would appear in Clear Physics Mode)
-nbg (Saved images are as the level would appear with NeoLemmix's "Disable Backgrounds" option activated)

All other command line parameters are assumed to be an input filename (you may give more than one per execution). Aside from that the output path must come immediately after -o, there is no requirements as to what order the parameters / filenames are in. Wildcards ? and * are supported in input filenames.


Compatible with:
- All modern NeoLemmix LVL files
- Most older NeoLemmix LVL files (exceptions: those that use VGASPECs)
- Most DOS / Lemmix LVL files (exceptions: those that use VGASPECs; those that use a non-standard graphic set numbering system), including those that come with Win95 Lemmings

There is no support for (Super)Lemmini levels, and while it might work, I don't think it'll work properly with the NXLV format that NeoLemmix will be transitioning to in the future (if in the future anyone does want an NXLV-compatible version of this, let me know at that point in time).
My released level packs:
Lemmings Plus Series | Doomsday Lemmings

Offline Ron_Stard

  • Posts: 200
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #16 on: May 02, 2017, 12:01:12 pm »
Thank you for coding it! I'll post the complete GUI source code to use it in the following post. I hope I can do it within the next 2 or three days. :laugh:

Offline Ron_Stard

  • Posts: 200
    • View Profile
Re: Tools for converting levels to bitmap?
« Reply #17 on: May 03, 2017, 09:12:55 pm »
Ok: this is a very simple functional version of the GUI ready to use, but without parameters for namida's converter (I will change the GUI in the next days for including them via checkboxes and all that stuff). Decompress everything in a folder of your choice, and move there the latest AutoHotkey executable. Once done this, drag LvL2img.ahk onto it and enjoy the program!