SMBX64

SMBX64 (Super Mario Bros. X Standard version 64) is the name of the technical standard used by Super Mario Bros. X version 1.3. This standard contains the file formats, references, item lists, and game-wide default values. The specifics of this standard were researched by Wohlstand in early 2014. This standard is very strictly defined. Each item and behavior algorithm are linked directly to a specific ID value.

Name

Why SMBX version 64?

The Standard name it is a name of game SMBX and last internal version number which you can read in first line of any .lvl file with notepad (it is 64).

Standard history

This is a partial history researched from available builds of SMBX. This history doesn't contains any unpublished alpha-builds (numbers of those versions you will find in the SMBX64-LVL file format specification). More detail history of every public build of SMBX Engine has own article.

SMBX1 - The first version of the standard which came with Super Mario Bros. X 1.0, written by Andrew 'Redigit' Spinks. Blocks can hold 1-99 coins or one of the following NPCs: goomba, flower, leaf, shoe, or mushroom.

SMBX10 - Added support for layers and events in levels. Para-Koopas, Para-Goombas, and Cheep-Cheeps were given multiple behavior algorithms. Added NPC Generators. Added talk messages, "friendly" flag, and "not movable" flag for NPCs. Boss NPCs no longer all use the same algorithm, so the flag "Legacy Boss" was added to re-enable those algorithms. Added intro levels of episodes. Added "restart level on death" support. Added "hub-style" system for episodes, togglable in the world map. Added credits field for a world map. Added support for entering to the specified warp ID of a level from the world map.

SMBX17 - Added star count field into level file.

SMBX18 - Blocks can contain any available NPC by its ID. Added play sound event.

SMBX20 - Added "Number of stars" field for world maps.

SMBX28 - Added "Locked", "No Yoshi" and "Allow NPC" flags for warps. Added support for event triggers. Added support for forcing the player's control key events. Added "Always visible" flag for levels on a world map. Added support of background image under the level icon. Added "Game start" flag for level: allows for using any level location as the episode start point. Added support for warping between two locations on the world map.

SMBX55 - Added support to disable specified characters in the episodes.

SMBX62 - Added "level title" field. Added slippery block support.

SMBX63 - Allowed layers to be attached to an NPC, which will move layers with NPC's motion. Added "Quicksand" physical environment zone type.

SMBX64 - The latest and final version of the SMBX standard which was created in 2011 with "Super Mario Bros. X 1.3". After this version, "Super Mario bros. X" development was permanently ended.

SMBX65-38A - The unofficial continuation of SMBX64 Standard used in Chinese SMBX. New standard has much more features and introduces new LVL/WLD file formats which going with the incompatible file format syntax

Limits

SMBX64 Standard has some limits about placing elements on the level map and world map:

Levels

Player start points: 2

Blocks: 16384 (because max index size in VB6 is a half of the max value of two-byte signed integer value)

Sizable Blocks (these count as normal blocks too): 1000

NPCs: 5000

Background Objects: 8000

Warps: 200

Water/Quicksand areas (doesn't matter how big): 450

Events: 100

Layers: 100

World maps

Tiles: 20000

Paths: 2000

Music-Boxes: 1000

Scenery: 5000

Levels: 400

In Game

Max episodes in "worlds" folders: 100 (declared internally, but in fact is 126) (exceeding results into a crash or to a list of empty names with a blank world map)

Stars: 10000

Effects: 1000

Note: information about SMBX's limits here is NOT taken from the Debugger box of SMBX Editor, because it shows incorrect limits for some of the elements, and it doesn't have a debug box for world maps.

Standard item list

Here are lists of the total item settings which are defined by the SMBX64 standard

Content formats

Graphics

SMBX's Graphics uses GIF format. SMBX Engine imitates transparency by using a bit masks: an image which drawing in the frame buffer with applying to each pixel value AND bitwise operation, and then drawing foreground image with applying OR bitwise operation with each pixel. This algorithm disallows having a semi-transparency images and in result a dirty colors.

Musics and sounds

SMBX uses MP3 file format. Custom music can use other formats, however, such as: WAV, MID and MP3.

Editor Tech Standard

Declaration of level and world map editors for SMBX64 standard.

Level Items

Sizes

All item sizes are pre-defined for each item and can't be changed except to sizable blocks, water zones and NPC's with npc.txt files.

All blocks and most of background objects has a 32x32 px size or multiple 32 px size.

Aligning

All items has default grid size in 32 pixels where they are should be aligned. But some exceptions are presented.

Blocks

Aligning relative to left-top corner with 32 px or 16 px grid size

Background objects

Aligning relative to left-top corner with 32 px or 16 px grid size

NPC's

Has a special aligning rule:

bottom aligned to 32px or 16px grid size

Side aligning by formula: Target position = (Offset from grid cell left side: 32px/2)-((Width of NPC)/2) if NPC aligns to grid cell center or when NPC aligns by center to grid line, horizontal offset formula is '-((Width of NPC)/2)'.

Any "Generators" aligning with 16 px grid size.

Warps

Aligns with 16px grid size

Water/Quicksand zone

Aligns with 16px grid size

Player's spawn points

Aligning with 4 px vertical and 2 px horizontal aligning grid sizes.

Collisions

Collisions prevents placement of items over each other by special rules:

Blocks

Colliding with any other blocks except sizable blocks.

Colliding with any NPC's except vines, red herb container, red door.

Background objects

Colliding with background object of same BGO-ID.

NPC's

Colliding with any blocks except sizable blocks.

Colliding with any NPC's except vides, red herb container, red door.

Water/Quicksand zone

Doesn't colliding with others.

Warps

Doesn't colliding with others.

Player's spawn point

Doesn't colliding with others.

Effects

Denied to placement in the editor.

Render Z-Order

Level graphical layaring

A full table of SMBX Engine internal rendering order priorities (Z-Layers)

Blocks array order

All blocks in the file are must be sorted by way [X-position] -> [Y-position] -> [ArrayID]. That required by SMBX's collision detection algorithm which uses a binary ranges. If blocks are will not be ordered, NPCs are will always miss up collisions with any blocks.

Background objects array order

All BGOs are ordering by special order priority coefficient which groups specific BGO-ID's inside.

How SMBX orders BGOs in a list: There's a mix of using a hardcoded conditions, but also some lookup from a table of Boolean values, where this table of boolean values is only written once and not changed. Used an Insertion sort algorithm. Algorithm is stable itself, but implementation inside SMBX is not stable, therefore every file save of same data, resulted file always has a different order of BGOs.

PGE File Library orders BGOs by this order priorities table and by order of placement which gives a same result on every file save. PGE File Library uses recursion-less Quick sort algorithm.

World map items

Sizes

All world map items has 32 px tile size except level points which has different sizes of sprites, but physical size still be 32 px.

Side aligning by formula: Target position = (Offset from grid cell left side: 32px/2)-((Width of NPC)/2) if NPC aligns to grid cell center or when NPC aligns by center to grid line, horizontal offset formula is '-((Width of NPC)/2)'.

Collisions

Collisions prevents placement of items over each other by special rules:

Terrain tiles

Collides with any other tiles

Sceneries

Doesn't collide. (which a technical mistake of SMBX! To prevent it, they should collide with other sceneries with same SCENERY-ID in 16x16 px cell of the left-top picture side)

Render Z-Order

Customization of contents

Blocks

Blocks do support custom graphics. You need to use an image in GIF format with the same size or the same number of animation frames as the original block had.

Tip:
if your block image size is bigger or smaller than the original block is, in PGE Editor, you can place them with no problem, unlike in SMBX Editor. That way you can create custom blocks of any size, which will work in SMBX Engine.

Warning:
Don't select custom blocks in the SMBX Editor or they will shrink to their original sizes!!

Background Objects (BGOs)

Background Objects do support custom graphics. You need to use an image in GIF format with the same size or the same number of animation frames as the original BGO had. If the image will be bigger than the original BGO's sizes, it will look cut, but if the image will be smaller than the original BGO, it will work in both SMBX and PGE.

Non-Playable Characters (NPCs)

NPCs are fully customizable, but you need to use special npc.txt configuration file.

Backgrounds

Backgrounds do support custom graphics and they can have any image sizes.

Playable Characters

Each playable character uses a sprite sheet with a size 1000x1000 pixels, and totally contains 100 frames in each of them.

Terrain tiles

Terrain tiles do support custom graphics.

Sceneries

Sceneries do support custom graphics, but custom sceneries from 33 to 65 will crash SMBX while trying to save the file. PGE fixes that problem.

Paths

Paths do support custom graphics..

Level entrance tiles

Level entrance tiles do support custom graphics.

Musics and sounds

You can use custom music in Level Mode, but you can't use custom music in World Map mode.
You can't use custom sounds in both modes.

Tips for the Vanilla level Contests participation

There are contests where is required to follow the SMBX64 standard and don't use external frameworks or engines which are not same as legacy SMBX Engine without any customizations, hacks or extensions. Even PGE Engine itself is not allowed, you is able to use PGE Editor to create a compatible level which will don't cause a crash in the legacy editor and engine.

This is a list of tips you must follow to be granted for participation in those contests:

you must don't include into blocks or NPC Containers (such as herbs, eggs, Lakitu and bubbles) impossible objects (elements are locked or not listed as available items for including into blocks or NPC Containers)

you must don't customize BGO order priority (keep value of order priority be -1)

you must don't use any scripts or INI-files in the levels. Just have a level file, graphics, and music (or just level only without any custom stuff, dependent from the rules of specific contest).

you must use music formats compatible with a vanilla engine (MP3 or WAV). While you converting music is suggested to always compress with bitrate equal to 320 to have fewer quality damages.

you must use compatible graphics with vanilla engine formats (A pair of the GIF files ready for bitmask algorithm: front image with black background and mask - black shape on white background). You can use PNG to GIFs conversion utility to make compatible graphics of any complexity easier.

you must save into SMBX-64 (or older) LVL format, no LVLX or SMBX-38A levels.

you must don't use decimal speed values in the npc.txt's because the legacy editor is crashing.

you must don't use dummy elements (reserved element slots are not available for regular usage) because picking up of them from a map will crash SMBX Editor.

you must don't use "system" BGOs (door star and key hole used for the warps) because picking up of them will crash SMBX Editor.

sizable blocks are MUST NOT have the size smaller than 64x64, picking up of this block will cause a crash.

sizable blocks are MUST HAVE size multiple 32 because the legacy engine will show holes between image segments and it can't smartly fill empty space between them like PGE Editor and PGE Engine is doing.

firebars are must not be longer than 32 cells.

And any other features which are impossible to make on the legacy editor.

Trivia

Fun fact: Wohlstand had no idea about "Sceneries 33-65 will crash SMBX while saving" bug, until h2643 told him that!

In the original SMBX World Map editor, there is a bug, which allows you to place sceneries multiple times on the SAME position with no limits. This causes appearing of junk scenery items while you place them with a mouse.