Origin-rebasing, multi-threaded game engine for Orion Realms
npm install @axion-engine/core@react-three/offscreen. It is designed for developers who need to move their entire rendering loop, React hooks, and scene logic off the main thread to ensure the UI remains responsive even during heavy 3D computations.
bash
npm install @axion-engine/core three @react-three/fiber react react-dom
`
🚀 Usage
Axion consists of a Bridge (Main Thread) and an Engine (Worker Thread). Below is the standard setup for a Vite-based project.
1. Main Thread Setup (App.tsx)
Initialize your worker and wrap your application in the AxionEngine provider.
`tsc
TypeScript
import { useMemo } from 'react';
import { AxionCanvas, AxionEngine } from "@axion-engine/core";
function App() {
// Vite automatically bundles the worker using this syntax
const engineWorker = useMemo(() => {
return new Worker(
new URL('@axion-engine/core/worker', import.meta.url),
{ type: 'classic' } // Axion worker is bundled as an IIFE
);
}, []);
return (
{/ 1. The Engine Provider manages the worker instance /}
{/ 2. The Canvas Component handles the Offscreen Handshake /}
{/ Your scene content is managed within the worker /}
);
}
export default App;
`
🛠 Local Development & Testing
You can test the engine locally using the built-in test environment.
Install dependencies:
`Bash
npm install
`
Run the test suite:
`Bash
npm run test
``