Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/Server/classes/ConnectionHandler.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# ConnectionHandler

Legacy Netty 4 inbound handler kept for reference. It demonstrates how new
`Session` objects were once created and how packets were forwarded to a
`Client` instance.

Source: [ConnectionHandler.java](../../2006Scape%20Server/src/main/java/com/rs2/net/ConnectionHandler.java)
21 changes: 21 additions & 0 deletions docs/Server/classes/GameEngine.md
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
# GameEngine

The main entry point for running the server. `GameEngine` bootstraps every
subsystem and runs the core game loop once every few hundred milliseconds.

Highlights:

- Loads configuration, caches and plugins on startup.
- Accepts network connections and exposes the Netty based pipeline.
- Schedules the primary tick which updates players, NPCs and objects.

Source: [GameEngine.java](../../2006Scape%20Server/src/main/java/com/rs2/GameEngine.java)

```java
public static void main(String[] args) throws IOException {
System.out.println("Starting game engine..");
FileServer fs = new FileServer();
fs.start();
scheduler.scheduleAtFixedRate(() -> playerHandler.process(),
0, Constants.CYCLE_TIME, TimeUnit.MILLISECONDS);
}
```
11 changes: 11 additions & 0 deletions docs/Server/classes/NPCDefinition.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# NpcDefinition

Data holder describing a non-player character. Definitions are loaded from
`npcDefinitions.json` on startup and cached for quick lookup via
`NPCDefinition.forId(int)`.

Source: [NPCDefinition.java](../../2006Scape%20Server/src/main/java/com/rs2/game/npcs/NPCDefinition.java)

```java
NPCDefinition goblin = NPCDefinition.forId(1);
System.out.println(goblin.getName());
```
11 changes: 11 additions & 0 deletions docs/Server/classes/ObjectHandler.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# ObjectHandler

Manages world objects such as doors, obelisks and scenery. `ObjectHandler`
creates objects for nearby players and periodically updates them as their
timers expire.

Source: [ObjectHandler.java](../../2006Scape%20Server/src/main/java/com/rs2/world/ObjectHandler.java)

```java
// spawn a temporary object
objectHandler.createAnObject(1234, 3222, 3218, 0);
```
11 changes: 11 additions & 0 deletions docs/Server/classes/PacketHandler.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# PacketHandler

Central dispatcher for all incoming packets. Each opcode is associated with a
`PacketType` implementation in a static array. When the server receives a packet
from a player session, `processPacket` invokes the mapped handler.

Source: [PacketHandler.java](../../2006Scape%20Server/src/main/java/com/rs2/net/packets/PacketHandler.java)

```java
// inside a Netty pipeline
PacketHandler.processPacket(player, packet);
```
19 changes: 19 additions & 0 deletions docs/Server/classes/Player.md
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
# Player

Represents a logged in user within the game world. The abstract `Player` class holds
core state such as inventories, skills and movement queues. The concrete `Client`
class extends it to handle packet I/O.

Key responsibilities include:

- Managing helper components like `PlayerAssistant`, `CombatAssistant` and
various skill handlers.
- Processing queued packets and updating the world each server tick.
- Handling logout, death and other gameplay related events.

Source: [Player.java](../../2006Scape%20Server/src/main/java/com/rs2/game/players/Player.java)

```java
Player p = new Client(session);
p.getPlayerAssistant().movePlayer(3222, 3218, 0);
p.update();
```
11 changes: 11 additions & 0 deletions docs/Server/classes/PlayerHandler.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# PlayerHandler

Maintains the global player list, assigning slots to new connections and
processing each active player every tick. `PlayerHandler` updates player
counters and saves data on logout.

Source: [PlayerHandler.java](../../2006Scape%20Server/src/main/java/com/rs2/game/players/PlayerHandler.java)

```java
// called from GameEngine each server tick
playerHandler.process();
```