Documentation Menu · Real-World AAA Workloads
Advanced & Production Systems
Living Runtime & Neural MoEDurability, Time Travel & ProofsNetworking, Targets & MigrationReal-World AAA Workloads
Real-World AAA Workloads
Inspect complete production-grade .hector specifications: 20,000-drone swarm physics, FiveM multiplayer state, collaborative editing, and bank clearinghouses.
Inspect four complete unedited .hector applications shipped in langage/exemples/—switched cleanly in pure CSS with zero JavaScript:
Physics · Spatial LOD · Clock 10 ms · 42 lines (04-drones.hector)
20,000-Drone Physics Swarm
- Dimensional physics (
m,Wh,m/s²,W) and stochasticnormal(0.5 m/s)wind gusts. O(log N)extremum query:the Pad minimizing dist(Pad.pos, pos) where Pad.free.- Hard latency policy:
Physics every 10 ms+prefer p99 <= 2 ms on Physics+ spatial observer LOD.
langage/exemples/04-drones.hector
-- Simulation de drones qui se rechargent sur des plots libres. Même texte à 50 et à 20 000 drones.
-- Programme complet : zéro question.
Hub pos: Point m
Spectator pos: Point m
Pad pos: Point m, power: W
free = not any(Drone where Drone.dock = self)
law count(Drone where Drone.dock = self) <= 1
Drone pos: Point m, vel: Vector m/s, charge: Wh
status: Flying | Docked | Crashed
target = the Pad minimizing dist(Pad.pos, pos) where Pad.free
goal = target.pos if any(target) else home.pos
near = Drone where Drone != self and dist(Drone.pos, pos) <= 10 m
-> Flying on Launch(home: Hub)
start pos = home.pos
start vel = 0
start charge = capacity
Flying -> Docked when dist(target.pos, pos) <= 1 m and charge > 0
Docked -> Flying when charge >= capacity
Flying -> Crashed when charge <= 0
tie Flying -> Docked minimizing dist(target.pos, pos)
Docked
start dock = target
start vel = 0
next charge = min(charge + dock.power * dt, capacity)
Flying
next gust ~ normal(0.5 m/s)
next vel = clamp(vel + 2 m/s2 * dt * dir(pos, goal) - 0.5 1/s2 * dt * sum(near.pos - pos) + gust, 15 m/s)
next pos = pos + vel * dt
next charge = charge - 40 W * dt
capacity = 100 Wh
law count(Drone where not Crashed) <= 20000
tie Launch minimizing home.pos.x
Physics every 10 ms
Launch(home: Hub) every 5 s
prefer p99 <= 2 ms on Physics
show Drone.pos +-1 cm to Screen within 20 ms
show Drone.pos +-5 cm to Spectator within 50 ms where dist(Drone.pos, Spectator.pos) < 300 m
show count(Drone where Crashed) to Operator
5 Sorts · Authority · Timed Contracts · 121 lines (14-fivem-monde.hector)
FiveM-Scale Multiplayer World
- 5 interlocking sorts (
District,Player,Vehicle,Faction,Contract) with inverse citizen aggregates. - Fine-grained authority (
Moderator,Dispatcher,owner,driver,self). - Automatic timeouts (
Jailed -> Active after 30 s,Open -> Expired after 120 s) with zero polling.
langage/exemples/14-fivem-monde.hector
-- FiveM-scale multiplayer world: districts, players, vehicles, factions, and timed contracts.
-- Clean AAA workload with zero diagnostics and native == naive parity.
Moderator
Dispatcher
District name: Text, capacity: Count, tax: Ratio
law unique(name)
law capacity > 0
law tax >= 0 % and tax <= 25 %
population = count(citizens where status is Active)
law population <= capacity
show name, population to Dispatcher
Player handle: Text, district: District (citizens), cash: Money, bank: Money
status: Active | Injured | Jailed | Offline
health: Count
wanted: Count
start health = 100
start wanted = 0
law unique(handle)
law health >= 0 and health <= 100
law wanted >= 0 and wanted <= 5
law cash >= 0 EUR and bank >= 0 EUR
-> Active on Join(handle, district, cash, bank)
next health = max(0, health - damage) on TakeHit(damage: Count) by Moderator when self is Active and damage > 0
Active -> Injured when health <= 0
Injured -> Active on Revive by Moderator
next health = 100 on Revive by Moderator when self is Injured
Active -> Jailed on Arrest(stars: Count) by Moderator when stars >= 1 and stars <= 5
next wanted = stars on Arrest(stars: Count) by Moderator when self is Active
Jailed -> Active after 30 s
next wanted = 0 on ReleaseJail by Moderator when self is Jailed
Jailed -> Active on ReleaseJail by Moderator
Active -> Offline on Disconnect by self
Offline -> Active on Reconnect by self
next district = target on MoveDistrict(target: District) by self when self is Active
next cash = cash - amount on Deposit(amount: Money) by self when self is Active and amount > 0 EUR
next bank = bank + amount on Deposit(amount: Money) by self when self is Active and amount > 0 EUR
show handle, status, health, wanted, cash, bank, district to self
Vehicle plate: Text, owner: Player, district: District, fuel: Count
status: Parked | Driven | Impounded
driver: Player?
law unique(plate)
law fuel >= 0 and fuel <= 100
start driver = none
-> Parked on SpawnVehicle(plate, owner, district, fuel) by owner when owner is Active
Parked -> Driven on EnterVehicle(who: Player) by who when who is Active and fuel > 0
next driver = who on EnterVehicle(who: Player) by who when self is Parked and who is Active and fuel > 0
next fuel = max(0, fuel - burn) on Drive(burn: Count) by driver when self is Driven and burn > 0
Driven -> Parked on ExitVehicle by driver
next driver = none on ExitVehicle by driver when self is Driven
Parked | Driven -> Impounded on Impound by Moderator
next driver = none on Impound by Moderator when self is Parked | Driven
Impounded -> Parked on ReleaseImpound by Moderator
show plate, status, fuel, driver to owner
Faction title: Text, leader: Player, treasury: Money
law unique(title)
law treasury >= 0 EUR
-> on Charter(title, leader, treasury) when leader is Active
next treasury = treasury + amount on FundFaction(amount: Money) by leader when amount > 0 EUR
show title, treasury to leader
Contract faction: Faction, assignee: Player, reward: Money
status: Open | Claimed | Completed | Expired
law reward > 0 EUR
-> Open on PostContract(faction, assignee, reward) by faction.leader when faction.leader is Active
Open -> Claimed on ClaimContract by assignee when assignee is Active
Claimed -> Completed on FinishContract by assignee when assignee is Active
Open -> Expired after 120 s
show status, reward to assignee
example player lifecycle and district capacity
downtown = District(name: "Downtown", capacity: 2, tax: 5 %)
harbor = District(name: "Harbor", capacity: 2, tax: 10 %)
alice = Join(handle: "Alice", district: downtown, cash: 500 EUR, bank: 1000 EUR)
bob = Join(handle: "Bob", district: downtown, cash: 200 EUR, bank: 400 EUR)
refused Join(handle: "Cara", district: downtown, cash: 100 EUR, bank: 100 EUR)
Deposit(alice, amount: 150 EUR) by alice
see alice.cash = 350 EUR and alice.bank = 1150 EUR
MoveDistrict(bob, target: harbor) by bob
see downtown.population = 1 and harbor.population = 1
TakeHit(alice, damage: 100) by Moderator
see alice is Injured and alice.health = 0
Revive(alice) by Moderator
see alice is Active and alice.health = 100
example vehicle drive and impound
d = District(name: "Vinewood", capacity: 10, tax: 8 %)
p = Join(handle: "Driver1", district: d, cash: 100 EUR, bank: 500 EUR)
car = SpawnVehicle(plate: "LS-001", owner: p, district: d, fuel: 40) by p
EnterVehicle(car, who: p) by p
Drive(car, burn: 15) by p
see car is Driven and car.fuel = 25
ExitVehicle(car) by p
see car is Parked
Impound(car) by Moderator
see car is Impounded
ReleaseImpound(car) by Moderator
see car is Parked
example timed contract and jail expiry
d = District(name: "Sandy", capacity: 10, tax: 4 %)
lead = Join(handle: "Boss", district: d, cash: 1000 EUR, bank: 2000 EUR)
runner = Join(handle: "Runner", district: d, cash: 50 EUR, bank: 100 EUR)
crew = Charter(title: "Syndicate", leader: lead, treasury: 5000 EUR)
FundFaction(crew, amount: 500 EUR) by lead
see crew.treasury = 5500 EUR
c1 = PostContract(faction: crew, assignee: runner, reward: 250 EUR) by lead
ClaimContract(c1) by runner
FinishContract(c1) by runner
see c1 is Completed
c2 = PostContract(faction: crew, assignee: runner, reward: 100 EUR) by lead
after 120 s
see c2 is Expired
Arrest(runner, stars: 3) by Moderator
see runner is Jailed and runner.wanted = 3
after 30 s
see runner is Active
Open Hole (?idle) · Escape Questions · 28 lines (10-editeur-collaboratif.hector)
Offline Collaborative Editor
- Ordered text blocks via
concat(block.text where Live by block.place)andbetween(after, following(after)). - Dynamic role sets (
writers,readers) and real-time cursor presence deadlines. - Intentional open hole
?idleillustrating interactive single-question rescue.
langage/exemples/10-editeur-collaboratif.hector
-- CAS DE SECOURS. Éditeur collaboratif : plusieurs auteurs écrivent le même document en même temps, hors ligne compris.
-- L'agent a omis les décisions de fusion hors ligne : Hector les pose en questions, une seule fois, puis plus jamais.
Person name: Text
Document title: Text, owner: Person
writers = member.person where member.role is Writer or member.role is Owner
readers = member.person
text = concat(block.text where Live by block.place)
show title, text to readers within 100 ms
show presence.member.person.name, presence.cursor to readers within 200 ms where age(presence.seen) < ?idle
Member document: Document, person: Person
role: Reader | Writer | Owner
-> on Invite by document.owner
next role = new on Promote(new: Reader | Writer) by document.owner
Block document: Document, after: Place?, text: Text
status: Live | Deleted
-> Live on Insert by document.writers
start place = between(after, following(after))
on Edit(text) by document.writers
Live -> Deleted on Delete by document.writers
Presence member: Member, cursor: Place, seen: Instant
-> on Open by member.person
on Move(cursor) by member.person
next seen = now on Move
Farkas Proof · Kleene Unknown · 26 lines (01-virement.hector)
Bank Clearinghouse & Daily Cap
- Compile-time Farkas conservation proof (
0 runtime checks). - Kleene 3-valued
Unknownclearing blocking cancel until resolved. assume delay(clearing) <= 30 senforced natively in compiled 8,868 B Wasm.
langage/exemples/01-virement.hector
-- Virement : fonds gardés pendant une compensation incertaine, plafond par jour. Programme complet : zéro question.
Person
Account owner: Person, opening: Money
held = sum(outgoing.amount where Held)
balance = opening + sum(incoming.amount where Done) - sum(outgoing.amount where Done)
available = balance - held
law available >= 0
law sum(outgoing.amount where not Cancelled per day) <= 500 EUR
show available to owner within 1 s
Transfer from: Account (outgoing), to: Account (incoming), amount: Money
status: Held | Done | Returned | Cancelled
clearing: Settled | Rejected by Network
-> Held on Send by from.owner
Held -> Cancelled on Cancel by from.owner
Held -> Done when clearing is Settled
Held -> Returned when clearing is Rejected
Held -> Returned after 5 day
stays Held while clearing is Unknown
law amount > 0
assume delay(clearing) <= 30 s
show status, clearing to from.owner
law sum(Account.balance) = sum(Account.opening)