Essay
How the NPC empires in Old Light work

In this post
Much of the Old Light galaxy is held by empires no human is running. Every new player starts next to two of them, and for some of the largest players they have become a steady source of trouble. This post covers how they decide what to do, and why I built them that way.
Same rules as a player#
The server treats an NPC empire the same way it treats yours. Its builds use the same queue and the same costs, and its battles run through the same combat resolver. When the server checks whether an action is allowed, it never asks whether a human sent it. The only difference is who picks the action: a person in a browser tab, or code on the server.
Each NPC is either offensive or defensive, decided by a hash of the galaxy's seed, as the backend post explains. An offensive NPC goes looking for targets on its own once an hour. A defensive one waits until something happens near it. The split also steers which government it picks when it reaches its second system: offensive NPCs mostly run an Admiralty, defensive ones mostly a Protectorate. They never change it afterwards.
Neighbours from the first minute#
The two NPCs a new player starts beside are placed a short flight away. Without them, the nearest empire could be a day's travel off, and a new player would have nobody to practise on except humans who have been playing for months. With them, there is a neighbour to probe and raid, and once you have a Shipyard, their stars are usually the first ones you take.
Once an NPC holds a few systems, it probes the human stars around it and uses what it learns to decide whether to attack. It only sends a fleet when it expects to win by a clear margin, so an NPC raid that reaches you usually has the numbers.
Pacing against the humans nearby#
A shared galaxy cannot have one difficulty setting. A player on their second day and a player on their fourth month are on the same map.
So each NPC measures itself against the strongest human within range. It grows its economy until it is roughly level with that player, some NPCs settling a little below and some a little above. It takes new systems until it holds about as many as that player does. When the player grows, the NPC grows too, and with no human anywhere near, it stops growing.
The result is that difficulty follows the players. A beginner's corner stays calm because nothing there has a reason to race, while a strong player's neighbours get stronger along with them. I wrote more about that in a post on emergent gameplay.
NPCs also have no global clock. One acts when a human does something within its range, when it is attacked, or, if it is offensive, in its own hourly slot. A region nobody plays in stays mostly quiet.
When a player stops playing#
An NPC can raid a small empire whose player is active, but it cannot capture its stars.
After 14 days without playing, that protection ends and nearby NPCs start capturing the empire's stars. They take them slowly, under a cap on how many the empire can lose per day, so a player who comes back finds a smaller empire rather than an empty one.
If the player stays away long enough, the empire is handed over to an NPC. It keeps its systems, structures and queued builds under a new name, and a large one is split into one NPC per sector it spans. The November report counted 34 empires that changed hands that way. The grey neighbour you have been probing for a month may well have started out as a player.
Pushing back on wide empires#
For a while the largest empires had almost no NPC pressure. Pacing told an NPC to match the big player next to it, but its income came from two or three stars, and it only attacks what it expects to win. Against hundreds of well-defended systems, no target passed that test, so the NPC did nothing.
NPCs now handle an empire that has grown wide differently. They can capture its stars while its player is active. NPCs next to it put more of their ships into attacking. And they skip the nearest border star, which on a big empire is usually well defended, in favour of its most thinly held stars.
There are limits. A wide empire can only lose a small share of its stars to NPCs per day, and an NPC that has just taken a star from a player waits a few days before trying for another one from that player. Over the month that report covers, NPCs captured 223 stars from human empires, while players took 751 from each other. A big empire needs to watch its outlying stars, but NPCs alone will not take it apart.
The rule starts once an empire is well past its first handful of systems. Below that, an active player's stars are safe from NPC capture.
Alliances and trade#
NPCs form alliances of their own, which players cannot join. An NPC rarely attacks a member of its own alliance, and does so only when that member is the only target it has. NPCs with a Trade Hub use the offer board as well, listing the resource they have too much of and asking for the one they lack, which keeps offers on the board in quiet parts of the galaxy.
An NPC that loses a star puts winning it back ahead of everything else for a while afterwards, so taking a star from an NPC tends to bring a counterattack.
Small NPCs far from any human are removed from time to time, which keeps the map from filling up with empires nobody will meet. Grown NPCs are kept.
Questions#
Do NPCs cheat?#
No. They pay the same costs as a player and their fleets travel at the same speeds. They never see your buildings or your fleet. What they know about your stars comes from their own probe reports and your public score, which is the same information you have about them. Their one advantage is on loyalty: an NPC vanguard always drains at least as much as an Admiralty player's vanguard does against another player.
Will an NPC take my stars?#
It can raid you at any time. It can only capture your systems after 14 days of inactivity, or once your empire has grown wide.
Why is the NPC next to me so strong?#
An NPC measures itself against the strongest human within range. If that is you and you are growing fast, your neighbour grows fast as well.
