Server Mechanic
Relevant source files
The following files were used as context for generating this wiki page:The Server Mechanic is a core progression system in Skid-Inc that allows players to purchase and upgrade two types of servers: Web and Telnet. These servers provide passive bonuses by increasing the player's money, experience, and time multipliers. Upgrading servers is a primary way for players to accelerate their progress in the game.
The system is managed through the skidinc.server object, which handles the state, purchasing logic, and multiplier calculations for the servers. Player interaction occurs via the buy command and the server information is displayed in the main statistics panel of the UI.
Core Components & Data Structure
The entire server system is encapsulated within the skidinc.server object. This object holds the current state of the player's servers, including their levels and costs, and defines the methods for interacting with them.
Sources: app/js/server.js:5-27
Data Structure
The skidinc.server object contains definitions for web and telnet servers. The owned array tracks which servers the player has purchased, although in the current implementation it is used to store the server objects themselves.
The diagram below illustrates the structure of the skidinc.server object.
Sources: app/js/server.js:6-23
Server Properties
The properties for each server type define their initial state, cost scaling, and gameplay effect.
| Property | Type | Description | Source |
|---|---|---|---|
level | Number | The current level of the server. Starts at 1. | app/js/server.js:8, 19 |
price | Number | The base cost to purchase or upgrade the server. | app/js/server.js:9, 20 |
price_mult | Number | The multiplier applied to the price after each upgrade. | app/js/server.js:10, 21 |
money_mult | Number | The bonus multiplier applied to money gains per level (Web only). | app/js/server.js:11 |
exp_mult | Number | The bonus multiplier applied to experience gains per level (Web only). | app/js/server.js:12 |
time_mult | Number | The bonus multiplier applied to time reduction per level (Telnet only). | app/js/server.js:22 |
Server Acquisition and Upgrades
Players upgrade servers using the buy command (e.g., buy web). The logic is handled by skidinc.buy.handler, which delegates the purchase action to skidinc.server.buy.
Sources: app/js/buy.js:10-29, app/js/server.js:40-57
Purchase Flow
The process for buying a server upgrade involves checking the player's money, updating the server's level, increasing its price for the next upgrade, and deducting the cost from the player's balance.
This flowchart shows the process when a player executes a buy command for a server.
Sources: app/js/buy.js:10-29, app/js/server.js:40-57
Price Calculation
After each purchase, the price for the next level is calculated by multiplying the current price by the server's price_mult.
// from app/js/server.js:52
new_price = Math.round(server.price * server.price_mult);
Sources: app/js/server.js:52
Impact on Gameplay (Multipliers)
Servers are the primary way players increase their efficiency. Each server type affects different multipliers.
- Web Servers: Increase money and experience multipliers.
- Telnet Servers: Increase the time multiplier, which reduces the time required for scripts to run.
The total multiplier from servers is calculated by the skidinc.server.get_mult(type) function.
Sources: app/js/server.js:59-69
Multiplier Calculation
The bonus from each server is its level multiplied by its specific multiplier effect.
| Server | Multiplier Type | Calculation | Source |
|---|---|---|---|
| Web | Money | web.level * web.money_mult | app/js/server.js:62 |
| Web | Experience | web.level * web.exp_mult | app/js/server.js:64 |
| Telnet | Time | telnet.level * telnet.time_mult | app/js/server.js:66 |
User Interface Integration
The current level and upgrade price for each server are displayed in the "Stats" tab of the game terminal.
Sources: index.html:142-171, app/js/server.js:29-38
UI Display
The following HTML structure from index.html is used to display server information. The id attributes are targeted by the skidinc.server.stats() function to populate the data.
<!-- From index.html -->
<div id="web" class="stat-container">
<div class="names">
<p><span data-toggle="tooltip" title="Web servers increase both your money and exp. multipliers.">Web level <i class="fa fa-info-circle"></i></span></p>
<p>Web price</p>
</div>
<div class="content">
<p id="level"></p>
<p id="price"></p>
</div>
</div>
<div id="telnet" class="stat-container">
<div class="names">
<p><span data-toggle="tooltip" title="Telnet servers increase your time multiplier.">Telnet level <i class="fa fa-info-circle"></i></span></p>
<p>Telnet price</p>
</div>
<div class="content">
<p id="level"></p>
<p id="price"></p>
</div>
</div>
Sources: index.html:142-171
The skidinc.server.stats() function updates these elements with the current server levels and prices.
Sources: app/js/server.js:29-38
State Management and Persistence
The state of the player's servers is persisted as part of the main game save object. Specifically, the server.owned array, which contains the web and telnet server objects, is captured and stored.
Save Data Structure
When the game is saved, the SaveStateManager in the renderer process gathers the current game state. The server property is a critical part of this state.
// from src/renderer/save-manager.js:235-237
server: {
owned: window.skidinc.server?.owned || []
},
Sources: src/renderer/save-manager.js:235-237
In the main process, validateGameState ensures that the server object is present in any save file, preventing data corruption.
Sources: src/main.js:1010-1015
Save Process Flow
The following diagram illustrates how server state is persisted during a save operation in the Electron version of the game.
Conclusion
The Server Mechanic is a fundamental system for player progression in Skid-Inc. By purchasing and upgrading Web and Telnet servers, players increase their core multipliers for money, experience, and time. The system is straightforward, with a clear feedback loop: run scripts to earn money, spend money to upgrade servers, and use the improved multipliers to earn money faster. The state of these servers is reliably persisted through the game's save and auto-save functionality, ensuring player progress is maintained.