ACK Club

Module Creation Guide

Build custom extensions for ACK Club's network simulation engine with this comprehensive module development tutorial.

🚀 Getting Started

1. Development Prerequisites

Ensure your environment meets these requirements:

  • ACK Club CLI installed (v2.4.0+)
  • Node.js 18.x or higher
  • Basic TypeScript knowledge

2. Project Setup

Create a new module project structure:


ackclub module create my-routing-protocol
cd my-routing-protocol
npm install

This will generate a template with:

  • Module manifest (ack.json)
  • TypeScript source folder
  • Test configuration files
  • Build automation scripts

🧱 Module Architecture

Core Components

  • Manifest File: ack.json - module metadata
  • Implementation: src/index.ts - core logic
  • Configuration: .ackrc - build options

Module Lifecycle

Initialization

Module loads configurations

Execution

Integrates with simulation engine

Teardown

Cleans up resources

⚙️ Implementation Example

core/src/index.ts

import { ModuleBase, INode } from 'ack-club';

export default class CustomRouting extends ModuleBase {
  constructor() {
    super('custom-routing', '1.0.0');
  }

  override onNodeCreate(node: INode): void {
    node.on('connect', (peer: INode) => {
      console.log(`Established link between ${node.id} and ${peer.id}`);
    });
  }

  override onTick(): void {
    // Add custom routing logic here
  }
}

Manifest Configuration


{
  "name": "custom-routing",
  "description": "Advanced routing algorithm implementation",
  "entry": "./dist/index.js",
  "license": "MIT",
  "dependencies": {
    "ack-club": "^2.4.0"
  }
}

Tip: Use TypeScript for type safety when creating modules

🛠 Development Workflow

1. Compile Module


npm run build
          

This compiles TypeScript to distributable JavaScript

2. Execute Tests


npm run test
          

Runs unit tests and integration tests against ACK Club's core simulations

3. Package Module


ackclub module package
          

Creates a distributable .ackmod package for sharing

✅ Best Practices

Performance Considerations

  • Use web workers for CPU-intensive computations
  • Implement event-based processing instead of polling
  • Optimize with memory pooling for simulation data

Design Principles

  • Keep modules single-purpose and focused
  • Ensure backwards compatibility with existing modules
  • Document public APIs exhaustively

Ready to Build?

Create your custom module and share it with the ACK Club community. Your contributions help advance network simulation research.

🔄 Contribute Your Module