1661a7f102c1d996e7391e01e679cf49d4e8695e7smReplica Island
2661a7f102c1d996e7391e01e679cf49d4e8695e7smA side scrolling video game for Android.
3661a7f102c1d996e7391e01e679cf49d4e8695e7sm
4661a7f102c1d996e7391e01e679cf49d4e8695e7smAuthors: Chris Pruett and Genki Mine
5661a7f102c1d996e7391e01e679cf49d4e8695e7sm
6661a7f102c1d996e7391e01e679cf49d4e8695e7smThis code and artwork is released under the Apache 2.0 license.  See COPYING for details.
7661a7f102c1d996e7391e01e679cf49d4e8695e7sm
8661a7f102c1d996e7391e01e679cf49d4e8695e7smABOUT REPLICA ISLAND
9661a7f102c1d996e7391e01e679cf49d4e8695e7sm
10661a7f102c1d996e7391e01e679cf49d4e8695e7smReplica Island is a side-scrolling platformer for Android devices.  It stars the Android robot as its protagonist as he embarks on a dangerous mission to find a mysterious power source.  This is a complete game: all art, dialog, level layouts, and other data are included along with the code.
11661a7f102c1d996e7391e01e679cf49d4e8695e7sm
12661a7f102c1d996e7391e01e679cf49d4e8695e7smABOUT THE SOURCE
13661a7f102c1d996e7391e01e679cf49d4e8695e7sm
14661a7f102c1d996e7391e01e679cf49d4e8695e7smThe code is structured into several Activities for the main menu, level select screen, dialog window, and main game.  Most of the code in this project is related to src/com/replicaisland/AndouKun.java, which implements the core game Activity ("AndouKun" was the code name for this project and you can find references to it all over the code).
15661a7f102c1d996e7391e01e679cf49d4e8695e7sm
16661a7f102c1d996e7391e01e679cf49d4e8695e7smThe game loop itself is structured as follows:
17661a7f102c1d996e7391e01e679cf49d4e8695e7sm
18661a7f102c1d996e7391e01e679cf49d4e8695e7smAndouKun.java spins up the game, handles input events, deals with pausing and resuming, and also manages the progression across game levels.
19661a7f102c1d996e7391e01e679cf49d4e8695e7sm
20661a7f102c1d996e7391e01e679cf49d4e8695e7smGame.java is a layer of abstraction between AndouKun.java and the game loop itself.  This class bootstraps the game, passes events through, and manages the game thread.
21661a7f102c1d996e7391e01e679cf49d4e8695e7sm
22661a7f102c1d996e7391e01e679cf49d4e8695e7smGameThread.java is the actual game loop.  It's main utility is to manage the main loop (MainLoop.java), which implements the rest of the game logic.
23661a7f102c1d996e7391e01e679cf49d4e8695e7sm
24661a7f102c1d996e7391e01e679cf49d4e8695e7smMainLoop.java is the head of the game graph that describes the Replica Island runtime.  Anything managed by MainLoop will be polled once per frame, and children of MainLoop may themselves have children which will be polled.  GameObjects are a specific type of game graph node that only contain GameComponents as children.  GameComponents implement individual features (collision detection, animation, rendering, etc) of individual game entities.  GameObjects are generally parented to GameObjectManager, which activates and deactivates its children based on their proximity to the camera.  GameObjectManager is a child of MainLoop.
25661a7f102c1d996e7391e01e679cf49d4e8695e7sm
26661a7f102c1d996e7391e01e679cf49d4e8695e7smThe last step in the GameThread is the rendering step.  Rendering does not occur in the game thread.  Instead, render commands are queued up by the game thread and then handed to a separate render thread at a synchronization point.  The render thread is mostly implemented in GameRenderer.java, which is run by GLSurfaceView.java.
27661a7f102c1d996e7391e01e679cf49d4e8695e7sm
28661a7f102c1d996e7391e01e679cf49d4e8695e7smKEY FILES
29661a7f102c1d996e7391e01e679cf49d4e8695e7sm
30661a7f102c1d996e7391e01e679cf49d4e8695e7smHere are some interesting files in this project.
31661a7f102c1d996e7391e01e679cf49d4e8695e7sm
32661a7f102c1d996e7391e01e679cf49d4e8695e7smres/raw/collision.bin: This is the raw collision data.  Line segments and normals.
33661a7f102c1d996e7391e01e679cf49d4e8695e7sm
34661a7f102c1d996e7391e01e679cf49d4e8695e7smtools/ExtractPoints.js: This is a (rather horrible) Javascript tool for Photoshop.  It will walk closed paths and produce a text layer describing them as line segments and normals, organized by tile.  It takes a long time to run and is probably the worst code in the entire project.  res/raw/collision.bin is the binary version of output from this tool.
35661a7f102c1d996e7391e01e679cf49d4e8695e7sm
36661a7f102c1d996e7391e01e679cf49d4e8695e7smres/xml/leveltree.xml: This file describes the non-linear level progression through the game.  It is a tree, each node of which may contain one or more levels.  Continuing to the next node requires that all levels are completed.
37661a7f102c1d996e7391e01e679cf49d4e8695e7sm
38661a7f102c1d996e7391e01e679cf49d4e8695e7smsrc/com/replica/replicaisland/BaseObject.java and ObjectManager.java: These are the core nodes of the game graph.
39661a7f102c1d996e7391e01e679cf49d4e8695e7sm
40661a7f102c1d996e7391e01e679cf49d4e8695e7smABOUT THE AUTHORS
41661a7f102c1d996e7391e01e679cf49d4e8695e7sm
42661a7f102c1d996e7391e01e679cf49d4e8695e7smChris Pruett wrote code, dialog, made sounds, and defined the core game design.
43661a7f102c1d996e7391e01e679cf49d4e8695e7smGenki Mine made all of the art, most of the levels layouts, all of the character designs, most of the sound, and also contributed to the game design.
44661a7f102c1d996e7391e01e679cf49d4e8695e7smTom Moss got the project up and running and then sat back and let us make it cool.
45661a7f102c1d996e7391e01e679cf49d4e8695e7sm
46661a7f102c1d996e7391e01e679cf49d4e8695e7smSpecial thanks to Jason Chen for awesome rah-rah cheerleading support, Casey Richardson for excellent play testing and design feedback, Tim Mansfield for dialog edits, all 1300 users who participated in beta testing, and to the Android team for continued support.