jME binary format in

Instead of loading from text XML files, scenegraphs are loaded from a binary format. It works something like this



XML format <----> jME binary <


> Scene Graph

XML ---> Binary via com.jme.scene.model.XMLparser.XMLtoBinary;
Binary ---> XML via com.jme.scene.model.XMLparser.BinarytoXML;
Binary ---> SceneGraph via com.jme.scene.model.XMLparser.JmeBinaryReader;
SceneGraph ---> Binary via com.jme.scene.model.XMLparser.JmeBinaryWriter;

The advantage to this system is that I don't loose any human readability because all binary can easily convert to XML. My file sizes are also almost twice as small. And because with loading XML, the file has to be converted to a String then the String to whatever Object jME needs, the old system took more time and memory. Now, once a file is in binary format, a user can convert directly to whatever objects jME needs. Conversions from Binary ----> SceneGraph happen almost instantly. drFreak, once he's in binary loads like a flash.

DP, you were talking about file size. Try the new loader out and see how it works. I'm also going to add some functions to KeyframeController to help do easy animations as well.

Great! Just been playing with it, the load times are pretty damn good, Cep. The interface for binary <-> XML conversion is straightforward, so it is simple (took me one try) to go from one to another.

Without even trying, jME’s binary format already supports ASE files. Just load them with ASEModel. You can save ASEModel to binary format and load the binary format fresh whenever you want. Works good as far as I can tell, and the binary format loads really fast.

what kind of differences in file sizes are you seeing (like original md2 file vs. jme binary file)? I know you say twice as small, but can you give an example or two? (yes, I’m a bit lazy for not trying it myself. sorry!) Also, any numbers for load times from md2 vs. from the binary format? (We should call it something like .jme :))

Benchmarking the md2 loader currently distributed with jME VS loading an md2 model from jME binary on my computer (time in ms):



Time to convert from .jme to SceneGraph:451

Time to convert .md2 to scenegraph old way:3144





Total size of .jme drFreak file: 2,404,380k

Total size of .md2 drFreak file: 0,421,784k



Size of .jme after zip: ~~ 1,300,000k

Size of .md2 after zip: 240,000k



So like… 5 times larger? And loads 8-9 times faster(?). Loading from XML directly was using 10x larger files and took as long as the old converter almost.

Interesting… I wonder if there are some fields we can eliminate in the .jme file. (ie. things that can be reinstantiated from other fields, etc.) For our own game we wrote our own jar/xml based format to store terrains and were able to cut things down quite a bit by only saving specific fields.

the new binary format is brilliant. I am already using it in my game.



For my player model, it was 286Kb with Md2, 3Mb with XML, and now 2Mb with .jme, fantastic.



People thought Md2 were bloated, wait till they try .jme XD



Soz, my bad, very good work, keep it up.