Core Code Components

AndorsTrailApplication.java

Main application entry point and global configuration.

Debug Parameters:

javapublic static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
public static final boolean DEVELOPMENT_VALIDATEDATA = false;
public static final boolean DEVELOPMENT_FORCE_DEBUG_BUTTON = false;

Game Engine Structure

Main Classes:

  • GameActivity: Primary game activity and UI controller.

  • GameModel: Core game state and logic.

  • MapController: Map rendering and player movement.

  • CombatController: Turn-based combat system.

  • QuestController: Quest progression and tracking.

  • InventoryController: Item management and equipment.

Resource Loading System

Content Loaders

Resource Configuration: Files: res/values/loadresources.xml and res/values/loadresources_debug.xml

JSON Data Loading

Item Loader Example:

Data Structures

Core Game Objects

Item Class Structure

NPC/Monster Structure

Quest Structure

Map System

TMX Map Loading

Map Parser Implementation

Map Object Types

Spawn Area:

Map Change:

Rendering System

Layer Rendering Order

  1. Ground layer (base terrain).

  2. Objects layer (decorations, items).

  3. Actors (NPCs, monsters, player).

  4. Above layer (overhanging elements).

  5. UI elements.

Tile Rendering

Combat System

Turn-Based Combat Implementation

Combat Flow

Status Effects (Actor Conditions)

Actor Condition System

Script Engine

ATS Script Implementation

Script Parser

Script Execution Engine

Available Script Methods

Player Methods:

Map Methods:

Save System

Save Data Structure

Player Save Data

Save/Load Implementation

Performance Considerations

Memory Management

Object Pooling for Frequent Allocations

Resource Management

  • Use Resources.openRawResource() for JSON files.

  • Cache parsed data structures.

  • Recycle bitmaps when possible.

  • Use efficient data structures (HashMap for lookups).

Rendering Optimization

Viewport Culling

Sprite Batching

  • Group similar sprites for batch rendering.

  • Use sprite sheets instead of individual images.

  • Minimize texture switches during rendering.

Testing Framework

Unit Testing

Test Structure

Integration Testing

Combat System Tests

Build Configuration

Gradle Build Script

Dependencies

Build Types

API Compatibility

Minimum Android Version

  • API Level: 35 (Android 15).

  • Target API: Latest stable Android version.

  • Architecture: ARMv7, ARM64, x86.

Backwards Compatibility

  • Avoid newer API features without compatibility checks.

  • Use support libraries for modern UI components.

  • Test on minimum API level devices.

Security Considerations

Save Game Integrity

  • Validate the saved data structure.

  • Check for impossible values.

  • Prevent save game tampering.

Content Validation

  • Validate all loaded content for required fields.

  • Check references to other game objects.

  • Prevent script injection attacks.

Debugging Tools

LogCat Integration

Development Cheats

This technical reference provides the foundation for understanding and extending Andor's Trail codebase. For specific implementation details, refer to the source code and existing patterns within the project.

Last updated