How motion-twin/hammerfest works
Project Type and Purpose
• Hammerfest is a Flash-based video game (developed in MotionTypes for Flash 7/8 – AVM1) originally released in 2006.
• The project contains game logic, entity management, animations, levels, and various gameplay modes handled in ActionScript/MotionTypes files.
• The purpose is to run a complete game experience with rich animations, controlled by the game engine and supported by various assets (graphics, sounds, XML data).
Analyzing the File Structure
• The top-level directories include:
• "class": This is the core game code. Inside, you have subdirectories like "hammer", which contain further specific modules (e.g., Animation, Chrono, Loader, GameManager, etc.).
• "class/hammer/entity": Contains various game entities (players, bombs, bosses, different enemy types) further broken down by subdirectories (e.g., "bad", "bomb", "shoot").
• "class/hammer/gui": Focused on user interface elements (Container, Field, GameInterface, etc.).
• "class/hammer/levels" and "xml/levels": Seem to manage level data and scripts.
• "class/hammer/mode": Contains different game modes (Adventure, Editor, Soccer, Tutorial…).
• Additional directories exist for:
• "fla": The Flash source files for animations, graphics, and sound integration.
• "swf": Precompiled SWF files for runtime use.
• "images", "sfx", and "xml": Assets like tiles/graphics, sound effects, and configuration data (language files, level details) for the game.
• A “worldmap” directory which may be offering additional map-based interfaces or external navigation.
• There is also a “compile.bat” script for the build process, indicating a reliance on command-line compilation via MotionTypes.
Key Architectural Insights from README
• The README is brief but confirms the Flash game’s foundation and explains the use of MotionTypes.
a. Main Components to Include:
• Game Engine Core:
• Represented mainly by the "class/hammer" folder. Include modules like GameManager, Loader, FxManager, and RandomManager.
• Entity Management:
▪ Player and related controllers.
▪ Enemy (bad) entities segregated by type (general enemies, bomb types, shooter entities, etc.).
▪ Boss entities.
• Level Management:
• “levels” modules from "class/hammer/levels" and "xml/levels" configuration files. Indicate a script processing unit (e.g., ScriptEngine) and data managers.
• Game Modes:
• A component grouping various game modes from "class/hammer/mode" (e.g., Adventure, BossRush, Tutorial, Soccer etc.).
• Graphical User Interface (GUI):
• Based on "class/hammer/gui", show a separate GUI module handling overlays, control panels, and in-game menus.
• Asset Management:
• External assets (graphics from "fla" and "images", sounds from "sfx", and configuration XML from "xml") should be represented as resource providers feeding into the Loader.
• Build & Deployment Pipeline:
b. Relationships and Interactions:
• Game Engine Core to the Entity Management, Levels, and Game Modes – all interacting as part of the runtime.
• Data flow from external asset components (images, sounds, XML) into the Loader and then into the game modules.
c. Architectural Patterns & Design Principles:
• The design suggests a modular pattern where game logic, entities, and modes are clearly separated.
• There is a clear separation between asset management (graphics, sounds, levels) and core game functionality.
• While not explicitly MVC, the division between game engine, entity behavior, and GUI can be represented in distinct layers.
d. Relevant Technologies, Frameworks, & Libraries:
• MotionTypes for Flash 7/8 (AVM1) – the chosen toolset for compiling and managing ActionScript.
• ActionScript (or MotionTypes extensions like .mt files) as the core programming language.
• SWF output files for running the final game.
• XML for configuration data (levels, language, quests, items).