Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2019-10-03 04:53:43

N1KF
Wiki Mod
From: ဪဪဪဪဪ From: ဪဪဪဪဪ From: ဪဪဪဪဪ
Joined: 2015-02-15
Posts: 11,052
Website

Using FileReader to read EELVL in JavaScript

For many hours in the last few days, I've been trying to make an EELVL parser in JavaScript. I've had bad experiences with IDEs and compilers, but so far JavaScript is a lot of fun to work with as I can just load it into a web browser. After confusing myself many times, I managed to figure out the EELVL compression format and use a script to reverse it. This is what I got:

\u0000\u000fnumber1kirbyfan\u0000\u000eUntitled World\u0000\u0000\u0000\u0019\u0000\u0000\u0000\u0019?\u0080\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0001\u0000\u0015simple1338358205802x9\u0000\u0000\u0000	\u0000\u0000\u0000\u0000\u0000\u0000\u0000À\u0000\u0000\u0000\u0001\u0000\u0002\u0000\u0003\u0000\u0004\u0000\u0005\u0000\u0006\u0000\u0007\u0000\u0008\u0000	\u0000
\u0000\u000b\u0000\u000c\u0000
\u0000\u000e\u0000\u000f\u0000\u0010\u0000\u0011\u0000\u0012\u0000\u0013\u0000\u0014\u0000\u0015\u0000\u0016\u0000\u0017\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0018\u0000\u0000\u0000\u0001\u0000\u0002\u0000\u0003\u0000\u0004\u0000\u0005\u0000\u0006\u0000\u0007\u0000\u0008\u0000	\u0000
\u0000\u000b\u0000\u000c\u0000
\u0000\u000e\u0000\u000f\u0000\u0010\u0000\u0011\u0000\u0012\u0000\u0013\u0000\u0014\u0000\u0015\u0000\u0016\u0000\u0017\u0000\u0018\u0000\u0000\u0000À\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000\u0002\u0000\u0002\u0000\u0003\u0000\u0003\u0000\u0004\u0000\u0004\u0000\u0005\u0000\u0005\u0000\u0006\u0000\u0006\u0000\u0007\u0000\u0007\u0000\u0008\u0000\u0008\u0000	\u0000	\u0000
\u0000
\u0000\u000b\u0000\u000b\u0000\u000c\u0000\u000c\u0000
\u0000
\u0000\u000e\u0000\u000e\u0000\u000f\u0000\u000f\u0000\u0010\u0000\u0010\u0000\u0011\u0000\u0011\u0000\u0012\u0000\u0012\u0000\u0013\u0000\u0013\u0000\u0014\u0000\u0014\u0000\u0015\u0000\u0015\u0000\u0016\u0000\u0016\u0000\u0017\u0000\u0017\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018\u0000\u0018

I also know how to turn the data into binary and hexadecimal strings, so try to ignore the whole messy Unicode thing.

How do I access the data of this file? The string data is obviously there if I read the data as a string. I can also see the world width and height being listed as 19 near the beginning, which is hexadecimal for 25. However the byte gaps seem to be inconsistent between files (2 bytes vs. 4 bytes), and the variety of data types is just overwhelming. Searching up how to get a float point from binary data seems to be unhelpful, and the block arrays will probably be even harder.

Is there some easy solution I've been overlooking, or do I just need to spend more and more hours guessing what I need to do? Or do I need to mess with my computer files again and download weird development stuff to get a C# editor working like I did when I tried to use Atilla's not-so-seamless Level thingy? Hey anybody if you're reading this, can you please give me a downloadable EELVL .dll file? Like really that may be all I need but I don't know because my rocky relationship with programming is confusing and I feel incompetent at using libraries without getting a hundred errors.


Everybody Edits is Fred

Offline

#2 2019-10-03 05:10:20, last edited by SirJosh3917 (2019-10-03 05:10:37)

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: Using FileReader to read EELVL in JavaScript

LukeM has an EELVL parser here, if you can understand C# you could probably port it over

Offline

Wooted by:

#3 2019-10-03 05:43:59, last edited by N1KF (2019-10-03 06:26:24)

N1KF
Wiki Mod
From: ဪဪဪဪဪ From: ဪဪဪဪဪ From: ဪဪဪဪဪ
Joined: 2015-02-15
Posts: 11,052
Website

Re: Using FileReader to read EELVL in JavaScript

ninjasupeatsninja wrote:

LukeM has an EELVL parser here, if you can understand C# you could probably port it over

Thanks, but that's already one of the things I was using for reference. I don't know much about C#, so trying to recreate the code would probably make more of a mess than if I tried to recreate each function as I figure it out. To clarify, that's what I was referencing in OP about a ".dll file". I'll try doing my own C# thingy but I'm not having high hopes for it.

edit: Tried an offline C# compiler, but I got errors from LukeM's cs file. Tried an online compiler, but I got errors from LukeM's cs files. As usual I get dozens of compilation errors. Apparently I can't even succeed at copying and pasting other peoples' code.


Everybody Edits is Fred

Offline

#4 2019-10-03 06:40:05

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: Using FileReader to read EELVL in JavaScript

N1KF wrote:

edit: Tried an offline C# compiler, but I got errors from LukeM's cs file. Tried an online compiler, but I got errors from LukeM's cs files. As usual I get dozens of compilation errors. Apparently I can't even succeed at copying and pasting other peoples' code.

LukeM's using some super new fancy shmancy features that are probably not available in online compilers (heck, not even sure if it's mainstream/current yet).

i'd focus on trying to recreate the Block.cs class, as that's where most of the core logic is, and the EELVL.cs classL is more of an "entrypoint" to parsing. if you can't recreate something from there, ask for further help. heck, maybe if i feel like it, i can port it over to typescript (not going to guarantee/promise anything)

Offline

Wooted by:

#5 2019-10-03 06:46:51, last edited by N1KF (2019-10-03 06:51:17)

N1KF
Wiki Mod
From: ဪဪဪဪဪ From: ဪဪဪဪဪ From: ဪဪဪဪဪ
Joined: 2015-02-15
Posts: 11,052
Website

Re: Using FileReader to read EELVL in JavaScript

ninjasupeatsninja wrote:

LukeM's using some super new fancy shmancy features that are probably not available in online compilers (heck, not even sure if it's mainstream/current yet).

i'd focus on trying to recreate the Block.cs class, as that's where most of the core logic is, and the EELVL.cs classL is more of an "entrypoint" to parsing. if you can't recreate something from there, ask for further help. heck, maybe if i feel like it, i can port it over to typescript (not going to guarantee/promise anything)[

Yeah, I just realized that a few minutes ago. It turns out I should have just used the Legacy version from GitLab, which is working well from what I've copied into the C# compiler so far. Thanks for the rest of the advice also.

edit: Wait nvm it's not working well.


Everybody Edits is Fred

Offline

#6 2019-10-03 15:08:38, last edited by LukeM (2019-10-03 15:17:08)

LukeM
Member
From: England
Joined: 2016-06-03
Posts: 3,009
Website

Re: Using FileReader to read EELVL in JavaScript

The format is basically a gzipped init message with a couple extra / missing properties and without type flags. The stuff that would usually be between ws and we is exactly the same, just without the ws and we.
The parser is pretty much just a wrapper around a C# stream that converts the Flash format to something C# can use glued on to a refactored version of the init message parser found in the EE client.

To rewrite this for JS I'd probably structure it similarly to what I did, write a wrapper class for the file reader that allows you to call things like .ReadInt, .ReadString, etc (the 'Read' and possibly 'Endian' functions from here), then copy over the metadata parsing ('Level(Stream file)' from here) and block parsing ('Read' from here)

(oh and you can probably scrap the Buffer optimisations I used, that was mainly because I was using the library to convert many hundreds of thousands of worlds, and wanted it to be as fast as possible)

ninjasupeatsninja wrote:

heck, not even sure if it's mainstream/current yet

It is as of a week or so ago //ee.failforums.me/img/smilies/smile

Offline

Wooted by:
LukeM1570111718763532

Board footer

Powered by FluxBB

[ Started around 1711619414.3303 - Generated in 0.079 seconds, 12 queries executed - Memory usage: 1.48 MiB (Peak: 1.62 MiB) ]