Skip to content

Introduction

Table of Contents


What is Parallax?

Parallax is a roleplay framework for Garry's Mod that provides a modular, extensible foundation for creating roleplay schemas. It derives from Garry's Mod's sandbox gamemode and offers sophisticated systems for managing factions, items, characters, inventories, and more.

Key Features

  • Modular Architecture: Framework handles core mechanics, schemas focus on game-specific content
  • Database Integration: Built-in MySQL support for persistent data
  • Flexible Hook System: Custom hook types with schema and module support
  • Item Inheritance: Base items → Regular items → Instances hierarchy
  • Character Variables: Extensible character data system with automatic networking
  • Command System: Powerful chat/console command framework with validation
  • Module System: Create reusable add-ons that work across schemas

Why Use Parallax?

Separation of Concerns

Framework provides foundation, schema defines gameplay. This separation allows:

  • Framework updates without breaking schemas
  • Multiple schemas running on same framework
  • Focus on gameplay mechanics instead of core systems

Hot-Reloading

Modify code and reload without server restart (in development):

-- Reload schema
ax.schema:Initialize()

-- Reload specific directory
ax.util:IncludeDirectory("schema/factions", true, nil, timeFilter)

Extensibility

Easy to extend with custom systems via modules:

-- modules/my_module/boot.lua
MODULE = MODULE or {}
MODULE.name = "My Module"
MODULE.description = "A helpful module"

function MODULE:Initialize()
    -- Setup code
end

return MODULE

Type Safety

Built-in type system for data validation:

ax.character:RegisterVar("health", {
    default = 100,
    fieldType = ax.type.number
})

Community

Growing ecosystem of modules and schemas with:

  • Shared knowledge and examples
  • Reusable components
  • Community support

System Requirements

Required

  • Garry's Mod: Latest version
  • Lua Knowledge: Intermediate to advanced Lua skills
  • GMod Experience: Understanding of GMod's gamemode structure
  • Database: MySQL or MariaDB (for production)
  • Code Editor: Visual Studio Code with Lua extension
  • Version Control: Git for tracking changes

Installation

Step 1: Clone Parallax Framework

Clone or download Parallax framework to your GMod gamemodes directory:

garrysmod/gamemodes/parallax/

Step 2: Create Your Schema

Create a new directory for your schema:

garrysmod/gamemodes/your-schema-name/

Step 3: Configure Database

Configure database connection in parallax/gamemode/framework/libraries/sv_database.lua:

-- Example configuration
mysql:Configure({
    host = "localhost",
    user = "gmod_user",
    pass = "your_password",
    database = "gmod_server",
    port = 3306
})

Step 4: Create Schema Files

Create minimal schema files:

gamemode/init.lua (server):

AddCSLuaFile("cl_init.lua")
DeriveGamemode("parallax")

gamemode/cl_init.lua (client):

DeriveGamemode("parallax")

gamemode/schema/boot.lua:

SCHEMA.name = "My Roleplay Schema"
SCHEMA.description = "A custom roleplay schema based on Parallax."
SCHEMA.author = "YourName"

Step 5: Start Server

Start your GMod server with the schema:

srcds_run.exe +gamemode your-schema-name +map rp_city45_2013

Or in your server config:

gamemode "your-schema-name"

Step 6: Verify Installation

Check console for successful loading:

Schema "your-schema-name" initialized successfully.


Next Steps

Now that you have Parallax installed, continue with:

  1. Framework Architecture - Understand how Parallax works
  2. Core Systems - Learn about factions, items, characters, etc.
  3. Schema Development - Create your own schema
  4. Examples - See practical implementations

Troubleshooting

Common Issues

Schema fails to load:

  • Verify gamemode/init.lua and gamemode/cl_init.lua call DeriveGamemode("parallax")
  • Check console for Lua errors
  • Ensure schema/boot.lua exists and defines SCHEMA.name

Database connection fails:

  • Verify database credentials in sv_database.lua
  • Ensure MySQL server is running
  • Check firewall settings
  • Test connection with MySQL client

Items not loading:

  • Check file naming conventions (use sh_ prefix for shared items)
  • Verify files are in correct directory (schema/items/)
  • Check console for item initialization messages

Hooks not firing:

  • Ensure hook is registered with ax.hook:Register("SCHEMA")
  • Check function name matches hook signature
  • Verify file is included in correct directory (schema/hooks/)

Getting Help

If you continue to have issues:

  1. Review Best Practices
  2. Check Examples for similar implementations
  3. Examine framework source code in parallax/gamemode/framework/
  4. Look at HL2RP schema for working examples

Resources

Official Documentation

Community

  • Framework source: parallax/gamemode/framework/
  • HL2RP schema: parallax-hl2rp/gamemode/schema/
  • Example modules: Check community repositories

Continue to: Framework Architecture