Binary for Java (B4J)

XML Data Encoding / Decoding Tool for Java MIDP/DOJA (2004–2005)

Rationale

In the early days of Java applications on mobile phones, memory and storage were counted in mere KB, not in MB. Connectivity was limited and downloads of the code and data of the application were metered on expensive data plans.

Even the most simple games typically require a large amount of data to represent each level, in a format which varies depending on the nature of the game. This data can be conveniently represented in XML, and created by level designers using custom level editors on a computer.

In order to embed that data in the game, it needs to be compressed, typically encoded in a binary format and decoded using a custom decoder, which has to be written for each new game. This is tedious prone to error.

The Binary for Java tool streamlines the creation of custom encoders and decoders for XML data, using an XML Schema annotated with semantic actions written in Java. The generated decoder compresses the data into a compact binary format while the generated decoders extracts that data and provides it as building blocks to the semantic actions to create objects needed by the application, such as game levels.

Requirements

Usage

Setup and prerequisites

Write and validate Your Schema

Generate Encoder & Test Decoder

Write Your Decoding Actions

Generate Your Specific Decoder

These steps are described in details in the online tutorial, applied to the example of a quiz game.
They are summarized in a single page job aid: Quick Start in 5 Steps.

Tutorial

Documentation

Some context information about the project, its partners and technologies is available in French,
from the presentation at the end of my Master in Video Games and Interactive Media:

Credits

License

MIT