Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    Does anyone have a praser for Triplea?

    Development
    2
    2
    56
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Kindwind
      Kindwind last edited by

      I want to attempt this.

      Yes, a hobbyist with coding knowledge is absolutely able to do this. It is a challenging, long-term project that will teach you an incredible amount, but by leveraging existing tools, it is entirely achievable.
      Here is a practical workflow, broken down into manageable phases.

      Phase 1: Local Setup & Familiarization (The Foundation)

      Before touching the cloud, you need to understand the local environment.

      • Install and Play TripleA: Get a feel for the game and its interface.
      • Set Up a Java Environment: Install a Java Development Kit (JDK) and an IDE like IntelliJ or Eclipse.
      • Get the Source Code: Clone or download the TripleA source code from their GitHub repository.
      • Compile and Run: Your first goal is simple: get the project to compile and run from your IDE.
      • Find the AI Interface: Dig into the Java code and locate the AI interface. Find where the default AI receives the game state and returns a move. Your first "hack" should be to add a single line that prints a message to the console (e.g., "My AI is thinking...") just to prove you've found the right spot and can modify the code.

      Phase 2: Building Your Database (The Raw Material)

      Now, you'll create the database from TripleA's existing resources.

      • Acquire Game Logs: Go to a TripleA community repository and download a large batch of completed game files (.tsvg files). These are your raw data.
      • Write a Python Parser: This is where your coding knowledge comes in. Write a Python script using a standard XML library (xml.etree.ElementTree is built-in and perfect for this).
      • Parse and Load: Your script will loop through the game files, parse the XML to extract key data (player actions, final board state, etc.), and load it into a local database. For a hobbyist, a simple SQLite database is a fantastic and easy-to-use choice. You now have a queryable dataset of human-played games.

      Phase 3: The Cloud Bridge (The Plumbing)

      This phase connects the desktop game to your AI brain in the cloud.

      • Modify the Java AI: Go back to the Java AI interface you found in Phase 1. Your new task is to make it do two things:
        • Package the current game state into a structured JSON format.
        • Make an HTTP POST request to a URL (which will be your cloud endpoint).
      • Create Your Cloud Endpoint:
        • Write a simple Python web server using a framework like Flask or FastAPI.
        • Deploy this server to Google Cloud Run. Cloud Run is perfect because it's cheap and easy to use.
        • This endpoint's only job is to receive the JSON game state, call your AI logic, and return the chosen move as JSON.
      • Complete the Loop: The Java AI sends the game state to your Cloud Run URL, your Python code on the server makes a decision, and sends it back. The Java code receives the response and passes the move to the TripleA engine.

      Phase 4: AI Development (The Brain) 🧠

      With all the plumbing in place, you can finally focus on making the AI smart.

      • Version 1 (The Gemini General): Your initial Python AI on Cloud Run doesn't need to be complex. It can simply take the game state it receives, forward it to the Vertex AI Gemini API with a well-crafted prompt, and return Gemini's suggested move. You now have an AI that is likely already better than the default one.
      • Version 2 (The Data-Driven AI): This is the long-term goal. Using the SQLite database you built in Phase 2, you can now use Python's data science libraries (Pandas, Scikit-learn, TensorFlow/PyTorch) to analyze the human data and train your own custom machine learning model.
      • Iterate and Improve: You can now endlessly experiment. Start by training a model to predict a human player's next purchase. Then, train it to evaluate combat odds. Over time, you can replace the Gemini API calls with your own faster, specialized model, using the cloud's powerful (and cheap Spot VM) machines for training.
      RogerCooper 1 Reply Last reply Reply Quote 0
      • RogerCooper
        RogerCooper @Kindwind last edited by

        @kindwind Efforts You seem to have in mind using a neural net style AI to play TripleA. I suspect that this we actually be quite difficult given the huge number of possible board positions.You might be better off using a very small mod like Minimap even without a large record of games to train it. TripleA's own AI can be used for training.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums