Skip to content

scenario_building

Jan Boon edited this page Nov 23, 2026 · 5 revisions

title: Designing and Building a Scenario description: From an idea to a tested, translated Ring scenario: the design on paper, the island, building in the editor or from a script through the client's control endpoint, testing, and translating published: true date: 2026-11-21T00:00:00.000Z tags: ring editor: markdown dateCreated: 2026-11-21T00:00:00.000Z

A Ring scenario is a small world with a story in it: an island, a cast, the things they say and do, and the logic that moves the story from one scene to the next. This page goes through making one from start to finish: designing it on paper, choosing and walking the island, building it in the editor (by hand, or from a script through the client's control endpoint), testing it, and translating it.

The editor's parts themselves are explained in the user guides: Sessions, Scenarios and Acts, Entities, Walkpaths and Grouping, Sequences, Events and Dialogs and Edit, Test, Animation, DM and Play Mode.

Designing on paper

Write the whole scenario down before placing anything: the story, the places, the cast, every line of dialogue, and the logic that joins them. Building is quick once the design holds; redesigning in the editor is slow.

From a story to acts

An act is the place as it is at one point of the story: who stands where, what they do, what the players can do. Start from the story's events and cut it where the situation changes: those are the acts. The idle states count as acts too. A scenario usually starts with the place living its ordinary life, before the players start the story by something they do (not by a timer), and it can end the same way, with the place living on, changed by what happened.

What stays the same through the whole story, the scenery and the wildlife, goes in the permanent act, which is present in every act. The cast is placed again in each act where the scene needs it: that is simpler than moving one cast through many acts, and each act then starts with everyone in place.

Give each act one way out: a Start Act action on one kind of event (a stone touched, a dialog finished, an item given). Everything else in the act serves that event. An act built this way can be tested on its own: the Adventure Master's act menu jumps to it, and one event leaves it. A choice is two components that cannot both succeed, each starting its own act.

Logic

Logic is written as event handlers: source : event (conditions) → actions on targets. A few patterns come back in every scenario:

  • Joining parallel tasks. There is no "all of these are done" event. When four tasks can finish in any order, give each one a handler on its own success with the other three as conditions (is succeeded): whichever finishes last opens the next step.
  • Order through activation. A component that must not happen yet starts inactive and is activated by the event before it.
  • Zones that fire once. A zone trigger made not cyclic fires at the first arrival only (a new one is cyclic). A plain zone trigger that starts inactive is re-armed when it is activated, but the zone inside a proximity dialog, an ambush, a visit zone or a hidden chest, made not cyclic (a proximity dialog that plays once), stays armed while its component is inactive, and a player who passes early uses up its one firing. Make such a zone cyclic, or move the story on an NPC's arrival instead of a player's.
  • Two orders, two handlers. When two things must both have happened (an NPC at a place, a player at that place), write one handler for each order, each testing the other with a condition.
  • Spawn on acceptance. A hunt counts only the kills made after it is accepted, so its quarry should appear on the task's mission asked event.
  • One dialog for every greeting. A dialog whose steps end with Then pause can be jumped into with starts chat: each NPC's targeted by player starts the step with that NPC's greeting, one component for the whole cast.

Texts

Write every line in full, with its speaker and its emote. A spoken line is one chat bubble: keep it short, and split longer speech into steps. The property windows take at most 32 characters for a name, and the windows of most tasks at most 100 for a contextual text (the line a player clicks in the target's menu). Dialog steps spoken by _System reach every player of the session as a broadcast in the middle of the screen; NPC lines are heard by the players near the speaker, so start important speeches where the players are.

Budget

The editor counts the cost of each act: one for each NPC, creature and logic component, one more for the zone or chest some components carry inside them, and a separate count for scenery objects. The permanent act's cost is paid in every act. The limits are the scenario service's MaxNpcs and MaxStaticObjects (100 each by default); the editor's budget display is what counts.

Level and Ring access

Every palette element has a level and a Ring access package. The scenario's level is the band of the characters it is made for: choose the lowest band in which the creatures the story needs exist, and keep the fights to creatures of that band. Stronger creatures can still stand in the scenery as unattackable life (Player attackable off, Aggro 0).

The island

Choose the island in the editor's island chooser: each ecosystem lists its islands with a map and their entry points. The maps are rendered from above; the ground itself is best learned by walking it in the editor before deciding where anything goes.

Ground the AI can use

Not all the ground of an island is ground for the AI. The AI service has its own map of each island, made from its collision, and the tops of root mounds and pillars, cliffs and the rim of the island are not on it. The editor shows where that map has ground: an NPC or an object placed outside it is marked as misplaced, and a region or route with a point outside it is drawn as inaccessible. The AI service cannot place anything there. An NPC whose activity uses such a region or route does not appear, and an NPC or object placed there is shown by the client on whatever surface it finds at that spot, which on a root mound is its top.

The islands of the Prime Roots are layered, with roots arching over the floor, but the AI's map has two layers in a few places only, under some arches. There an NPC, an object or a point of a region or route stands on the layer nearest to the height it was placed at, on the floor under the arch or on the arch, when a layer is within a few metres of that height; a height no layer is near (a point moved without its height) puts it on the upper layer, as the AI service does without heights, and the AI service logs it.

Keep NPCs, props and the points of regions and routes on ground the editor accepts, and check every placement in a test (below).

Room to reach

A player uses an NPC or an object (an option of its menu) only from close by, and the distance is measured to its centre. A large prop, a ruin wall, is never close enough: make the object players use a small one, and set the large one behind it as scenery. Props have collision, so keep them off the way to every NPC and object players use, and leave no pocket between props where a character can walk in and not out.

Regions and routes

The AI service also checks every point of the regions and routes an act uses when the act starts, and logs Path pos Error at position (x,y), no acceptable position found around for a point it cannot place, and error while placing the points of the state that uses it. An NPC whose activity has such an error does not appear. The log of the AI service (ais/log.log on a development shard) lists them for each act start.

Building

In the editor

The palette places NPCs, creatures and objects, the feature list places logic components, and the property windows, the dialog editor and the activities and triggers windows fill them in, as the user guides describe.

From a script, through the control endpoint

A client started with the control endpoint (see Client Control Endpoint) can be driven by a script, or by an AI agent through nel_mcp. The ring.* methods build a scenario through the editor's own requests, so the result is the same as building it by hand: the changes reach the scenario service and the co-editors, can be undone, and are saved by the editor.

Method Does
ring.state The editor's mode, the scenario and the current act
ring.tree The scenario tree, or the tree below an instance: every property, with instance ids
ring.palette The palette's elements, filtered by a word or an id prefix
ring.create Creates an instance: an entity from a palette element, a feature or another component by class
ring.set Sets one property of an instance
ring.erase, ring.move Deletes an instance, moves it in the world or below another parent
ring.undo, ring.select Undo and redo, the selection

ring.create, ring.set, ring.erase and ring.move change the scenario past the checks of the editor's windows, so they run only in a client started with --ctrl-trusted, the editor of one's own scenario on one's own shard. They work in edition mode; in a test or an animation the edited scenario is not loaded, and ring.state gives the mode and the index of the current act. Like the palette, drawing and move tools, ring.create and ring.move refuse a position off the AI's ground (see Ground the AI can use), naming each position refused. ring.create tests what stands in the world, a feature, a dialog, every point of a region or route, the members of a group, and the zones of a trigger zone, a bandit camp or a herd; like the tools, it also refuses a region of fewer than 3 points, a route without a point, either of more than 16, and a group whose members stand more than 20 m apart. ring.move tests the new place of what stands in the world, and the points of a region or route and the members of a group, as the move tool does; it also refuses a group member moved more than 20 m from the others. Neither tests whether a region's outline crosses itself, as the drawing and move tools do. ring.set replaces no sub-object, so it cannot write a whole Position, but it writes the x or y of a Position given by its own id without any test: move things with ring.move. In Lua the same tests are r2:isValidPos(x, y) and r2:isValidPoly(polygon).

The values of ring.create set the new instance's properties, and can build a whole component in one request:

  • a plain value sets the property: "Name": "Welcome", "AutoStart": 1;
  • {"ref": "Client1_123"} is a reference to another instance (an NPC a dialog step is spoken by, the giver of a task);
  • an object with Class is a new component of that class, with its own values;
  • an object without Class fills the sub-object of that name (Position, an event handler's Event, an action step's Action);
  • an array appends its items to the list of that name (a dialog's Components, a handler's Actions).

An entity is made from a palette element (base), as the palette makes it: a civilian, whose look is random in the palette tool, gets the editor's random look for its people, and the script sets the look properties it wants. A feature is made by its own creation function at values.Position, with the parts it needs (the zone of a zone trigger, the chest of a loot spawner); args passes the extra arguments some take (a timer's seconds, minutes and cycle). A position without a height, the instance's own as well as those of the points and members it holds, gets the ground's height from the editor, and ring.move sets the height of the new place.

A dialog with a step spoken by an NPC, in one request:

{"class": "ChatSequence", "parent": "<act id>", "property": "Features",
 "values": {"Name": "Welcome", "Base": "palette.entities.botobjects.dialog", "AutoStart": 1,
            "Position": {"x": 24200, "y": -1500},
            "Components": [{"Class": "ChatStep", "Time": 12,
                            "Actions": [{"Class": "ChatAction", "Who": {"ref": "<npc id>"}, "Says": "<text entry id>", "Emote": "Wise"}]}]}}

The line itself is a text entry of the scenario's text manager: ring.create with "class": "TextManagerEntry", "parent" the scenario's Texts and "property": "Texts", and "values": {"Text": "...", "Count": 1}. An event handler goes in the Actions of the source's Behavior:

{"class": "LogicEntityAction", "parent": "<behavior id of the source>", "property": "Actions",
 "values": {"Event": {"Type": "end of dialog"},
            "Actions": [{"Class": "ActionStep", "Entity": {"ref": "<act id>"}, "Action": {"Type": "Start Act"}}],
            "Conditions": [{"Class": "ConditionStep", "Entity": {"ref": "<task id>"}, "Condition": {"Type": "is succeeded"}}]}}

The event, action and condition names are those of the component classes (r2_features_*.lua and r2_logic.lua in ryzom/common/data_common/r2: their Events, ApplicableActions and Conditions). The server applies each request a moment later; a script that refers to an instance it just created waits until ring.tree finds it. The scenario is saved as the editor saves it, with r2.Version.save(filename) through lua.run, which writes the file's header and its checksums.

On a connection at protocol level 4.2 (ryzomcore/4.2, QUIC streams) the scenario service's answers and updates travel on the stream of the module gateway, and NPC lines and other texts on the chat and strings streams, so the answers to a script that sends hundreds of requests do not hold up the game's own traffic. The streams go from the server to the client only: the editor's requests go in the client's datagrams, as at every level.

Testing

Start a test from the editor (F8, or the test button at the end of the editor's toolbar). The test starts in the Adventure Master's view; the button at the bottom left switches between that view and the player's. In the master's view the act menu starts any act, the triggers menu fires the user triggers, and the toolbar kills, heals or despawns what is targeted, which lets the logic of an act be checked without fighting through it. Switching back to the player's view also brings a dead character back.

What to check in each act:

  • every NPC, creature and object is there and stands on the floor (see layered ground above), and the AI service logged no position error for the act;
  • every dialog is heard by the players where they will be when it runs;
  • every task can be taken, done and handed back: the giver's mission text, the option in the target's menu, the success text and broadcast;
  • every event handler fires, and the act's way out starts the next act;
  • plot items given in one act are still in the bags when a later act takes them;
  • the fights suit the scenario's level.

Testing from a script

The control endpoint drives a test as well: world.go_to walks the character, world.target targets an NPC or an object (a target in reach is needed to choose an option), and the target's Ring options are in the database under LOCAL:TARGET:CONTEXT_MENU:MISSION_RING:<n>:TITLE (a string id) and are chosen with the action mission_ring (ah.run, id=<n>). NPC lines arrive as chat events, _System lines and act notes as system_info events of category BC. A chest the scenario hides is opened by attacking it. In the master's view, r2:dssTarget('KILL_NPC') and r2:dssTarget('GRP_KILL') through lua.run kill the target or its group, and r2.ui.AnimActs:chooseAct(n) starts an act. Its count starts at the permanent act, which it does not start: 2 is the first act. ring.state counts from 0, so its act i is chooseAct(i + 1).

Translating

A scenario has one language, set in its properties (Language): the sessions launched from it are listed with that language. A translated scenario is a copy whose texts are translated. Translate in the editor rather than in the saved file, whose header carries checksums of its body: load the scenario, set every text to its translation (by hand, or from a script with ring.set or a lua.run that walks r2.Scenario), set the language, and save it under the new name. The default names the palette gives to objects and creatures ("tryker tent 1", "Trooper Kipee") are the game's own translated names in each language (the editor's labels in r2_<lang>.uxt, the creature names in creature_words_<lang>.txt).

The scenario languages are listed in ScenarioLanguages of the client configuration: fr, de, en, es, ru and other_lang.

Sharing

A scenario is a file in the folder the editor saves in (ScenarioSavePath of the client configuration). Copy it to another player's folder, or launch it from a Ring terminal. The examples that ship with the client are in its examples folder, listed by r2_leveldesign_scenarios.lua, r2_event_team_scenarios.lua and r2_newbieland_scenarios.lua.

See also

Clone this wiki locally