Knytt Stories PHP classes

  • 6 Replies
  • 16588 Views
*

Offline Looki

  • 166
  • 7
    • View Profile
Knytt Stories PHP classes
« on: April 09, 2012, 01:11:44 »
Hi,

As some of you may know, I have contributed to the new Knyttlevels.com that has just reached a private beta testing stage. My biggest contribution to the site were probably my two PHP classes that allow to 1) read and extract files from .knytt.bin packages and 2) render knytt map files. Years ago, I posted an early version of the 2nd class in the old forums, but since then, it has been improved a lot. I haven't worked on them for ages - to be exact, probably one or two years, and my coding style has actually changed quite a bit since then!
Still, I'd like to share them with you - I'm aware that there probably aren't many people who know PHP and like working with KS map files, but whatever! Here they are - I've only retouched them a bit just now so that they have more appropriate comments above function headers and usage help at the top of the file, but the code is still the same as 2 years ago.

KnyttBinReader: http://paste.pocoo.org/show/578196/
KnyttMap: http://paste.pocoo.org/show/580370/

On my other PC, I should have a script lying around that takes a .knytt.bin file and renders the WHOLE map to a single PNG - really cool, if anyone's interested, I'll try to find and upload it (That's how I made the Machine png in my signature). It was even capable of rendering Gaia, which seems to be the biggest level ever made. It took a while to render though, I can tell you :P

I hope at least a single person will appreciate this  X-P
« Last Edit: April 12, 2012, 22:02:39 by Looki »

*

Offline rrc2soft

  • 191
  • 8
    • View Profile
Re: Knytt Stories PHP classes
« Reply #1 on: April 10, 2012, 09:11:21 »
I will not use the PHP classes - but I appreciate your work :) .


*

Offline sergiocornaga

  • 1286
  • 131
    • View Profile
    • Sergio's Games
Re: Knytt Stories PHP classes
« Reply #2 on: April 10, 2012, 10:27:25 »
On my other PC, I should have a script lying around that takes a .knytt.bin file and renders the WHOLE map to a single PNG - really cool, if anyone's interested, I'll try to find and upload it (That's how I made the Machine png in my signature). It was even capable of rendering Gaia, which seems to be the biggest level ever made. It took a while to render though, I can tell you :P

This really interests me!

*

Offline Looki

  • 166
  • 7
    • View Profile
Re: Knytt Stories PHP classes
« Reply #3 on: April 10, 2012, 22:29:16 »
Can you work with PHP scripts? I currently don't have any webspace to offer for this.

*

Offline BloxMaster

  • 363
  • 26
  • Master of the Bloxes!
    • View Profile
Re: Knytt Stories PHP classes
« Reply #4 on: April 11, 2012, 14:34:34 »
I had been looking for these for some time, actually! I really think they are awesome, and I'd love it if you provided that .png-creating script as well! I don't know when or how I'd end up using these, but you did a great job with them. :)


*

Offline Looki

  • 166
  • 7
    • View Profile
Re: Knytt Stories PHP classes
« Reply #5 on: April 12, 2012, 22:01:16 »
Well, as you may now, this script requires big amounts of RAM. f you don't have much (The Machine requires ~500 MB I think), you might not be able to render some of the big levels!

$_GET['f'] is the path to the knytt.bin.

http://paste.pocoo.org/show/580369/

Note: I've updated ksmap in my first post, fixed a bug with rendering transparent objects when caching was on.

Oh and for teh lulz Screenshot of Gaia in Photoshop!
Full 13MB map
« Last Edit: April 12, 2012, 22:30:08 by Looki »

*

Offline yohji

  • 664
  • 18
    • View Profile
    • Jashiin's Portfolio
Re: Knytt Stories PHP classes
« Reply #6 on: January 21, 2016, 21:18:35 »
Sorry to resurrect such an old topic, but I have to ask - the original code is gone from the website. Has anyone ever attempted something similar? I'd really like to see some of my favorite levels this way, and I think it would be helpful if I could see such a map of the one I'm working on.

(the link to the Gaia screenshot works still, btw, but it's a small image)