MAC Format (Jill of the Jungle)

From ModdingWiki
Jump to navigation Jump to search

The MAC format contains a set of input instructions for use with demos that use the Jill engine.

MAC input macro

The macro drives changes in input. For example, if the pressed state of the Left arrow key changes but the others do not, the other input is not affected by the event regardless if anything else is pressed or not. Multiple inputs are allowed to be changed in one event.

Limitations of the format

Because of the way events are time-stamped in the demo, the maximum number of frames possible in a macro file is 32767.

Only one key on the keyboard that is not a direction or a fire button can be pressed at a time.

The only seed used for random numbers is 12345. As a result, the demos are consistent, but the seed could instead have been stored in the macro file for more controlled randomness.

Read cycle

These steps are repeated: read input flags, read input, read next event's timestamp. The first event is always on frame 0. There are no indicators that a macro is finished; all the bytes in the file are used.

Stored input flags

Read 1 byte. This byte is a set of flags that determine which input will change:

Flag Description
0x01 Change in X-Axis
0x02 Change in Y-Axis
0x04 Change in pressed state of Button 1 (typically Jump)
0x08 Change in pressed state of Button 2 (typically Shoot)
0x10 Change in the current key pressed on the keyboard

Stored Input

If the X-Axis changed, read 1 byte. Values of FFh, 00h, and 01h represent Left, Center, and Right respectively.

If the Y-Axis changed, read 1 byte. Values of FFh, 00h, and 01h represent Up, Center, and Down respectively.

If Button 1 changed, read 1 byte. Values of 00h and 01h represent released and pressed, respectively.

If Button 2 changed, read 1 byte. Values of 00h and 01h represent released and pressed, respectively.

If the keyboard key changed, read 1 byte. This is the value of the key currently pressed. 00h means no key is pressed.

Next Event Timestamp

Read 1 byte. What's done next is determined by its value:

Value Description
less than 128 Use the byte as the frame number to execute the next event.
greater than or equal to 128 Remove bit 7 from this value; it is now the lower 7 bits of the frame number. Read another byte, shift it left 7 bits, and add it to the value to get the real frame number.

This method isn't particularly great at saving space since demos are generally hundreds of frames long.

Jill of the Jungle demo information

It's questionable whether or not all elements in the game behave consistently regardless of timing (randomness is controlled at least.) Seeing as Jill 3's demo opens up on the first level, this may allow a full game speedrun without any other modifications to the game files.

File Info
JN1DEMO.MAC 8647 frames. Base map is INTRO.JN1, but it uses maps 0.DEM, 1.DEM, and 2.DEM.
JN2DEM1.MAC 2008 frames. Base map is 3.JN2.
JN2DEM2.MAC 1771 frames. Base map is 9.JN2.
JN2DEM3.MAC 2036 frames. Base map is 17.JN2.
JN3DEM1.MAC 2231 frames. Base map is 1.JN3.
JN3DEM2.MAC 1973 frames. Base map is 5.JN3.
JN3DEM3.MAC 1957 frames. Base map is 12.JN3.