DEV Community

Cover image for INER: A communication protocol that separates client intentions from authoritative server events
Pietro
Pietro

Posted on

INER: A communication protocol that separates client intentions from authoritative server events

I've been developing a communication protocol called INER (Intention, Notification, Event, Response), originally designed for a multiplayer game I'm building in C++.

The problem I wanted to solve was how to organize communication between clients and servers without treating every message as a generic packet whose meaning is determined entirely by application code.

INER introduces four message types, two distinct roles, and a structured way to represent requests, results, and information.

The problem

Consider a multiplayer game where players can move, fire weapons, purchase items, and interact with the world.

These interactions don't all mean the same thing.

When a player tries to purchase an item, the client is requesting an operation. The server must evaluate whether that operation is allowed.

When the server informs players that an entity has moved, it's communicating an authoritative occurrence.

And when a client reports its FPS, it's simply providing information. It isn't requesting a change to the server's state.

All of this can be implemented with generic messages and custom handlers. However, developers still need conventions for distinguishing requests, results, and informational messages.

I wanted those distinctions to be part of the protocol itself.

Two roles: Authority and Obedient

INER defines two communicating roles:

Authority: Controls the application's internal state, evaluates requested operations, and communicates authoritative information.

Obedient: Requests operations from the Authority, sends informational messages, and receives authoritative events and results.

In a typical multiplayer game, the server acts as the Authority and the clients act as Obedients.

The important distinction is that an Obedient can request something, but the Authority decides whether it actually happens.

The four INER message types

  1. Intention (Obedient → Authority)

An Intention represents an action that the Obedient wants the Authority to perform.

Examples:

  • A player requests to move.
  • A player attempts to fire a weapon.
  • A player tries to use an item.
  • A client requests to join a match.

Sending an Intention doesn't mean the action has happened. The Authority must evaluate it.

Header:

  • "size" — 2 bytes.
  • "type_id" — 2 bytes.
  • "correlationId" — 2 bytes.

Payload: Variable-length data describing the requested operation.

For example, a movement Intention could contain the movement information that the server needs to evaluate.

The correlation identifier allows the corresponding Response to be associated with the original request.

  1. Notification (Obedient → Authority)

A Notification communicates information without requesting a change to the Authority's internal state.

Examples:

  • Reporting measured network latency.
  • Sending client FPS information.
  • Reporting client-side diagnostic data.

Unlike an Intention, a Notification doesn't request an operation or expect a Response.

Header:

  • "size" — 2 bytes.
  • "type_id" — 2 bytes.

Payload: Optional, containing application-defined information.

For example, a client could periodically send a Notification containing its measured latency.

This distinction prevents informational messages from being treated as operations requiring authorization.

  1. Event (Authority → Obedient)

An Event communicates an occurrence or state update from the Authority.

Examples:

  • A player joins the game.
  • An entity moves.
  • A projectile spawns.
  • A match begins.

An Event communicates something authoritative rather than requesting permission for it to happen.

Header:

  • "size" — 2 bytes.
  • "type_id" — 2 bytes.

Payload: Optional, containing information about the occurrence.

For example, after processing a player's movement, the server could send an Event informing relevant clients about the entity's new position.

Unlike a Response, an Event doesn't need to correspond to a particular Intention.

  1. Response (Authority → Obedient)

A Response communicates the result of a specific Intention.

For example, after receiving an Intention to fire a weapon, the server can respond according to the outcome of that operation.

INER defines four response statuses:

Approved (0): The requested operation was fully approved.

Example: A player requests to move, and the server accepts the movement.

Denied (1): The requested operation was rejected.

Example: A player attempts to fire a weapon without sufficient ammunition.

Partially Approved (2): The requested operation was only partially applied.

Example: A player requests an operation involving several items, but the server can fulfill only part of it.

Failure (3): An internal error occurred while processing the request.

Example: The server encounters an unexpected processing error.

A Failure doesn't necessarily mean the operation was denied. It means the Authority couldn't process it successfully.

Base Response header:

  • "size" — 2 bytes.
  • "correlationId" — 2 bytes.
  • "status" — 1 byte.

The base header occupies 5 bytes.

Denied and Partially Approved responses use an extended header containing an additional 2-byte "reasonCode", making it 7 bytes.

Payload rules:

  • Approved: No payload.
  • Denied: No payload in the recommended format; includes a reason code.
  • Partially Approved: May include an application-defined payload and includes a reason code.
  • Failure: No payload.

This allows the application to distinguish a rejected operation from an internal processing failure, or a completely approved operation from a partially applied one.

Binary message representation

INER uses compact binary headers.

Every message contains a header, followed by a payload when applicable.

The "size" field represents the total message size, including its header and payload.

For messages sent by the Obedient, the size is represented directly.

For messages sent by the Authority, the first field also encodes whether the message is an Event or a Response.

Its least significant bit distinguishes the two:

  • "0" identifies an Event.
  • "1" identifies a Response.

The remaining bits encode the message size.

This allows the receiving implementation to distinguish these message categories without introducing a separate message-category field.

Message types and payload formats are defined by the application using INER.

What does INER actually solve?

The objective isn't to replace TCP, UDP, or existing networking transports.

It's to provide consistent semantics for application-level communication.

INER helps distinguish:

  • What a client wants to happen.
  • What information a client wants to report.
  • What the authoritative server says happened.
  • What result the server produced when evaluating a request.

It also standardizes request correlation and the representation of different operation outcomes.

This doesn't eliminate application-specific logic.

For example, INER doesn't determine whether a player has enough ammunition to fire a weapon. That decision still belongs to the server.

The protocol simply provides a structured way to communicate the request and its outcome.

Independent of the transport

INER doesn't define sockets, connections, threads, or how messages are physically transmitted.

It defines their semantic structure.

I've implemented INER in LightnerX, my open-source C++17 networking library for multiplayer applications.

LightnerX uses Valve's GameNetworkingSockets for transport and provides components for connection management, message interpretation, callbacks, and message delivery.

The intention is to keep the communication model conceptually separate from the underlying network transport.

Source code: https://github.com/pietroth/LightnerX

Documentation: https://pietroth.github.io/LightnerX-docs/

I'm still developing and refining the project, and I'd appreciate technical feedback on the protocol's design.

Do you think explicitly distinguishing intentions, notifications, events, and responses at the protocol level provides useful architectural structure, or would you prefer a generic messaging system where all these conventions are implemented exclusively in application code?

Top comments (0)