Skip to content

About

A browser port of Stack Attack 2 Pro (Siemens, 2003), translated line by line from the original MIDlet, with touch, gamepad and widescreen.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Stack Attack 2 Web

Stack Attack 2 Web

A browser port of Stack Attack 2 Pro (Siemens mobile phones, Mobile Scope AG, 2003), translated line by line from the original MIDlet.

play in the browser fidelity: 36/36 games identical platform: Web (PWA) build: none

Play it on GitHub Pages

Stack Attack 2 Pro artwork with the game's logo and crates

Stack Attack 2 Pro was the crate-stacking game on Siemens' 55-series phones. This port runs it in any browser from the original .jar (MIDlet v1.08). The game logic is a line-by-line translation of the MIDlet's bytecode, with the original's 111 ms frame and its java.util.Random reimplemented bit for bit, so a game plays out exactly as it did on the phone, quirks included. The phone's own interface is recreated around it, and a port menu adds the things a phone could not have: touch controls, keyboard and gamepad, widescreen, filters, save states and more.

The logic is checked against the original: a harness runs the MIDlet's bytecode on a JVM beside this port, with the same seed and the same keys, and compares the whole game state on every frame.

Features

  • Original game logic. The game classes of the MIDlet (e, g, i, j, l) are translated line by line, with the obfuscated names kept in comments so each rule can be traced back to the bytecode. Even the original's oddities stay: crates that switch slots before falling, the character crate that never disappears.
  • Verified against the original. 36 of 36 games identical to the bytecode running on a JVM, about 130,000 frames, across every character and level (tools/fidelity).
  • Original graphics, text and sound. Images come from the MIDlet's res.bin and restit.bin; the texts are the .jar's five languages; the SMAF sound effects are decoded from Yamaha ADPCM, and the MIDI jingles play on a 2-operator FM synth like the Yamaha MA chip in the phones.
  • The phone's interface. Lists, forms, text boxes and soft keys in the Siemens style, with a bitmap font of their own; the opening sequence (Siemens, Mobile Scope, the bouncing logo) and the loading bar with the original's colour formula.
  • Widescreen. A side panel with score, highscore, time and cranes, or a wide field of 17 columns instead of 12.
  • Presentation. Fit, integer or stretched scaling; sharp, LCD grid, scanline and soft filters; LCD ghosting; six palettes; a phone bezel or a full phone with a clickable keypad; optional 60 fps smooth motion that interpolates between game frames without changing gameplay.
  • Input. Keyboard, gamepad and touch, all remappable. The virtual pad lets a finger slide between directions and buttons, and the phone's number keys work as on the handset.
  • Languages. The original English, German, Spanish, Portuguese and Polish, plus a new Brazilian Portuguese translation. The port menu itself is in English or Portuguese.
  • Port extras. Game speed, input buffer, drop guide, the two sounds the game never plays, optional fixes of the original's bugs, music during play, a daily challenge and save states. Gameplay changes are off by default.
  • Records. The original highscore with its nickname, plus a local ranking, statistics, save export and import, and sharing a score.
  • Installable and offline. A progressive web app that works offline and can be added to a phone's home screen.

Reference version

Field Value
Game Stack Attack 2 Pro, MIDlet v1.08
Publisher Siemens AG / Mobile Scope AG, 2003
Platform Siemens 55-series phones (MIDP with the com.siemens.mp APIs)
Logical screen 101×80, one game frame every 111 ms (about 9 fps)
Game classes e game, g player, i crate, j crane, l grid
Save RecordStore SA2PRO (class d)
Languages in the .jar English, German, Spanish, Portuguese, Polish

The graphics, texts and sounds under assets/ and js/strings_orig.js were extracted from that .jar. The .jar itself is not in the repository; the fidelity test needs your own copy.

Running locally

The port is a static site with no build step and no dependencies. Any web server will do:

git clone https://github.com/formae-group/stack-attack-2-web.git
cd stack-attack-2-web
python -m http.server 8000

Open http://localhost:8000. The service worker that makes the game work offline registers only over HTTPS, so a local server always serves the current files. GitHub Pages publishes the main branch as it is.

Playing

Action Keyboard Gamepad Touch Phone key
Walk / push ← → or A D D-pad, stick D-pad 4, 6
Jump (sideways while holding ← →) ↑, W, Space A JUMP, d-pad ↑ ↖ ↗ 2 (1, 3)
Super jump Shift, X B SUPER 5
Drop bomb (Sam) C, B X BOMB *
Pause P Start PAUSE 0
Sound and vibration options Enter Y OK Joystick
End game Delete, End Port menu Red key
Port menu Escape Select ☰
Fullscreen F ⛶

The number keys, on the top row or the numeric keypad, work as on the phone. Every action can be remapped under Port menu → Controls, and the menus can be tapped directly.

There are six characters, from Part-time Pete to Super-Stacker Sam, who can pick up bombs and drop them; all but Pete are earned with combos, as in the original. The three levels have one, two or three cranes.

Port menu

Escape, Select or ☰ opens the port menu. Options are saved in the browser (localStorage), and the defaults reproduce the phone.

Tab Setting Values
General Language Automatic, Brazilian Portuguese, or one of the five original languages
Intro Original (6 s of logos), quick (default; a key skips it), skip
Pause when leaving the tab or app On (default), off
Daily challenge The same crate sequence for everyone on the same day
Video Screen format Original 101×80, widescreen with side panel, widescreen with a 17-column field (changes gameplay)
Frame Automatic, none, phone bezel, full phone with keypad
Scaling Fit, integer, stretch
Filter Sharp, LCD grid, scanlines, soft
LCD ghosting Off, light, strong
Colours Original, phone LCD, classic green, grayscale, vivid, night
Smooth motion, screen shake on vibration, FPS Off by default
Game Game speed 50% to 200% (100% = 111 ms per frame)
Input buffer, directional jump On by default
Score while playing, drop guide, restored sounds, fix original bugs, music during play Off by default
Audio Volumes Master, music, effects
Sound type SMAF (original samples), beeps (the code path for phones without SMAF)
MIDI synth FM (Yamaha chip), square wave
Phone speaker simulation, loop menu music Off by default
Controls On-screen controls Automatic, virtual gamepad, hidden; button size and opacity, haptics, game vibration on the device
Keyboard Remap every action
Cheats All characters, infinite lives, infinite super jumps, permanent helmet, extra lives at start Records are not saved while a cheat is on
Records Best games, statistics, save data Export, import, erase

Save states are in the port menu as well. A game in which a state was loaded does not count for the records.

Bugs of the original

Bug In the original In the port
Combos of 9 or more crates Read past the end of the points table and crashed the MIDlet Always capped at the highest value (500), even with Fix original bugs off
The left diagonal drop (l()) Checked the column to the right, which also overran the array at the right edge The crash is always avoided; with Fix original bugs the correct column is checked

How it works

Module Role
game.js The game logic: classes e (game), g (player), i (crate), j (crane) and l (grid)
engine.js The parts of MIDP and com.siemens.mp.color_game the game relies on: Sprite, LayerManager and java.util.Random
main.js Boot, layout, the main loop and the MIDlet's screen flow (StackAttack2.startApp, classes h and a)
screens.js Loading bar (class f), title sequence (class n) and the game canvas
phone.js, font.js The Siemens-style LCDUI screens and the bitmap system font
audio.js SMAF effects, the FM synth for the MIDI jingles and Sound.playTone() beeps
input.js, touch.js Keyboard, gamepad and on-screen controls, turned into the key codes the MIDlet expected
render.js Draws the 101×80 (or wider) screen onto the page with filters, palettes and frames
settings.js The RecordStore SA2PRO and the port's options
i18n.js, strings_orig.js The original strings, the Brazilian Portuguese translation and the port menu text
portmenu.js The port menu
sw.js Offline cache of the game's files

Verification

JAR_DIR=~/stackattack2 ECJ=~/ecj-3.33.0.jar ./tools/fidelity/run.sh 36

JAR_DIR is the folder where your copy of the .jar was unzipped, and ECJ the Eclipse compiler for Java. run.sh compiles the original classes against minimal stubs of the MIDP and Siemens APIs, then plays N games on both sides from the same seed and the same key sequence, over the three levels and the six characters, and compares the dumps line by line.

Tool Checks
mkstubs.py Generates the javax.microedition.* and com.siemens.mp.* stubs
Harness.java Runs the original game class's loop without the sleeps and dumps the whole state every frame: player, cranes, all 84 crates, score
jsharness.mjs The same dump from js/game.js
genscript.mjs The deterministic key sequence both sides play
fuzz.mjs Hundreds of random games, looking for exceptions and impossible states
savestate.mjs Saving and restoring a state reproduces the game exactly

At version 1.0.0, 36 of 36 games were identical, about 130,000 frames.

Credits and license

Stack Attack 2 © Siemens AG / Mobile Scope AG, 2003. The graphics, texts, music and sound effects belong to their owners. This is an unofficial, non-commercial fan port made for preservation, not affiliated with Siemens or Mobile Scope. The port's own code (js/, css/ and the tools) is free to study and modify.

About

A browser port of Stack Attack 2 Pro (Siemens, 2003), translated line by line from the original MIDlet, with touch, gamepad and widescreen.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages