Skip to content

Economy

The economy is the set of numbers a player spends, earns and waits on. SeinARTS supplies the bookkeeping and leaves the rules to you: which resources exist, what earns them, what things cost and what a building produces. It names no resource and prescribes no income model.

Five pieces make it up, and each has one home.

Piece Authored in Holds
Resources Resource Catalog in Project Settings Which resources exist, their starting values, caps and rules
Cost The ability’s Resource Cost What an order costs
Time Sein Producible on the produced entity How long it takes to build
Queue Sein Production on the producer Where orders wait, how many, where results appear
Jobs Sein Construction on a building A site that becomes a building as work is added

Every piece is simulation data. Balances, queues and construction progress are saved with the match and agree on every machine, so they use Fixed Point and change only through the nodes below.

Open Project Settings > Plugins > SeinARTS, find the Economy category, and add an entry to Resource Catalog for each resource.

Field Meaning
Resource Tag Its identity, under SeinARTS.Resource
Display Name, Icon For the HUD
Default Starting Value What a player starts with
Default Cap The maximum. 0 means no cap.
Overflow Behavior Clamp At Cap discards income above the cap. Allow Unbounded lets the balance exceed it.
Spend Behavior Reject On Insufficient refuses a cost the player cannot meet. Allow Debt lets the balance go negative, for upkeep economies.
Cost Direction Deduct From Balance subtracts a cost. Add Toward Cap adds it instead, and a cost is affordable only while balance plus cost stays within the cap. Supply and population use this.
Production Deduction Timing When a production cost for this resource is charged: At Enqueue or At Completion.

A player starts with every catalog resource at its default. Two layers can change the start:

  1. A faction’s Resource Kit overrides the starting value or cap of the resources it lists.
  2. Sein Match Bootstrap Rules, added to the match’s rules, override one resource’s start for every player. Match Flow covers where match rules go.

The later layer wins.

A player’s balances are in the player’s entity. Read them with Get Resource, Get All Resources and Get Resource Cap. Change them with:

Node Does
Can Afford Tests a cost without changing anything
Deduct Pays a cost if affordable, otherwise changes nothing
Refund Returns a cost with no check, honoring the cap
Grant Income Adds resources, honoring the cap
Transfer Moves resources between players. It checks only that the sender can afford it; your graph decides who may.

A cost or an income is a Sein Resource Cost, a map from resource tag to amount. Build one with Make Sein Resource Cost from a Make Map.

Income is an ability. A passive on the Player State that calls Grant Income every few seconds is the simplest economy. A miner’s ability that grants income on a timer is another; the demo’s SA_Mine grants 5 Minerals every 1.5 seconds (Add Mineral Income).

Cost belongs to the ability that spends it. An ability’s Resource Cost is charged when the ability activates, if the player can afford it. A cancelled ability gives the cost back while Refund Cost On Cancel is on.

Cost Timing on the ability sets how the cost is charged:

  • Immediate charges the whole cost on activation. This is right for almost everything.
  • Production Queue is for abilities that call Enqueue Production. It splits the cost by each resource’s Production Deduction Timing. The At Enqueue share is charged on activation. The At Completion share rides with the queue entry and is charged when the item finishes building.

At Completion is for cap-bound resources such as supply. A player can queue past the cap, and the finished item waits for room.

Asset prices live in one place: the ability. A Barracks costs 150 Minerals because SA_Place_Barracks says so, not because the Barracks does. Balance Tables edits many ability costs in a grid.

Any entity with Sein Production can build things. Typical settings:

Setting Meaning
Max Queue Size How many entries it holds, including the one in progress
Spawn Point Offset Where finished units appear, relative to the producer and rotating with it
Has Rally Point, Rally To Entity, Rally Transform, Rally Entity Where new units walk to

Leave Spawn Point Offset empty and units appear at the building’s pivot, usually inside its mesh. Set it outside the footprint, such as (450, 0, 0) in front of the building.

The thing built carries Sein Producible:

Setting Meaning
Build Time Seconds to build
Queue Policy, Queue Amount How many of this thing a producer or a player may queue, or build in all. The options are Multi-Queueable, Queue Once per Production Unit, Queue Once per Player, and the fixed-amount versions of both. Cancelling frees the allowance; finishing uses it for good.
Prerequisite Tags Player tags that must be present, such as a tech
Refund Policy Use Custom Refund with a Custom Refund Percentage, instead of the default. The percentage is a fraction: 1 is a full refund, 0.5 is half.
Is Research, Granted Tech Effect See Research below

A production ability is a child of one parent, SA_Produce. It has Target Type None, Cost Timing Production Queue, a class variable for what to build, and two parts:

  • Can Activate returns Can Enqueue Production. It is false while the queue is full, a queue limit is reached, a prerequisite tag is missing or a research is refused, so the button greys out. Affordability is checked separately by the ability’s own gates.
  • On Activate calls Enqueue Production with the class, then End Ability.

Without the Can Activate check, an order the queue would refuse is still paid for and then refunded, and the player gets no signal. Add Production and Research builds the full setup.

How the queue runs:

  • Only the front entry builds. The rest wait. Progress advances by the tick’s Delta Time.
  • The entry takes the Build Time at the moment it is queued, with the owner’s Class effects applied. A research that speeds training changes the next Soldier you queue, not the ones already waiting.
  • When progress reaches Build Time, the At Completion cost is charged and the unit spawns at the Spawn Point Offset, owned by the producer’s owner. If the At Completion cost cannot be paid, the entry stalls at 100% and tries again every tick.
  • A new unit walks to the rally point with its Move Ability.
  • If the producer changes owner, the queue is cancelled and refunded.

Cancel Production takes a zero-based index. Index 0 is the entry in progress; higher indices are waiting. By default a cancelled entry refunds its At Enqueue cost times the share not yet built: a waiting entry returns everything, a half-built one returns half, and a stalled one, at 100% progress, returns nothing. Set a custom refund percentage of 1 on the producible when stalled entries should refund in full. It then applies to every cancel of that item.

Set Rally Point, Set Rally Entity and Clear Rally Point change the rally from an ability.

Research uses the same queue and the same abilities as units. A research item is an entity Blueprint that is never spawned. Its Sein Producible has Is Research on and a Granted Tech Effect. When it finishes, the effect is applied to the producer, and nothing spawns.

The effect decides everything that follows. Use Class or Player scope: the effect belongs to the producing building’s owner, so an Instance effect would modify the building. Effects and Attributes covers scopes, and Gameplay Tags covers the tags a tech grants.

Four settings gate research:

  • Queue Policy Queue Once per Player lets a player have one in the queue or done, across all buildings.
  • Prerequisite Tags on the research item need other techs first.
  • Forbidden Prerequisite Tags on the effect refuse research once the player holds any of them. Listing the effect’s own tag stops a repeat.
  • The effect’s Can Research event allows custom rules, such as a faction or a map condition. It only reads.

All four feed Can Enqueue Production, so the research button disables itself. For other UI, Get Tech Availability reports whether the tech is already researched, its prerequisites are met, a forbidden tag is present and the custom check passed. Is Tech Researched is the short form.

A building can start as a site and become usable once work is added. Sein Construction supplies the lifecycle; your ability supplies the rule for how work accrues.

Setting Meaning
Required Work The work that completes a job
Start Queued for Construction A placed or spawned building starts as a site. Off, it starts complete.
Completion Effect An effect applied once, when the job completes

A job moves through four states: Queued, Building, Paused and Complete. While a job is unfinished, the entity carries SeinARTS.State.UnderConstruction, which abilities use in Blocked Tags so a site cannot produce.

The nodes, in the order a build uses them:

Node Does
Spawn Construction Site Spawns a building as a site. Returns the entity and a Sein Construction Handle. Initial State is Queued or Building.
Queue Construction Turns an existing entity into a site
Start Construction Queued or Paused to Building
Add Construction Work Adds work. Reports Work Complete when the requirement is met.
Complete Construction Finishes the job: releases the tag and applies the Completion Effect
Pause Construction, Set Construction Stage Pause and keep progress; set a milestone tag for visuals

Add Construction Work does not complete the job. Your build ability decides what “done” means, such as a timer, health or materials, and then calls Complete Construction. Each call returns a result, such as Succeeded, Work Complete, Already Complete or Stale Job. The handle names one job, so a builder that arrives after the job finished is turned away without side effects.

The reads are Is Under Construction, Get Construction Status, Get Construction Work Status and Get Construction Work Percent. Build Production Buildings builds the full flow.

Paying for the site is the placing ability’s Resource Cost. The construction nodes charge nothing.

A Factory trains Tanks. A Tank costs 150 Minerals and 2 Supply and builds in 20 seconds. The player’s Supply cap is 10.

Catalog. Add two entries:

Field Minerals Supply
Resource Tag SeinARTS.Resource.Minerals SeinARTS.Resource.Supply
Default Starting Value 500 0
Default Cap 0 10
Cost Direction Deduct From Balance Add Toward Cap
Production Deduction Timing At Enqueue At Completion

The Tank. SU_Tank has Sein Producible with Build Time 20. SU_Factory has Sein Production with Max Queue Size 5 and Spawn Point Offset (600, 0, 0).

The order. SA_Produce_Tank, a child of SA_Produce, has Resource Cost 150 Minerals and 2 Supply, Cost Timing Production Queue, and the Producible Class SU_Tank.

Queue three Tanks after other units have taken 6 of the 10 Supply:

  1. Click once. Minerals go from 500 to 350 at once. Supply stays at 6.
  2. At 20 seconds the first Tank finishes. Supply is charged then: 6 plus 2 is 8, within the cap. The Tank spawns.
  3. The second finishes at 40 seconds. Supply goes to 10, the cap. The Tank spawns.
  4. The third has all its Minerals paid, but at 60 seconds Supply would be 12. It stalls at 100%. When the cap rises, or Supply is freed, it spawns on the next tick.

To free Supply when a Tank dies, your death rule calls Refund with 2 Supply to the owner. For Add Toward Cap resources, Refund lowers the balance.

To raise the cap, apply a Persistent, Player-scope effect with a modifier on Sein Resources Data, Field ResourceCaps[SeinARTS.Resource.Supply], Operation Add, Value 8. Give the effect Stack as its Stacking Rule and a Max Stacks equal to the most depots you allow, so each new depot adds again.

  • Putting the price on the producible. Producible holds time, policy and research. The price is the ability’s Resource Cost.
  • Cost Timing left on Immediate for supply. Supply is charged at queue time, so a player cannot queue ahead of the cap. Choose Production Queue.
  • No Can Activate on the production ability. The player pays and is refunded in silence. Return Can Enqueue Production.
  • No Spawn Point Offset. Units appear inside the building.
  • Expecting a research speed-up to affect queued items. Build time is fixed when the entry is queued.
  • Research with Instance scope. The effect modifies the building, not the player.
  • Cancelling a stalled entry. It returns nothing under the default refund policy.
  • Letting Transfer through unchecked. Transfer checks only affordability. Check allies, locks and amounts in your own graph first.