Forum > Showoff - what you are working on

Trying to dev a Java M2 lib&tools

(1/4) > >>

spik96:
Hey !

As my C converter was a bit of a nightmare to maintain I initially decided to rewrite it in Java.
Then I thought I may use this opportunity to make something better and more useful on the long term.
I'm now building something really simple to use in a well-known language.
It's based on WC3Utils by Dr Super Good from The Hive Workshop, the WoW Wiki, and many other sources.
It recognizes an M2 format based on its magic number (typically MD20) and its version (such as 264 for WotLK, but you could put -1 to disable this and load chunked files like Warcraft 3 MDX files for example).
I heavily used reflection to make basic classes, such as ArrayRef (n and offset) and AnimationBlocks easy to use.

Now adding another format is really easy.
Example : for many years some people were scared about parsing the preWotlk formats because the AnimationBlock is really different (one timeline instead of multiples timelines). Some thought you had to create lot of new methods and there was a minefield of bugs.

LK 3.3.5 :
   private short interpolationType;
   private short globalSequence;
   private ArrayRef<ArrayRef<Integer>> timestamps;
   private ArrayRef<ArrayRef<T>> values;
BC 2.4.3 :
   private short interpolationType;
   private short globalSequence;
   private ArrayRef<Integer> timestamps;
   private ArrayRef<T> values;

That's it. Done. It writes itself, it reads itself, this is all you have to change (and add&remove a few fields in other places). You do not need to recreate other reading/writing functions, you do not need one for each type like in C as there is genericity, it's just fast and simple. You do not need arrays of arrayrefs, read them from the stream, then read each n&ofs to finally reach the real data... the class does it for you. Just put the ArrayRef at the correct place in your declaration, and call its unmarshalling method, and done. A "getContent()" will give you your real Array. Or an Array of Arrays if that's needed.
It is not meant to be performant, just easy to read and easy to adapt when Blizzard format changes.
And it should be fast to add hooks to perform any task you want.

The backbone is the ArrayRef class : http://pastebin.com/47pG7Qqx
Still work in progress.

I will put this on Github soon. If anyone wants to help me, just post here.

xJKz:
And 4.x, 5.x, 6.x ?

spik96:
Yes, even 7.x could be added fast once the documentation is written by the dataminers. I'm starting with 3.x as it's the most documented, then I'll just have to implement the changes. At the exact same time small conversion methods could bridge versions between them and so the custom models one made years ago could be brought to newer versions. That's just all concept and small part of codes right now of course, but well, as the section says, that's what I'm working on.

schlumpf:
WoD should be documented equally well.

spik96:

--- Quote from: "schlumpf" ---WoD should be documented equally well.
--- End quote ---
Well, I thought some things were still missing in particles & .bone files, but after all it may be finished.
I wish there was a way to quickly view changes in the formats on the wiki. Right now you just have to read carefully to find mentions of extensions. Some kind of tag system in the wiki editor would be nice ([LK-WoD] by default, then restrictions to specify [Cata-MoP] for example).

Navigation

[0] Message Index

[#] Next page

Go to full version