KNPUtil v1.0

SpindleyQ's picture

OK, it's about time I released this stuff!

KNPUtil is a collection of 3 utilities for fiddling with Klik & Play games:

  1. knpextract: a tool for extracting resources from Klik & Play games
  2. knpgen: a tool for generating random "screenshots" from resources extracted from Klik & Play games
  3. knpmangle: a tool for generating new Klik & Play games from old Klik & Play games by messing with their resources

KNPExtract and KNPGen have been released before. This release brings much improved image loading times to both tools, as well as support for 16-bit images. KNPExtract also now can generate animated GIFs from animations, extract sounds and music, and provide meaningful filenames to everything it extracts.

Detailed usage instructions are in the readme. The tools are all designed to do something cool if you drag Klik & Play games onto the EXEs from Windows, but KNPMangle especially rewards a deeper understanding of its commandline options.

If you're getting error messages when you try to run the EXE, you may need to install the Visual C++ 2008 Runtime from Microsoft.

Enjoy!

AttachmentSize
knputil.zip1.61 MB

Comments

qrleon's picture

AWESOME

Man oh man, I can't wait to try KNPMangle out.

Danni's picture

Yes, yes, yes! 371 games,

Yes, yes, yes!

371 games, here we come!

Edit: Erm, one question before I destroy my lovely Trainwreck collection... where exactly does knpmangle output go? I'm not really sure I want it to overwrite everything...

SpindleyQ's picture

It gets put in a new folder

It gets put in a new folder inside the game's folder. I wouldn't destroy your data! Promise!

How hard would it be to make

How hard would it be to make a program that -imports- images into KNP games? Cause I have all this stuff left over from Assembly you see

SpindleyQ's picture

There are still a couple of

There are still a couple of fields in the image resource format that I don't understand. They may or may not matter, but I'd need to do more experimentation to find out. Animations are tougher, because there's lots in the GAM file format I don't understand.

I might as well say it here

I might as well say it here because I'm not sure where this might be useful:

To use KNP's 'import' functionality in the animation editor with box images

1) all frames must be contained within rectangles of a single color, which are separated by a second color
2) none of the stuff in these rectangles can touch the border otherwise it fucks up

like in the image. try importing it and see it works

AttachmentSize
font.pcx_.zip557 bytes
font.png1.39 KB
snapman's picture

Then all we would need is

Then all we would need is something that remaps animated gifs to the KnP palette, and sticks it in some boxes? That sounds doable.

I've found a way that works

I've found a way that works even better. Surround your images as so:

AttachmentSize
arachne_knp.png3.71 KB
ExciteMike's picture

Bugfix

Or at least it makes an exception go away.

knpmangle.py

was:

def RgrfMangled(self, rgmangler, ext):
fnOrig = self.knpextractor.Fn(ext)
if os.path.exists(fnOrig):
rgrf = list(self.knpextractor.RgrfFromHdr(fnOrig))
for mangler in rgmangler:
if mangler.ext == ext:
rgrf = mangler.Mangle(rgrf, self, self.knpextractor)
return rgrf
return None

fixed:

def RgrfMangled(self, rgmangler, ext):
fnOrig = self.knpextractor.Fn(ext)
if os.path.exists(fnOrig):
rgrf = list(self.knpextractor.RgrfFromHdr(fnOrig))
for mangler in rgmangler:
if mangler.ext == ext:
rgrf = mangler.Mangle(rgrf, self, self.knpextractor)
return rgrf
return []

Danni's picture

I love how KNPMangle makes

I love how KNPMangle makes certain games literally unplayable.

And yes, those cats are the fans. Actually, wait, I take that back. I'm not even sure _what_ the fans are now, to be honest.

Edit: This had to be done:

I actually couldn't pass that area because the terrain had completely changed. I kept hitting the spikes while trying to get onto that little ledge.

AttachmentSize
FredsExcitingAdventure.png103.89 KB
whooooaaaa2.png138.89 KB
whooooaaaa.png159.18 KB

The mangler should at least

The mangler should at least -try- to use images of the same size.

SpindleyQ's picture

Yeah, there's lots more good

Yeah, there's lots more good stuff that is totally doable, but I figured I'd fiddled with it enough and it was time to get it out there. I totally want to add such a feature.

Crash's picture

oh god where is it

oh god where is it

AttachmentSize
Image1.gif22.85 KB
Crash's picture

also

also

all games should end with you becoming god

AttachmentSize
Image2.gif32.38 KB
snapman's picture

Oh dang it all

It seems I can't get any of these to run. I'm on Windows XP, and I get the message:
"This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."

Running it from the command line gives me:
"The system cannot execute the specified program"

Is there some runtime I need to install? Am I using the wrong number of bits (32)?

SpindleyQ's picture

Well, balls? You really

Well, balls?

You really shouldn't need anything special installed to run them; I'm sure I tested KNPMangle with a bare XP install when I put the Kart together. Do you need a Visual C++ runtime installed, maybe? (If the Pirate Kart runs, then you've got that installed. Does the "Dusty kart" button on the pirate kart work?)

You could always just install a Python interpreter and PIL and run it from source.

snapman's picture

I never installed the Kart

I never installed the Kart on this machine, and your suggestion matches a lot of the results I found for those errors ,so it's probably the Visual C++ runtime thingamajig I need.
http://www.microsoft.com/downloads/en/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en

I'll give it a try once I get home.

SpindleyQ's picture

I think the VC++ 2005

I think the VC++ 2005 redistributable might be a better bet?
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en

Hard to know, I guess. Let me know which one works.

snapman's picture

Any reason to prefer the

Any reason to prefer the 2005 version over the 2008? Is that the specific version you used to make it?

SpindleyQ's picture

OK, I'm wrong, the Py2exe

OK, I'm wrong, the Py2exe tutorial says to use the 2008 installer for Python 2.6 and up. Let me know if that fixes it for you.

Basically, the 2008 version is not backwards compatible with the 2005 version, so it really depends on what compiler was used to build the version of Python that I shipped with KNPUtil. The Lua for Windows binaries were all still built with Visual Studio 2005, which is why I thought that maybe Python would need it as well. (The Kart installs both because I had to build my own interpreter but didn't want to rebuild all the libraries, and VS2005 dies horribly on 64-bit Windows 7.)

snapman's picture

There we go!

Yup, the 2008 installer did the trick. Thanks again for making these tools!

SpindleyQ's picture

Hooray! I'll add a note to

Hooray! I'll add a note to the download.

Honestly, reverse engineering the Klik & Play file format is just a lot of fun. Just thinking about it makes me want to continue my work again, start figuring out how the events are represented, and build a little (buggy, incomplete) KlikVM.

pensive-mosquitoes