Athena Framework

repository·master·Indexed 42 days ago

https://github.com/stuyk/altv-athena

A roleplay framework, script, and development toolkit for creating GTA:V servers on the alt:V platform. Built with TypeScript, Vue 3, NodeJS, Vite, and MongoDB, it provides a foundation of scripts, a cinematic camera system, and a client API for developers. Note: This framework is no longer being updated; Rebar Framework is recommended for current projects.

Tokens
23.1K
Snippets
72
Records
98
Agent score
54%

What's inside Athena

  1. Overview of Athena Framework

    master

    Athena is a free Roleplay framework, script, and toolkit designed for developers building GTA:V servers on the alt:V platform. It utilizes a modern tech stack including TypeScript, Vue 3, NodeJS, Vite, and MongoDB.

    ⚠️ IMPORTANT NOTICE: Athena is no longer being updated. For up-to-date practices and a plugin system, it is recommended to use the Rebar Framework instead.

  2. Understand the clothing image naming scheme

    master

    The clothing images in this repository follow a specific pseudo-naming convention to map image files to in-game assets. The format is:

    componentIdentifier-hashedDlcName-isProp?-isNotShared?-drawableID.png

    To correctly identify or use an image, you must reconstruct this string based on the component type, the DLC hash, whether it is a prop, its gender exclusivity, and the drawable ID.

    componentIdentifier-hashedDlcName-isProp?-isNotShared?-drawableID.png
  3. Use Basic Authentication with Recovery Seed Phrases

    master

    The Basic Authentication plugin provides username and password authentication alongside a recovery seed phrase system.

    When a user creates an account, a recovery seed phrase (consisting of 24 words) is generated. This phrase acts as the ultimate fallback for account recovery.

    Key Security Details:

    • Storage: Seed phrases are not stored in plain text; they are stored in the database using the SHA256 hashing algorithm.
    • Recovery Process: To recover an account, the user provides their seed phrase. The system hashes the provided phrase and compares it against the stored SHA256 hash. If they match, access is granted.
    • Post-Recovery: Once an account is successfully recovered using a seed phrase, a new seed phrase is generated and provided to the user to replace the old one.
  4. Understand and use custom configuration files

    master
    The project provides dynamically created custom configuration files designed to overwrite your server.toml. These files allow you to switch between different environment modes (Development, Testing, Production) by selecting the appropriate JSON configuration. You should adjust these files based on your specific environment requirements.
  5. Select the appropriate environment configuration

    master

    Choose one of the following configuration files based on your current development or deployment stage:

    • dev.json: Use for active development. It enables VUE DEBUG mode, allows only 1 Player on a local machine to connect, and includes Reconnect functionality.
    • devtest.json: Use for testing development builds. It supports up to 32 Players, has NO VUE DEBUG enabled, and includes Reconnect functionality.
    • prod.json: Use for live production environments. It loads all core resources and has No Reconnect functionality.
  6. Modify Athena UI components with caution

    master

    The components located in src-webviews/src/components are purpose-built specifically for Athena.

    Warning: These components are shared across the entire system. Any changes made to their styling or behavior will propagate to every interface that uses them. Exercise caution when restyling or altering their logic to avoid unintended consequences across different parts of the application.

  7. Quick Start: Install and Setup Athena

    master

    To begin developing a roleplay server with Athena, follow these steps to install the required software and clone the repository.

    1. Required Software

    Ensure you have the following installed on your system:

    2. Installation Commands

    Run these commands in your Terminal or PowerShell to clone the project and install dependencies:

    git clone https://github.com/Stuyk/altv-athena
    cd altv-athena
    npm install
    npm run update
    npm run windows
  8. Manage RMLUI sprites for in-world image rendering

    master

    The RMLUI sprite management API allows you to render images at specific 3D world positions or screen positions using RMLUI. Sprites automatically scale based on their distance from the local player and can handle occlusion (blocking) and touch events.

    Key Features:

    • Automatic Scaling: Images scale down as the player moves away, based on a DEFAULT_DRAW_DISTANCE of 20 units.
    • Occlusion Handling: Sprites become semi-transparent (opacity: 0.1) if an entity is blocking the line of sight between the player and the sprite.
    • Touch Events: You can register a callOnceOnTouch callback that triggers when the player is within a TOUCH_DISTANCE of 2 units.
    • Plugin Pathing: Supports a shorthand for plugin assets using the @plugin/ prefix.
    import { create, update, remove } from './path-to-this-module';
    
    // Example: Creating a sprite
    create({
        uid: 'my-unique-sprite',
        path: '@plugin/my-plugin/client/icon.png',
        width: 64,
        height: 64,
        position: { x: 100, y: 200, z: 50 },
        callOnceOnTouch: (uid) => {
            console.log(`Sprite ${uid} was touched!`);
        }
    });
  9. Define menu option types

    master

    When building a menu, you can use different option types to control how users interact with the menu items. Use createOption<T>(...) to ensure type safety.

    TypeBehavior
    InvokeA simple button. Executes the callback immediately when ENTER is pressed.
    ToggleA boolean switch. Pressing ENTER flips the value and executes the callback.
    RangeA numeric slider. Use left/right to adjust by increment. If onlyUpdateOnEnter is false, the callback fires on every adjustment. If true, it only fires when ENTER is pressed.
    SelectionA dropdown-style menu. Use left/right to cycle through the options array. If onlyUpdateOnEnter is false, the callback fires on every change.
    InputA text input field. Pressing ENTER triggers an RMLUI input prompt. The result is passed to the callback.
  10. Define RMLUI Menu options

    master

    RMLUI menus are constructed using a MenuInfo object which contains a header and an array of options. Each option must have a type that determines its behavior and required properties. All options inherit a base set of properties: title (string), description (string), and a callback function that executes when the option is interacted with.

    Supported option types are:

    • Selection: A list of values to choose from.
    • Toggle: A boolean switch.
    • Range: A numeric slider with min/max bounds.
    • Input: A simple trigger/button (type: 'Invoke').
    • Invoke: A text input field (type: 'Input').
  11. How WebView pages and overlays work

    master

    Athena distinguishes between three types of webview content:

    1. Pages: Standard UI elements (like menus). They can be opened, closed, and are typically hidden when the Escape key is pressed. You can provide a closeOnEscapeCallback when opening them.
    2. Overlays: Persistent UI elements (like HUD, Chat, or Minimaps). They stay visible even when other pages are open. You can register them with a callback to react to visibility changes.
    3. Persistent Pages: Pages that are registered to never close via registerPersistentPage.

    When a standard page is closed via the Escape key, Athena automatically hides all overlays and then shows them again once the page is gone.