Skip to main content

OblivionMP SDK 1.1.0 released

· 10 min read
ReadyM Team
Creators of WukongMP and OblivionMP

1.1.0 is out, and the biggest update is networked events: a way for mods to tell each other that something happened, and to step in before it takes effect. Most of the rest of this release is built on them. The game's own scripts raise networked events now, so a TES mod's scripts can be part of an OB:MP mod. Doors, levers and locks are synchronized and survive a restart. Horses can be ridden in front of other players, and perks in combat look the same on every client.

Server mods can also furnish the world. They place, move and remove furniture, and it stays put across restarts. We used this release to clean up the SDK too. It ships fewer assemblies, and its namespaces now match the mod's name, OblivionMP.SDK.

On the client, the game starts in the multiplayer world now instead of at the main menu.

That cleanup breaks existing mods, so read Upgrading before you rebuild.

What's new​

Networked events​

A networked event is a struct describing one thing that happened, like a spell cast or an item changing hands. The mod raises it, the server checks it, and then it goes out to the players who should hear about it. Any mod can hook in along the way, even one that did not declare the event.

A hook can refuse the event: a safe-zone mod can block damage inside a town without knowing which combat mod dealt it. It can change the event before it lands, say halving that damage instead. Or it can just watch, which covers logging and achievements without touching anyone else's code.

A player does not have to wait on the server either. Mark a value [Predictable] and the client shows the change right away, then rolls it back if the server says no.

Each event has a scope, which decides who hears it (a cell, an area, the server or everyone), and a policy, which decides who may raise it. The game raises its own events through the same API, for health, items changing hands, time and weather, spell casts, furniture and food, so your mod can hook into those as well.

None of this retires RPCs. When a mod only talks to its own other half, they are still the simplest thing that works. The catch is that nobody else is in the loop. Other mods cannot see an RPC or stop it, and the player waits on the server before anything changes on screen.

Our rule of thumb: if only your own mod cares, send an RPC. If other mods might want a say, or the player should not wait on the server, raise a networked event. The Networked events page shows how to declare, raise and handle them.

TES scripts​

Oblivion runs on scripts. Pull a lever and a script opens the gate. Walk into a trigger and a script moves a quest along. In single player one game decides what all of that does. On a server there are several, and until now a script that fired on one player's game did not reach anybody else.

The game's scripts raise networked events now. Activation, hits, trigger enter and leave, dialogue results, the button chosen in a message box, script variables, placement, presence, sequences, linked path points, lock changes, lockpick claims and door transitions all go through the same API your own events use. Server mods handle them, and the client SDK bridges them back into the game.

Which client runs a script is a rule the server mod writes. The client never reads it and gets it through sync like any other replicated state. There are two places to write one. ScriptPolicyDefault on World sets a default per kind of script, and ScriptPolicy on an entity overrides that default for that one entity. WorldActivator, Door, Container, Furniture, Flora, DroppedItem and Npc all carry it.

The SDK writes neither of them. A server that sets no rules of its own gets Run for quests, dialogue results, actors and objects, and Everywhere for targets. If you want a lever worked only by the client that owns it, your server mod has to say so. Quests are the exception with a policy of their own, QuestScriptPolicy. A GameMode block on an object follows that object's rule, not a separate one.

This is for TES mods. A mod built in the Construction Set is mostly scripts, and scripts that fire for one player are not much use on a server. You can bring one in as part of an OB:MP mod now and decide, per object, which client runs its script. Rules per script form are not in yet. We want everything to be an entity first.

Doors, levers and locks​

A door another player opens opens on your screen too, with the same animation. Load doors, the ones that move you between cells, share a lock across both sides of the pair, so a door locked from one side is locked from the other.

Locks belong to the server. Picking one is a claim: one player works a lock at a time, and everybody else is told when the lock changes. The starting state comes from the game's own data, so a dungeon is locked the way it should be on a fresh world.

Door and lock state is saved per cell and restored at startup, so a gate somebody opened before a restart is still open after it.

The doors the game keeps on a schedule, shop doors most of all, follow it on the server rather than in each player's game, so a shop opens for everybody at once. One schedule covers all of them for now. The server owner sets the hours, or turns it off, in the seed loader's config.

Levers and buttons are entities now, which is what lets one player pull a lever and everyone see the result.

Furniture​

Server mods can put furniture in the world while the server is running, then move, rotate and remove it. Every change is synchronized, so a chair a mod drags across a room ends up in the same spot for every player who can see it.

Furniture a mod places also survives a server restart. The server stores it and puts it back when it comes up again, so a mod that furnishes a house does not have to build the room from scratch every time.

Furniture is created like any other world entity, with the cell as its scope and the cell's master client as its owner. World and cells covers how.

Horses​

Riding is replicated. A horse somebody mounts moves to their game and follows them, and the other players see them riding it.

Mounting and dismounting are networked events, HorseMountRequestedEvent and HorseDismountedEvent, so a mod can refuse a mount or react to one. A horse that already has a rider refuses a second. Quick dismounts, where the game skips the animation, are caught too. An NPC rider's horse follows its owner.

Combat perks​

Skill perks on a remote player's character read that player's own skill now, so Blade, Blunt, Hand to Hand, Marksman, Block and Sneak perks match the person actually swinging.

Perk procs roll from a seed taken from the attacker's action, which makes every client roll the same result. Shield bashes go out through ShieldBashEvent, so other players see them.

Changes and fixes​

Fewer assemblies​

We folded a handful of small assemblies into the ones they always shipped with. Your mod only notices the namespaces it imports, and Upgrading covers those.

  • The four Yooni.Native assemblies (Logging, LowLevel, Container, Serialization) are now one, ReadyM.Native.
  • ReadyM.SDK.Chunks is part of ReadyM.SDK, and ReadyM.Relay.Client is part of ReadyM.SDK.Client.

Server​

  • The server loop waits in the kernel now instead of busy waiting. It holds an exact 120 Hz tick, does almost no work with nobody connected, and costs less per tick with a lot of players on.
  • The Network page of the admin panel got filtering and sorting. Click a legend entry on the throughput or tick chart to hide that series, and the rest fill the axis. Click a column header in either traffic table to sort by it.
  • That page times a whole tick now rather than the ECS update alone, and a tile beside the timings shows the share of the tick budget the loop uses. A mod's RPCs and networked events appear there by name instead of Custom(code).

In the game​

  • The game launches straight into the multiplayer world. The intro logo videos, the "Press any key" title screen and the main menu are skipped.
  • The System page of the settings menu has only Exit Game on it now. Quick Save, Save Game, Load Game and Main Menu are gone; the world lives on the server, so there is nothing local to save or load.
  • Name tags fade out when the player they sit over goes behind something, and fade back in when they are visible again.
  • Removed the lobby status panel.

Fixed​

  • Fixed a crash that occurred when fast travelling after a character's puppet had despawned.
  • Fixed server freezes caused by many cells coming up for respawn at once. Respawns are spread out now, one cell per tick, each judged on its own area's clock.
  • Fixed rejoining a server after it had restarted.
  • Fixed the group time skip rejection message not being localized.

Upgrading​

Your mods​

  • Bump the SDK packages to 1.1.0.

  • Rename OblivionMp.Sdk to OblivionMP.SDK, which includes OblivionMP.SDK.Common and OblivionMP.SDK.Serverside. C# names are case-sensitive, so make it a case-sensitive find and replace across your sources. Nothing else changes.

  • Rename Yooni.Native to ReadyM.Native. Only the namespace moved. NativeList<T> and NativeString64 keep their names, so using Yooni.Native.Container; just becomes using ReadyM.Native.Container;.

  • The RPC attributes moved to ReadyM.SDK.Attributes. [ClientToServer], [ServerToClient], [ClientToClients] and RelayMode now sit next to [RpcContracts]. Your contracts file already imports that namespace for [RpcContracts], so it builds as is, and you can drop the ReadyM.Api.Multiplayer imports it needed before.

  • IServerEvents moved to ReadyM.SDK.Server.Events, and its handlers get shapes instead of ids and raw entities. Update their signatures:

    1.0.01.1.0
    OnPlayerConnected(PlayerId, Entity)OnPlayerConnected(Player, Guid), with the player's ReadyM id
    OnPlayerDisconnected(PlayerId, Entity, DisconnectReason)OnPlayerDisconnected(Player, Guid, DisconnectReason)
    OnAreaCreated(AreaId, Entity), OnAreaDeleted(AreaId, Entity)OnAreaCreated(Area), OnAreaDeleted(Area)
    OnCellCreated(AreaId, CellId, Entity), OnCellDeleted(AreaId, CellId, Entity)OnCellCreated(Cell), OnCellDeleted(Cell)
    OnPlayerActivatedCell(PlayerId, AreaId, CellId), OnPlayerDeactivatedCell(PlayerId, AreaId, CellId)OnPlayerActivatedCell(PlayerId, FullCellId), OnPlayerDeactivatedCell(PlayerId, FullCellId)
    OnWorldEntityCreated(Entity)OnWorldCreated(World)

    OnPlayerJoinedArea and OnPlayerLeftArea are unchanged.

  • The connection events on IPlayers are gone. They were already obsolete in 1.0.0. Use IServerEvents.OnPlayerConnected and OnPlayerDisconnected instead.

  • Recompile. The generated code changed with the SDK, so a mod built against 1.0.0 will not load on 1.1.0, even if nothing above applies to it.

Your server​

  1. Recompile your mods against the 1.1.0 SDK.
  2. Download the 1.1.0 server package from Installation.
  3. Stop the old server.
  4. Copy the saves folder, the data folder, the branding folder and config.json from the old server folder into the new one.
  5. Copy your own mods into the new mods folder, and with them any config file you edited in a mod the package ships, such as the seed loader's.
  6. Start the new server.