O.G.R.E.


O.G.R.E.

EN World's Online Generic Randomizer Engine (OGRE) is a powerful, flexible framework to create your own random generators and share them with other EN World members. You can create anything from the very simple (a random color generator which rolls a d6 to choose a color) to something very complex (such as an entire, detailed populated village with homes and businesses).



This is accomplished by the creation of two types of object: tables and generators.

Once someone creates a table or a generator, it is available for use by anyone else creating their own tables and generators. In this way, generators can reference and include other generators as part of their own output. So if Bob has created a table which picks a random color such as green, blue, or red, and Alice has created a table which picks a random object, such as box, table, or book, Eric can create a generator which references both of those pre-existing tables to generate an object of a random color, such as a blue box or a green table.

In this way you can create random generators for your tabletop gaming needs. From random elf names to potion descriptions, to entire treasure hoards and NPCs.

Tables

A table is a simple chart. It contains a list of possible die rolls and a corresponding result. You've seen dozens of them in various RPG books: here's an example from the 1E DMG for AD&D, and here is the infamous Random Harlot Table. In itself, a table doesn't do anything - it's simply a source of data referenced by a generator (see below). An example table looks like this:

1) Red
2) Green
3) Blue
4) Yellow
5) Back
6) White

It has a dice roll on the left, and corresponding results on the right. When encountering this table, OGRE would roll 1d6 and report back a colour.

Tables aren't necessarily pretty; they're not what the user ultimately sees. A Dwarven-name generator, for example, might consist of four tables each of which just returns a random syllable. Remember, tables are just the data.

A more complex table might involved 2d100+35 and have a vast range of resulting outputs; some of those outputs might themselves be calls to additional tables!

Generators

A generator is what the end user actually sees and uses. Generators are lumps of text which reference tables. In essence, they are a text-based framework into which any number of random entries can be inserted. You reference a table in a generator by using its name in curly brackets. So, if the above example table is called "colors" and is created by Morrus, a very simple generator might read:
You see a {Morrus(colors)} box.

OGRE would then output something like: "You see a green box."

A slightly longer, but still very simple generator might look like this:
After travelling for {2d6+20} days, the {admin(Size)} {admin(Colours)} level {1d20} {admin(pathinder_race_core)} {admin(pathfinder_class_core)} sees {admin(pathfinder_desert_encounter)} in the desert and {admin(pathfinder_forest_encounter)} in the forest.

Which might output something like: "After travelling for 27 days, the large blue level 15 dwarf wizard sees 5 venomous snakes in the desert and 1 giant stag beetle in the forest."

Of course, generators can be much more complex than this, calling on dozens of tables and formatted in various attractive or useful ways - for example, you might create a generator which generates an entire Pathfinder character and presents it in an attractive character sheet.

Generators use a rich-text WYSIWYG text editor to help you format your desired output, and also accept HTML for more complex table-based layout choices.

Sharing

The basic concept of OGRE is a crowd-sourced, shared data-set. Every user who creates a new table or generator adds to the overall data resource. You might create a random table of NPC elf names today, and in six month's time, someone making their village generator might call on that table for some of the NPCs. In another six months, someone creating a world generator might call on the village generator, which calls on the elven NPC name generator - and so on. You can probably imagine much larger and more complex and intricate structures than that.

Yes, there is error checking for infinite loops.
Syntax for calling tables and generators
Tables and generators are called using the following syntax:

  • Table: {username(tablename)}
  • Generator: {username[generatorname]}

Both generators and tables can call other generators and tables.

Sometimes you may need to specify the die roll before calling a table (perhaps you're applying modifiers to it, or want to apply the same die roll to multiple tables, or are using the table to look up specific data rather than roll). Use the following syntax:

  • The format for changing the roll output is as follows: {username(tablename)[replacedroll]|capscontrol}
  • You can either use numbers, variables, or rolls in the "replacedroll" slot.
  • Here are some examples:
    • {admin(cave_monster)[3]} which would always give the roll result of 3.
    • {$x:7}{admin(cave_monster)[$x]} which would always give the result of $x, which in this case is 7.
    • {admin(cave_monster)[{2d6}]} which would give a number between 1 and 13.

  • It is also be possible to do math within the added roll number like so: {admin(cave_monster)[{2d6+9*$x}]}
Caps Control
Because the creator of a table or generator never knows whether their creation will be referenced in isolation, at the start of, or in the middle of a sentence, any reference to a table/generator entry may also contain a modifying tag to alter the way it is displayed. There are four basic options: all lower-case, all upper-case, and two variations on first-letter-uppercase.

The formatting for capitalization is as follows:
{username(tableorblock)|capitalizationcode}

These are the capitalization codes:
|allcaps - ALL LETTERS ARE CAPITALIZED LIKE THIS.
|firstcaps - The First Letter Of Each Word Is Capitalized Like This
|firstcap - The first letter of the first word in the sentence is capitalized like this.
|nocaps - none of the letters are capitalized like this.

Integers

Sometimes when you perform calculations on variables you may need to drop decimal places, runs up, or round down. The format is similar to the caps functions and follows an | symbol as follows:

|int (removes decimal places leaving the whole number only)
|intup (round up)
|inddwn (round down)

Putting it all together

You can create as many tables and generators as you wish. Both tables and generators can reference each other, and you can freely use resources that others have created. So, if you're designing a big village generator, and somebody has already created a great tavern generator, you don't need to reinvent the wheel: you can simply call the existing tavern generator when you need it.

Scripts

  • Set Variable: {$varname: value} - the $ sign is required in variable names. The "value" can be a text, a numeric value or a dice script ie:{2d6} or a single variable (even itself) +/- a numeric number ie: {$varname: {$varname+10}}.
  • Print Variable: {print: $varname}
  • If/Else: {if: $varname=3} If condition text {elseif: $varname=2} Elseif condition text {else} Else condition text {/if}
  • Loops: {loop: 4} This text will display 4 times {/loop}
  • Execute Script: {script|script_name: arg1, arg2, arg3}
  • Shortcut For Dice Roll Script: {[x]d[y]} = {script|dice: x, y} - note dice script allows + or -[z] ie: {2d6+4}
  • Switch: {switch: $varname} {case: 1} First text {case: 2} Second Text {case: 3} Third Text {case: default} Default text {/switch}

Numerical variables mathematically interact (you can +-/* them). You can also "add" text string variables as follows.This adds the variables $Class and $Alignment. The ", " (comma space) in the middle isn't part if the format; it's there because I wanted to add a comma and space between them, so the output would be: "$Class, $Alignment" rather than "$Class$Alignment".
{$p: {print: $Class}, {print: $Alignment}}{print: $p} {print: $p}

User Input Variables

Variables can be set using the Set Variable script, above. However, sometimes you may wish to have the user input one or more variables which will then be used in the generator.

To add a custom user-input variable, start creating a generator, then click the "Add A User-Input Variable" link. This will make some forms appear.

The "Name" form will change how you refer to the variable in the generator. For instance, if you entered "gender" into the name form, you would refer to the variable in the generator with "{print:$gender}" or "{if:$gender=male}" etc. The "Name" form will also be the title of the variable when it's displayed on the view_block page.

Each "Option" form will change what the variable's value will be. For instance, if you made a variable named "gender" and gave it the options "male" and "female," {print:$gender} would either output "male" or "female' depending on which is selected by the user.

The "Add Option" link will add another option to the variable it is in. You must have at least two options for each variable. The page won't let you submit if you don't.

Clicking the "Preview" link inside each user-input variable will change the forms into a select box, so you can preview how the generator will output with the different options. After you clicked the "preview" link inside a variable, it will change into an edit link, which will let you edit the options and add/delete options again.

If you don't click the preview button inside a variable, it will output as "Variable Value" when you previewing the generator.

After you've submitted or edited a generator with custom user-inputs, each variable will appear as a select box for the user to choose from before executing a generator.

NOTE - a generator with user input variables still works when called form elsewhere. In this case, the variables won't be selected, so the first (default) values for each are used.

Rating, Favorites, & Commenting

You can rate any generator (from 1-10) based on how good it is. Visitors can then view the best rated generators. You are also able to comment on and discuss generators.

You can mark generators as "Favorites". A list of all your favorite generators is accessed from the OGRE menu.

How to make your First Generator

If you follow these instructions to make a simple generator, you'll have the hang of it in no time. Think of this like a tutorial/walkthrough.

First, create a table. This will be a simple list of colours, shapes, sizes, or something.

  • Click on "Create" in the menu at the top of OGRE
  • From the page that appears, select the "Create a Table" tab
  • Give your table a title
  • Give it a die roll range (such as 1d6 or 2d4 or 2d6+3)
  • Enter the die rolls down the left column, and the corresponding result in the right column. You can enter single rolls (1, 2, 3, etc.) or die roll ranges (1-3, 4-7, etc.). Try putting in some adjectives - colours, sizes, or something simple.
  • Enter a quick description so that anyone else who references your table knows what it does.
  • Select the "Testing" catagory. This'll keep it all tidy while you play. You can always move it later.
  • Don't worry about a thumbnail image for now. You should always put them on Generators, but they're not important for Tables.
  • Hit "Save Table"

You now have your first table. It's a list of colours, shapes, sizes, or whatever you chose.

Now, create TWO more tables in exactly the same manner. Put them in the Testing category, too, so other people know you're just trying stuff out. Make the tables as follows:

  • Another descriptive table (colours, shapes, sizes, what-have-you). That way you now have two tables which deliver a random adjective. They might be size and colour, or shape and size, or brightness and loudness, or whatever you decided to do.
  • A table which lists some ITEMS. Maybe box, cat, mat, mouse, tree, house or something. Again, doesn't matter what - you're just testing a this point.
So now you are the proud creator of THREE tables! You remembered to put them in the Testing category, right? That ensures everyone else knows they might not be perfect.

Next you're going to make your first GENERATOR. This will use the info gathered from your three tables.

  • Click on the Create a Generator tab (on the "Create" page)
  • Give it a title. This title should be a full title - "Dwarf Name Generator" or whatever. End it with "Generator" or "Creator" or something, so that when people Google a random generator, the title of your generator will make them click on it.
  • Now to enter the contents of your new generator. This will be your three tables. Use the "Browse Tables" link below the content box to find your first table. Copy the "Table Reference" below the table and enter it in the content box for your new table.
  • Do the same for your other two tables. The two adjectival ones first, then your item table last. It should look like this (though with your username and tablenames, not mine): {Morrus(Size Categories)} {Morrus(Colors)} {Morrus(assorted_items)}
  • Clicking the "preview" link will make a box pop up with a demo of what your generator output will look like. Using my above example, mine would look like "small green ball" or "big blue box" or something.
  • Feel free to adjust the grammar, layout, etc. of your output and insert any words, punctuation or sentences. You might change it to "You see a {Morrus(Size Categories)} {Morrus(Colors)} {Morrus(assorted_items)}"
  • Add a description, a 150x150pm image, select the "Testing" category, and save your generator. You're finished! It will appear on the main ("Portal") page of OGRE and be available for others to include in their own creations!
Now remember, a table or generator is for ANYONE to use. You are welcome to reference my many tables, for example, and I may well incorporate some of your stuff into mine.

Here's an example of a fairly simple (but more complex than the one we just made) generator which describes a pirate ship. You'll find it here if you want to try it out, but below I've pasted the generator content so you can see how I did it. You'll see I used a basic sentence structure, referenced a bunch of tables (some of which reference other tables and generators themselves, such as my English Town Name Creator), and incorporated a simple loop to randomize the amount of stuff in the cargo hold. Hopefully this will help make it clearer how to do these things!

Anyhow, here's the code:

{Morrus(pirate_ship_name_compiled)}, under the command of Captain {Morrus(pirate_names)}, is a {Morrus(general_extraneous_item_descripton)} {Morrus(pirate_ship_type)} originally out of Port {Morrus[English Town Name Creator]}. Its hold is currently filled with a cargo of {Morrus(trade_goods)}. Other items in the hold include {loop:{1d4}}{Morrus[Mundane Treasure Generator]}, {/loop} and {Morrus[Mundane Treasure Generator]}. The ship's first mate is {Morrus(pirate_names)}.
Tags: Add / Edit Tags

Current Discussion: Main discussion

  1. NOTICE: to copy the content of a text $origin_var into another text $destination_var You MUST use the following syntax:

    {$destination_var: {print: $origin_var}}

    One hour of troubleshooting I hope to save to everyone else.

    PaleMage
  2. NOTICE: to copy the content of a text $origin_var into another text $destination_var You MUST use the following syntax:

    {$destination_var: {print: $origin_var}}

    One hour of troubleshooting I hope to save to everyone else.

    PaleMage