Rogen

Introduction

What Rogen is for, shown on a typical Roblox project

Updated

Rogen is a command-line tool that writes your Rojo project file for you, while Rojo still syncs and builds your game. Here is why that helps.

A Typical Roblox Project

This game has an inventory and a shop. Its project file mounts src/server into ServerScriptService, src/client into StarterPlayerScripts and src/shared into a Shared folder in ReplicatedStorage. Inside them, code is sorted by type:

my-game
MY-GAME
  • src
  • client
  • controllers
  • InventoryController.luau
  • ShopController.luau
  • ui
  • InventoryWindow.luau
  • ShopWindow.luau
  • server
  • data
  • InventoryStore.luau
  • services
  • InventoryService.luau
  • ShopService.luau
  • shared
  • config
  • ItemConfig.luau
  • ShopConfig.luau
  • types
  • InventoryTypes.luau
  • ShopTypes.luau

The inventory is spread over six folders, mixed in with the shop, so changing or removing it means hunting through all of them.

Feature Folders in Rojo

Sorting each side by feature helps, but the inventory still has three folders, one each in client, server and shared. A single src/Inventory folder is better, and Rojo can do it if you give every side of every feature its own entry in default.project.json:

default.project.json
{
  "name": "my-game",
  "tree": {
    "$className": "DataModel",
    "ServerScriptService": {
      "Inventory": { "$path": "src/Inventory/Server" },
      "Shop": { "$path": "src/Shop/Server" }
    },
    "StarterPlayer": {
      "StarterPlayerScripts": {
        "Inventory": { "$path": "src/Inventory/Client" },
        "Shop": { "$path": "src/Shop/Client" }
      }
    },
    "ReplicatedStorage": {
      "Shared": {
        "$className": "Folder",
        "Inventory": { "$path": "src/Inventory/Shared" },
        "Shop": { "$path": "src/Shop/Shared" }
      }
    }
  }
}

Every feature you add, rename or remove means editing this file by hand, and a folder you forget never reaches the game.

One Folder per Feature

Rogen writes those entries for you when you put each feature in one folder, with Client, Server and Shared folders inside:

my-game
MY-GAME
  • src
  • Inventory
  • Client
  • InventoryController.luau
  • InventoryWindow.luau
  • Server
  • InventoryService.luau
  • InventoryStore.luau
  • Shared
  • InventoryTypes.luau
  • ItemConfig.luau
  • Shop
  • Client
  • ShopController.luau
  • ShopWindow.luau
  • Server
  • ShopService.luau
  • Shared
  • ShopConfig.luau
  • ShopTypes.luau
Explorer
  • ReplicatedStorage
  • Shared
  • Inventory
  • InventoryTypes
  • ItemConfig
  • Shop
  • ShopConfig
  • ShopTypes
  • ServerScriptService
  • Inventory
  • InventoryService
  • InventoryStore
  • Shop
  • ShopService
  • StarterPlayer
  • StarterPlayerScripts
  • Inventory
  • InventoryController
  • InventoryWindow
  • Shop
  • ShopController
  • ShopWindow

Studio gets the same tree as the hand-written project file, while everything about the inventory sits in src/Inventory and you remove it by deleting one folder.

How Rogen Does It

You write default.rogen.json, a Rojo project file with routes added, where each route names a folder and where its files go. Rogen adds the routed files to the tree, which holds what folder names can't place, such as your packages:

default.rogen.json
{
  "name": "my-game",
  "routes": {
    "Server": "ServerScriptService",
    "Client": "StarterPlayer/StarterPlayerScripts",
    "Shared": "ReplicatedStorage/Shared"
  },
  "tree": { "$className": "DataModel" }
}

rogen serve and rogen build write default.project.json from it, then run rojo serve and rojo build with Rojo's flags. To try it on an existing project, install Rogen and run rogen init.

Next Steps

On this page