What is in a RSPS base?

Private servers are pretty complex applications. What follows is a breakdown of some of the systems a private server will include.

Intro

A private server is actually a peice of software, a program, like Skype, iTunes or Teamspeak, except private servers use a programming language called Java. We decided to use this because it's what Jagex used to create their client in 1999.

Within a server there are plenty of sub-systems that as a beginner you'd have no clue are in there, but all these systems together make having a private server possible. Jagex's server is like ours, it runs skills, minigames, saves players progress, manages friend lists etc. While Jagex put a lot of their content into a different place and write it slightly differently in their scripting language RuneScript, we put it into the source written in Java. To give you an idea how much there is going on, a guess could estimate Jagex have 10 million lines of code. if you average 15 characters per line, that's 150 million characters. If the average word was 4 long, that's 37.5 million words of code typed to achieve the content jagex has.

Data/information required

Every item has an examine, same as an NPC and object. Where are every single one stored? Somewhere for sure.



Networking

The networking side of the server handles connections between the client and server. To get a real understanding about how this works you may wish to look at this post on rune-server about the #474 protocol and it gives a detailed description of the many elements involved in this topic.

Minigame timers, shop re-stocking, ground item timers

These are some systems which will happen in the background.

Minigame timers

The server will start a game of pest control every 60 seconds, if there are enough people in the best control boat.

Fight caves

Once a player kills an NPC in the fight caves, the next round must spawn

Fight pits

Once there are no more players left after the slaughter, a player is crowned winner and given a red skull.

Shop restocking

Every 10 or so seconds (changes per server) the amount of general stock in a shop will increase up to a certain amount (example 10 buckets) and any items sold to the shop by a player will decrease (until they disappear from the shop)

Ground items

After 60 seconds, a dropped item becomes visible to everyone online.
After another 30 seconds, it disappears forever.

Extra: file-server

Note: this feature may not be present in some servers
In many private servers, you'll download a client and get the cache with it (which is anywhere between 15-300MB in size).
This feature enabled the system that Jagex, to send only the parts of the cache the player needs. Part of the cache might have music in, or part of the map. If you never play that song, or go to that place in RS, you don't need it (until you go there). This means players only need the client, and the cache they will get bit-by-bit from the server when they need it.

Extra: login-server

Note: this feature may not be present in some servers
This is a separate Java application from the server. This acts as a central hub between all ~150 game servers (worlds) Jagex have. This is used to check that you don't login to 2 worlds at once.

Extra: friend-server

Note: this feature may not be present in some servers
Enables the ability to send a private message to someone playing on a different game-server (world), however many RSPS only have 1 world anyway so this is not needed.

Game Engine & entity updating

The game loop is what keeps the program running, without it the code will run and the program will exit, with nothing left to do.

The game engine makes a schedule "task", or a block of code, that is executed every 600 milliseconds. During this time, a few different chunks of code have to be executed. Here is a pesudocode example:

On startup/application init

To run a Java program you need this chunk of code, you'll know this if you've read the how to code section of this Wiki. When many private servers start, they load all the information described above into memory: