Skip to main content
This is an unofficial reverse-engineering dossier, assembled for interoperability research. It’s a from-the-APK reconstruction of the client architecture, the gate-server crypto, the SmartFoxServer wire protocol, and the full command surface (3,115 commands in the Lua catalog plus 54 that only C# handles, as of 1.0.364), assembled to spec a compatible Go client.

Extraction methodology

How the three custom, undocumented file formats were reverse-engineered from first principles.

Live validation

What’s been confirmed by actually round-tripping traffic against production, versus what’s static-analysis-only.

Go implementation roadmap

What a compatible Go client needs to implement, and in what order.

Game entity ID reference

The full catalog of game entity IDs recovered from the data tables.
Last War is a Unity game with almost none of its logic compiled into the app you download. Three independent, independently-updatable layers sit on top of a thin native core, and only the crypto and wire protocol are what a Go client needs to reimplement.

Client architecture

The client is built on Unity, but the game’s C# isn’t IL2CPP-compiled at all. libil2cpp.so is FunPlus’s FM_Mono bridge: it exports the il2cpp ABI and runs the managed code on upstream Mono 6.13.0. Instead of compiled game code:
  • Gameplay logic and UI, city building, army/hero systems, world map, alliance, chat, mail, shop, and nearly every network command (3,115 in the Lua catalog), is written in Lua (18,733 compiled modules in 1.0.364, hot-updated as one bundle).
  • Engine glue and platform integration, the network stack, the crypto, asset/resource management, the world-map viewport protocol, and third-party SDK wiring, lives in hot-updatable C#: 118 XOR’d .mdl assemblies that FM_Mono loads at startup. The dllres hot-update manifest lists replacements for 117 of them (mscorlib has no entry), and noUpdateAssemblies.json pins SmartFox2X to the APK copy, so the SFS2X data-model library changes only with an app release, unless a hot update replaces the pin list itself (static-analysis-only).
  • The static core, libil2cpp.so (the FM_Mono bridge), the Mono runtime, the Unity engine, and the native xLua library, is what’s actually fixed at app-store-release granularity. It contains no game logic at all (see Native binaries & security).
Two transports carry traffic to FunPlus’s servers:
  • HTTP(S) for bootstrap, version check, hot-update manifests, and gate-server discovery (the “GSL” flow), wrapped in a custom RSA+AES hybrid scheme.
  • A raw TCP socket speaking a hand-rolled reimplementation of SmartFoxServer 2X’s binary SFSObject protocol, carrying every gameplay command as a string cmd (e.g. "mail.read") plus a typed key/value payload.

Layer diagram

What a Go client actually needs

Only two of these three layers matter for protocol compatibility: the crypto (Gate-server crypto) and the wire format (SFS2X wire protocol, Command reference). The Lua/C# split is a client-implementation detail, a Go client talks TCP and HTTP directly and never touches Lua. The native-binary survey exists to answer one practical question: does anything below the protocol layer (anti-cheat, device attestation, signing) block a clean-room client?
Short answer: no, for creating and driving new guest accounts, and for binding a guest session to a real account via email verification, both confirmed live, end to end, repeatedly. Reconnecting into an already-established account’s live game state is confirmed live too, including against the shipped code after a security fix swapped part of the ta blob for placeholders (an unattended cron reconnected and collected real resources over multiple days, August 2026; since the 1.0.370 follow-up the iOS ta fills those fields again, static-analysis-only). It’s just not yet fully general-purpose: it still needs a captured access token and server address, see Native binaries & security and Live validation against production for the full scope and current state.