---
# System prepended metadata

title: Nanites

---

# Nanites

## Intro
- Current nanites are boring as fuck and are another symptom of "science isn't actually science"
- Change nanites into research system
- **Heavily WIP** - please give ideas on how to actually determine what happens in this kind of system!
    - Either how glyph research would work, or an entirely different idea.
- We are not entirely settled on some glyphs-chain-crafting thing
    - Overall, the only criteria for research system is that the research should center around figuring out how to **achieve** effects using building blocks, as well as maybe achieving certain passives (either things like storing more nanites, automatically infecting things although that's more of an active, or things like "increase integration with organic/synthetic host" to unlock nanite sensors/etc)

## General
- Nanite programs completely removed in their current states
- Nanite research: Unlocking nanotechnology in techwebs unlocks all of the machinery and most of the glyphs
- Max complexity of programs go up and more glyphs/behavioral nodes are unlocked as you go
    - Different complexity for different glyphs?

## UI
- Steal wiremod UI - this is similar in what this is, it's just instead of integrated circuits we're attaching nanite effects to nanites and behavior nodes as input/output/processes.

## Nanite Control
- Each nanite component is now just a circuit-like state machine consisting of interconnected gylph-chains and behavioral nodes.
- The "data" to create a nanite component can be cloned across components to replicate.

## Glyphs 
- Represents abstract behaviors the swarm should execute
- Represented in UI as greek letters
- Obfuscated at first?

### Proposal: Noita-like
- Each glyph has randomized effects
    - Two types of glyphs: Passive, active, and triggered
    - Most active effects that can be made triggered as well should have a triggered variant
    - Better yet, have active/triggered combined and have triggered effects apply at the end of the chain whatever things have been accumulated by the full execution
    - Passive effects are combined in a single chain. This is toggled on/off by behavioral nodes
- Chains have inputs for
    - Activation strength
    - Passive/active effect toggle
    - Trigger
- Chains have output for
    - Post-trigger
- Decide between performance and simulation
    - Option 1: All active/triggered effects combine everything per tick and execute as one, saving a lot of performance as we only need to cache chains once
    - Option 2: Simulate every glyph in a chain continuously, allowing for **noita-like modifiers and retriggers/logic within a chain**
        - Could even use behavioral nodes
        - Ensure infinite loops can be arrested if this is the case
    - Option 3: Custom "compilation" that executes until it hits something requiring another evaluation, and then branch from there
        - abstract script trees? alternatively on every input signal change immediately "recompile" the chain's metadata (as chains are globally cached if possible) making execution more or less free

## Glyph Chains
- Chaining together glyphs creates chains that cause effects
- Randomized per round
    - For the RP server port, this would be persistent across x rounds per chain, same for glyphs
- Some sort of system to make researching this easy since this is main
    - Toggled by #define - unified backend for both servers, toggle OFF for rp server's edition
- Both known glyphs and standardized effect chains automatically stored in research database for future use.
- ??? Unsure how to actually design this
    - Optimally a design like this would be very easy to make work, and very hard to make right
    - Chains that are not properly designed have bad side effects, ranging from "almost perfect" doing some light nuisences to malprogrammed healing chains literally starting to kill people if they roll the dice wrong

## Behavioral nodes
- Glyph chains have activations, inputs, and outputs
- Behavioral nodes range from "Always On", "Take input and subtract", "Compare inputs", etc
- Datatypes: Numerical, string, boolean (wrapped numerical), pulse
- Glyph chains can output numerical, string, or boolean data.
- Glyph chains can accept numerical, string, or boolean data
- Activations are just a boolean - non empty strings, non zero numbers, and "TRUE" boolean data makes a glyph chain active
- Triggers just require a pulse signal

### Sensors
- Nanite sensors might need a different paradigm regardless of what we do for effects, because having to pair together stuff just to get sensory input is pretty brutal
    - Perhaps have "passive" effects include things that allow different levels of interfacing with a host of a certain biotype, and have sensors check for a certain level of integration?
    - Lesser effects like "voice in head" without balance implications can also be easier to do and just require integation with host with whatever the primary research method is.

## Balancing
- There's no such thing as "unlocking a program", just "unlocking the right components to make a program and finding out how to make it"
- More nanite research give machinery the ability to create more complex nanites
    - Higher maximum behavioral paths, higher maximum glyph chains
    - Glyph chain stability? Require long paths to create perfect/stable chains with no negative side effects
- Nanites requiring dissolved materials to function? Power? Nutrition?
    - Probably not yet, hm
- Healing nanites causing metabolic stress unless perfectly crafted?

### Creation, Destruction, Timing
- Main server timing: 15-30 minutes for most effects, solo, once researched
- 45-60 minutes for extremely advanced effects
- Damage/healing balance
    - Damage shouldn't be any higher than they are now in burst/disabling ability
    - Healing shouldn't be any higher than they are now when minmaxed

## Effects
- All current effects would exist
- Protocol/passives part of "self sustaining" glyph chains that toggle flags/modifier numbers?
    - Factory protocol: "replicate-structure-replicate-harden-repeat"
    - EMP resistance: "backup-harden-structure-repeat"
    - (These aren't actually what glyphs would look like when 'translated' just a mock idea right now, still no clue how to do them)

### Replication
- Nanites can be put on **anything**
- Nanites can be programmed to consume + dissolve material
    - Replicate using that material
- Allows for dangerous nanites to be created that actually grey goo the station
    - Nanites in non mobs reaching criical mass ticks faster + decays faster for performance
- Limit to structures machinery items (and ofcourse mobs)
    - Balance in a way that spamming too much of this won't do a lot, so we don't suffer an OOM

## Viruses
- Some effects will affect viruses
- Sometimes affected by viruses
- **Sentient Nanites** antagonist, modifies glyphs on the fly and slowly auto-unlocks glyphs and glyph-chain pattern presets as it infects more hosts
    - Can spread to objects but will not get benefits other than using it to spread
    - Can manually trigger and modify glyph chain values
    - Infinite complexity

## Synthetics
- Synthetics would be affected by nanites, but will require different crafted effects to be affected

### Proteans (RP Server atm)
- Inherent control over own nanites
- Download glyphs from research servers
- Infer glyph research data to build chains for themselves + store back to server
    - Different from both organic and synthetic effects for things like healing/damage
        - "metal eating" nanites making *them* the metal eaters, silly things like that

## Technical Details
- All generated glyph chains should be deterministic, and cached - access cached effect datum to affect a mob
- Would be even harder to do than virology but much like virology see if it's feasible to cache specific nanite metadatas
    - Component itself would just contain state like amount of nanites left, activations, etc
    - Everything else is globally cached to avoid having to recreate nanite eeffect datums or even re-reference
    - Probably not wort it much like with viro, just have grey-goo scenarios rare and have item nanites tick fast and decay fast so you never have too many components around
