Creating a New Editor Questions

29 replies [Last post]
Joined: 03/13/2012

Hello people, Nothinggoo here!
You may remember me, I used to come to this place far more often.
So we all know that there is an editor for both levels and balls for World of Goo, but it seems to me that it is kind of abandoned, and I found a lot of bugs. They are also, especially the ball editor, very platform specific. And finally, chapters are a tad hard to make.
Just to clarify, I am not asking for somebody to make a new editor, but I'm asking for help on creating one myself. I understand that most WOG levels are made using XML, so it shouldn't be too hard. But I have a few questions that I will be glad if people answered, especially Draft as Brush who is hopefully still visiting the site. My questions are:

  • How do I unzip png.binltl and .bin files - those seem to be what the levels are made of (.bin are obviously compressed xml)
  • Are levels stored in a platform-specific way? I only have a Mac, so please tell me if something is different on a different OS.

That is it for now, I will ask questions as I go along.
P.S. If these awesome people are still here, thank you so much:
DavidC, Albino Pokey, Mom4evr, puggsoy (and more, all of you that helped me here!)

Because writing signatures is too mainstream

Joined: 09/01/2009

Hi, nothinggoo! Welcome back.

The .bin files are indeed compressed xml, which can be decompressed with GooTool (Advanced menu->decrypt->decrypt .bin file). The png.binltl files are similar - in the Mac version, these are png images encrypted in a special way. These can also be decrypted with GooTool. I think Daft made a special decryption program for both of these to go with his editors... there's an option in the Windows version to add an entry to the right-click menu for them, but as far as I know this is Windows-only.

Levels are indeed stored differently on Windows and Linux than on Mac, oddly enough. On Windows or Linux, the png images are just stored as bare png images, without any special compression or encryption. The .bin file format is slightly different as well, if I recall correctly, hence the different GooTool entries for decrypting those.

As far as I know, Daft is no longer visiting the site ( http://goofans.com/goofans/contributors has his last visit date as 3 years ago, anyway ).

If you have any other questions, let us know! I wrote a chapter tutorial here which may come in handy: http://goofans.com/developers/resources/chapter-addin-development

The Mac versions of the editors are sadly very far behind the Windows versions. I personally tried running them from source on my ancient iMac G5 to little success (Though that could be because it's big endian, which basically means nothing really runs properly). You can try running the Windows versions through Wine. I'm not really sure how well that would work, but it may be worth a shot.

Joined: 03/13/2012

I'll probably write my own decompression programs for the bin files, as i wouldn't want the user having to switch between the new editor and goo tool. GooTool is written in java, so I hope whoever made it (Draft as Brush, I guess) doesn't mind me decompiling it and taking a look at the source. Thank you so much for replying so quickly, and for all the info!

Because writing signatures is too mainstream

Joined: 07/05/2011

Why would you want to reinvent the wheel? In my opinion if you want to create a new editor there's bound to be a lot of work to be done unless you are making a XML editor or something like that. Tongue
Here's DaB's source code for the three editors and here's my edition which includes some bugfix (or hacks because I don't have enough time and I'm lazy to understand what's going on Tongue).

Anyway, the answers to your questions can be found on this site. Read this.

Joined: 03/13/2012

Thank you Mygod, but I'm hoping to surpass DaB's editors. Besides, I have a lot of time and nothing to code. Thank you for linking me!

Because writing signatures is too mainstream

Joined: 07/05/2011

OK. Good luck with that. Wink

EDIT: I'll list things I wanted to implement in WooGLE but haven't done them for some reasons below. Hope they help. Tongue

  • Drag to change the /scene boundaries.
  • Multilingual support.
  • Packing global custom pipe resources in /properties/resources.xml.bin.
  • Copy used .anim.binltl files in the level directory when copying a level.
  • Show @colorize effect in WYSIWYG editor.
  • Drag to change /level/camera/@endzoom and /level/camera/poi/@zoom. (suggested by @WEGFan)
Joined: 03/13/2012

BouncyCastle's site is impossible to navigate. Also, the BouncyCastle lib found inside the GooTool is outdated for Java 8. Any ideas?

Because writing signatures is too mainstream

Joined: 07/05/2011

You mean bouncycastle.org? Why do you mean by impossible to navigate? I can go to that site without any problem.

Joined: 03/13/2012

I can go it alright. It's impossible to find the download page AND the library found on the site is the same one inside GooTool, hence it's outdated.

Because writing signatures is too mainstream

Joined: 08/06/2010

All of Daft's editors use a program called wogfile.exe to convert between .xml and .xml.bin files. It can be found in the same directory as the editor executable itself. I'd recommend using that to extract the XML, then having your program edit that, then using it to create a bin file again when you save.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 03/13/2012

Hello Albino Pokey, long time no see!
The thing is, I'm coding in Java, so using .exe is just not an option. I'm getting pretty close to decrypting the AES, but still getting some errors. I hope I can fix them, otherwise, well, I can't do much.

Because writing signatures is too mainstream

Joined: 07/05/2011

Well, I think Java should have some kind of AES crypto library implemented. There's probably no need for a third-party one. Wink

Joined: 03/13/2012

I finally decrypted the Windows / Linux .bin file! Java is evil
Still wondering why it's so hard.

P.S. The decryption key is too long for java natively, I had to change policy jars in my jre. I wonder if it will work on other machines.

Because writing signatures is too mainstream

Joined: 08/06/2010

nothinggoo wrote:
The thing is, I'm coding in Java, so using .exe is just not an option.

Runtime.getRuntime().exec("wogfile [arguments]");
This doesn't seem portable, but since the encryption is different across platforms you can just distribute a different version of wogfile for each.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 03/13/2012

Albino Pokey wrote:
nothinggoo wrote:
The thing is, I'm coding in Java, so using .exe is just not an option.

Runtime.getRuntime().exec("wogfile [arguments]");
This doesn't seem portable, but since the encryption is different across platforms you can just distribute a different version of wogfile for each.

I got the encryption working using native Java. Although it requires to either a) Download the Java Crypto Extension or b) Use reflection to disable the Crypto limit.
I used option B (as option A would require people to download and patch their Java) and now it works fine. And it is perfectly portable, tested on a Mac OSX (Mine) a Linux Mint (friend's) and Windows 8 (Friend's)

Because writing signatures is too mainstream

Joined: 09/01/2009

The WooGLE editor (And all editors Daft As Brush made) were written in Python, not Java.
GooTool was the only one written in Java.

This made this entire page so hard to read. >.<

Joined: 03/13/2012

MOM4Evr wrote:
The WooGLE editor (And all editors Daft As Brush made) were written in Python, not Java.
GooTool was the only one written in Java.

This made this entire page so hard to read. >.<

I don't really like python for this task, nor do I know it so well. Java is the first language I learned, and it's quite universal. Therefore I'll be trying to use native Java for this.

Sorry for not mentioning the language change ;(

EDIT:
Questions:

  1. Do edited posts show up as notifications too?
  2. How does the game look on linux? On Mac it's World of Goo.app, on Windows it's an .exe and what about Linux?

Because writing signatures is too mainstream

Joined: 08/06/2010

1. Yes.
2. WorldOfGoo with no extension. Any file can be marked executable on Linux, so the extension isn't really needed.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 03/13/2012

From the length of your reply it seems to me you're mildly annoyed by me.
If that is true, please forgive me D:

EDIT
Woah, I'm rude. I forgot to thank you! Thanks for the quick reply and useful info!

Because writing signatures is too mainstream

Joined: 07/05/2011

For 2, I would say any file name is possible because the user can rename the file.

Joined: 08/06/2010

nothinggoo wrote:
From the length of your reply it seems to me you're mildly annoyed by me.

No, I was just in a hurry when I was replying. Smile

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 03/13/2012

Also, anybody know what the root folder on Linux looks like?
On windows it would be:

World Of Goo
    World of Goo.exe
    res
etc.,

On Mac it's a .app.
What about linux?
(I'm trying to get my program to only allow selection of World of Goo executable folder and no other, similar to GooTool.)
Got it to work on mac but haven't tested windows and have NO IDEA how to do it on Linux.

Because writing signatures is too mainstream

Joined: 07/05/2011

I don't recommend it because user can rename the file. Puzzled

Anyway here's how it looks like:

opt
    WorldOfGoo
        icons       (folder)
        libs32      (folder)
        libs64      (folder)
        properties  (folder)
        res         (folder)
        eula.txt
        linux-issues.txt
        readme.html
        WorldOfGoo
        WorldOfGoo.bin32
        WorldOfGoo.bin64

EDIT: I just found an svg icon! pdf
It seems that Linux version uses the same .bin file as the Windows version does. You can find a file list from WooGLE's source.

Joined: 03/13/2012

I'm not checking the name, I'm checking the contents of the folder (e.g. "res") I'm not going too far with it, just checking if there is a res and an executable Smile

Thank you so much for the file list, did you write something to compile that for you? It looks huge!

And the icon is majestic! Same for the mac version, but the windows one seems to be different Stare

Thanks again for all of this! You're awesome!

Because writing signatures is too mainstream

Joined: 07/05/2011

Daft as Brush compiled that list. I guess he used some kind of script. It's used to check whether the file is changed or not when compiling a .goomod file. You're welcome. Wink

Joined: 03/13/2012

Umm..
I feel stupid.
I tried un-"encrypting" a .png.binltl file. I'm getting rather strange (and varying) results.

My first mistake on testing the method was testing it on a black and white Anchor ball.
Converting it seemed fine, but now there is an issue.

Colored Gooballs are well...Changed. Not inverted, but colorized...
(Balloon goo)
http://puu.sh/aypeV/f4fdd242f5.png

That's the only problem with the goo balls. (Not like it's minor)

The second issue is the level images. When opened using the same code, they are also colorized but somehow "squeezed".

(Alice)
http://puu.sh/aypk5/e492c65570.png

I feel nooby asking for help HERE, but people here have successfully opened those images before.
What I did:

  1. Read the first two bytes, put them together into width*
  2. Read the second two bytes, put them together into height*
  3. Read the next four bytes, compiled them into size_compressed*
  4. Read the next four bytes, compiled them into size_uncompressed*
  5. Got the nearest multiple of two bigger than both values (Got the highest bit from the larger value, multiplied by two)
  6. Made two loops that go through X / Y values (for loop) nearest_mutliple times
  7. Used a ZLIB inflater to inflate the data
  8. Compiled rgba pixel out of four values
  9. If the pixel is within bounds of height / width, wrote it to a BufferedImage

Help?

*I had to bitwise and each of the bytes I read because Java has no unsigned

EDIT
Fixed!
ZLIB was being stupid.
Thanks anyway!

Because writing signatures is too mainstream

Joined: 07/05/2011

FYI, "un-encrypt" is called decrypt. Tongue

It seems to me that the problem is that you read RGB values in the order of BGR (or BGR values in the order of RGB). I wonder how this is related to ZLIB?

Joined: 03/13/2012

Well, not exactly ZLIB.
It was giving me negative values, and the BufferedImage accepted that and made the image look weird. Don't know much, just ensured ZLIB values were OK and the colors were fixed

About the "squeezing" problem - as you know I'm taking the highest bit of the number and multiplying by two. That works fine for non-power of two numbers. However, that would return 64 for 32 and 512 for 256, therefore stretching the image. Added a check for "power of two" and it worked.

I know the word decrypt exists...derp

EDIT:
Edits who up as updates, huh?
@Mygod I'm struggling to understand if your Modifier is a mod creating or testing program. Features list is kind of confusing . Could you explain, and if it's a modding program, give me a full feature list?

EDIT 2:
Now that I'm here, how did you guys figure out the encryption keys? Did 2dboy give them to you or did someone try really hard and brute-forced through the game files?

Because writing signatures is too mainstream

Joined: 09/01/2009

If I recall correctly, Soultaker helped out with the Linux port, so he got the encryption keys from the source code.

Joined: 07/05/2011

@nothinggoo
The feature list actually has nothing to do with modding. The feature list used to be a just-for-fun cheating feature and it got removed when being published to goofans. It's supposed to modify a lot of levels/goo balls with the same operation like enabling visual debug. Tongue
Here's the full feature list that includes cheating ones too. Some English translations are not done yet but you could probably know what they do from their IDs. (I was just lazy to do those)