Author Topic: extracting Cheapo graphics  (Read 37547 times)

0 Members and 1 Guest are viewing this topic.

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: extracting Cheapo graphics
« Reply #60 on: February 17, 2015, 05:27:27 AM »
Also - what's the correct behaviour in cases of "extra data" conflicts? (eg: two windows, two teleporters, or two receivers, with the same ID number)

Depending on what's meant to happen, I may have to implement additional handling for them, or it might be possible to just emulate it with a combination of re-ordering and marking some objects as fake. This is because NeoLemmix doesn't store extra data numbers to determine these effects like Cheapo does; rather, window order is based on a list (this is actually a somewhat unknown feature as the editor doesn't support it yet; but it's a list of windows, in which the same window can also be listed more than once), while teleporters just work on "go to the first receiver in the object list, starting from the object after the teleporter, and wrapping around if the end of the list is reached without finding one".


This shouldn't matter for your levels I'd assume, but it might come up when converting other levels in general. As far as a test run goes - if possible, I'll try to have a NeoLemmix Player of the Copycat Lemmings levels out later tonight. :)

EDIT: Everything for it, other than converting the levels (which to be fair, is the most important part), has been done, assuming no problems relating to the code come up. By this I mean - nessecary styles are converted, the skeleton player has been made (just without the actual levels inserted into it yet), etc.


EDIT: Another issue I can see potentially arising; and this is more likely to occur on the various fanmade levels than the "official" Copycat Lemmings levels, is excessive numbers of objects, steel areas and one way fields. As far as Cheapo conversions go, NeoLemmix is only able to support up to 128 objects, and up to 128 steels and one-ways combined. Furthermore, I don't think Cheapo has (within practical limitations) any size limits on these, whereas NeoLemmix's areas are limited to 256x256 - of course, it's possible to just divide larger areas up into smaller ones, but that also means the limit will be reached quicker. At some point, I might look into the possibility of combining multiple adjacent areas into one where possible. If nessecary, a modified level format that can handle more could be created (though I would rather avoid this); there's no reason the engine can't handle it, it's only the level format that has this limitation.
« Last Edit: February 17, 2015, 08:42:27 AM by namida »
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: extracting Cheapo graphics
« Reply #61 on: February 17, 2015, 09:10:13 AM »
I've written the conversion app. So far, only one-level-at-a-time, but once I confirm that's working, mass conversion is the next step, and it won't be a huge task.

I haven't tested it yet (about to do so, compiling as I write this); it's rare for something I write to work perfectly the first time, so let's see how long it takes to get it right...

Test run 1 results
- Worked fine up until processing objects. At this point, crashed because the XML file was no longer open; I forgot to re-open it after closing it at an earlier point. I since realised there's no need to close it in the first place, and have adjusted the code accordingly.

Test run 2 results
- Processed objects fine. Hung upon attempting to process steel/oneway areas, due to the level I'm testing first not having any, yet the code specifically looking for the </Boxes> tag in order to process to the next part.

Test run 3 results
- Program exited before any conversion attempt due to me accidentally pushing "Exit" instead of "Convert single level" at the main menu.

Test run 4 results
- Program executed successfully. Will now attempt to play level in NeoLemmix and add results of such.
- Result: NeoLemmix gives an error upon attempting to load the level.
- Attempted using an Orig VGASPEC in place of the generated one. Error no longer occurs, so it can definitely be traced to VGASPEC code.
- This aside; some stats were not converted correctly. Time limit and skillset are wrong; lemming count, save requirement and possibly release rate are fine. Level title is missing, level author is present and correct. Level is in the correct graphic set. Objects are in incorrect places or missing entirely. Level dimensions are incorrect, as is screen start position. (Can't say for sure about release rate, as the level's RR is 1, which is what shows up; but NeoLemmix also defaults to 1 if an invalid release rate is provided. EDIT: By checking with a hex editor, I can confirm that the RR is indeed correctly converted.)

Test run 5
- TARGETS: Attempted to fix all level stats, apart from time limit and quantities of skills (but did attempt to fix types of skills).
- RESULTS: All attempted goals were successful.

Test run 6
- TARGETS: Attempted to fix time limit and skill quantities.
- RESULTS: Appears to be successful! Have noticed another issue - music number is not being converted properly; I missed this detail before. On closer (ie: hex editor) inspection of objects, it appears the only thing it's actually getting is that the object exists; all other values are being converted to zero (or "off" in the case of flags).

Test run 7
- TARGETS: Music number and objects fixed.
- RESULTS: Appears to be succesful! :D
- On closer examination: One detail with objects isn't fixed; the flags (such as flip, no overwrite, and fake). Made one minor change and re-tested; they are now working.

Time to take a break for 5-10 mins or so. I'll continue with the updates when I'm back. :P

Test run 8, 9, 10, who knows how many
- TARGET: Fix the damn VGASPECs!
- RESULTS: Fail. Fail fail fail. Fail.

Test run Infinity+1
- TARGET: Still fix the damn VGASPECs!
- RESULTS: Success! I thought the fault was in my RLE compression algorithm, but it turned out it was as simple as the wrong sizes being written to the file! Who knows how many of my attempted rewrites of the RLE were actually spot-on; the one I had at the moment didn't compress correctly, but the faux-compression version of it worked fine. Need to improve this of course and use proper compression. (Of course, it still has DAT compression, just not RLE.) However, while that tweak is needed to minimize filesizes (which, make no mistakes, are going to be HUGE for converted Cheapo levels, even after this is fixed, due to the way they work combined with the DAT and RLE algorithms not being intended for 18-bit color images), I can now say I have successfully imported a Cheapo level into NeoLemmix! I'd say I'm well on track to my goal of having a (beta) NeoLemmix version of "Copycat Lemmings" released later tonight.

Test run Infinity+2
- TARGET: VGASPECs working with proper RLE compression.
- RESULTS: Mission accomplished.


I need to run the convertor on some more-complex levels next (namely, those with steel and/or one-ways); that's pretty much the only thing remaining untested that'll matter for this first release. If that works out, I'll write the code to mass-convert and pack into LEVELxxx.DAT files (which should take about 5 minutes; the underlying code is already there, I just need to specifically tell it what files to convert and then pack into LEVELxxx.DAT files), and we should have the NeoLemmix player I promised very soon. :)
« Last Edit: February 17, 2015, 11:40:59 AM by namida »
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: extracting Cheapo graphics
« Reply #62 on: February 17, 2015, 12:12:12 PM »
At this point, all seems to be going very well. I'm about to run the first attempt at converting the whole bunch instead of just testing the odd semi-randomly picked level. If all goes well, you'll all be playing Copycat Lemmings on NeoLemmix very soon. Well, except for those of you who don't want to play it, I guess. :P

EDIT: First batch-convert test run. No major errors; some very slight ones that'll take a few seconds to fix (specifically, it was naming the level files "011.lvl", "012.lvl" etc instead of "0101.lvl", "0102.lvl", etc. However, it was expecting the latter when it then went to pack them into DATs, meaning it thought no level files existed. The only other issue was that it didn't report which level it was up to in the conversion progress, meaning it was a bit of guesswork how far along it was at any given point. It was easy enough to rename the faulty-named ones then use QuikPack to pack these ones; so I'm now running the (hopefully) fixed version on Tricky, and we'll see how that goes. :P
« Last Edit: February 17, 2015, 12:26:32 PM by namida »
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: extracting Cheapo graphics
« Reply #63 on: February 17, 2015, 12:57:38 PM »
http://www.lemmingsforums.net/index.php?topic=2039.0

Here's the first release. I haven't tested this very in-depth yet, but at a quick glance, it does seem to work. Let me know of any issues you find, so I can fix them up in either the convertor or NeoLemmix (whichever is causing them).
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline Essman

  • Posts: 139
    • View Profile
    • Ferret Face Games
Re: extracting Cheapo graphics
« Reply #64 on: February 17, 2015, 05:29:00 PM »
As for not showing UI, I made a solution for that:
With the level extractor program, use the command line to pass in two parameters: The level/set file and the output directory. If they are both set, then no UI will be shown.
The level/set extractor download has been updated, but I didn't do the command line option for the style extractor yet (that'll be tomorrow at the latest).

The style extractor now supports command line parameters and not showing any UI:
https://github.com/spadapet/cheapstyle/blob/master/Publish/CheapStyle.zip?raw=true

Run it like:
CheapStyle.exe c:\styles\foo.sty c:\styles\foo

Offline Essman

  • Posts: 139
    • View Profile
    • Ferret Face Games
Re: extracting Cheapo graphics
« Reply #65 on: February 19, 2015, 07:28:29 PM »
Also - what's the correct behaviour in cases of "extra data" conflicts? (eg: two windows, two teleporters, or two receivers, with the same ID number)

The sort order for windows takes the "extra data" into account first, then it takes the object order into account. That's it. If there are four windows with a data of 1, then the order is simply the order they are specified in the object list.

For teleporters (one and two way), they find a matching receiver by going through the objects in order, looking for a matching "extra data". The first match wins. The matching object type must be either a "receiver" or "two-way-tele", it doesn't matter.