#(WIP) Neuro RimWorld integration

1 messages · Page 1 of 1 (latest)

regal ferry
#

I want to make Neuro the RimWorld narrator/storyteller. This is basically DM. There are a lot of parameters the storyteller controls, I think I want to use Randy as the base but make Neuro responsible for the events at the player's base.

Currently done: Neuro can spawn events

https://github.com/chayleaf/Neurator

GitHub

Contribute to chayleaf/Neurator development by creating an account on GitHub.

#

In the base game, Randy gives out events like this:

  • There are event categories, each has a certain weight (chance of occuring):
        <categoryWeights>
          <Misc>3.5</Misc>
          <ThreatBig>1.4</ThreatBig>
          <OrbitalVisitor>1.1</OrbitalVisitor>
          <FactionArrival>2.4</FactionArrival>
          <ThreatSmall>0.6</ThreatSmall>
          <ShipChunkDrop>0.22</ShipChunkDrop>
        </categoryWeights>
  • In each category, each separate event also has a certain chance. For example, in the Misc category, "thrumbos passing" has a weight of 0.7, while "transport pod crash" has a chance of 1.5.
#

The easiest thing to do is to give Neuro points over time that she can spend on weights. However, I think this can give her power to generate one-sided events. While this can be interesting, for more balance I think she should be given some restrictions - if she wants to destroy Vedal's base, she should wait for an opportune moment and not just flood him with mechanoid raids.

slate smelt
#

Gain points from good events and spend them on negative events

regal ferry
#

That's what I thought was an option, yeah. Another idea is to exponentially increase repeating events' cost and making it slowly go back to normal.

woven cave
slate smelt
#

Give her a 30 second cd minimum between events

woven cave
#

cause I dont really want the good vs bad points cause I want it to be about Vedal CONVINCING Neuro to give him good events
not Neuro being FORCED to help him

regal ferry
#

agreed

pine crescent
slate smelt
#

I see

pine crescent
slate smelt
#

What if the more good events she does the stronger a bad event would be, and vice versa

regal ferry
#

that's the thing, we are here to make neuro not have the option of ending the stream in 5 seconds

regal ferry
woven cave
#

like maybe we DO add the points system, but it should be secondary to some other method to prevent negative event spam

#

but this is more on the conceptional level, idk how to achieve this idea with code

regal ferry
#

i'll list all the events in the "misc" category for an idea of what the options and the stakes are:
good

  • 1.0 resource pod crash
  • 1.0 psychic soothe
  • 1.0 self-tame
  • 1.0 ambrosia sprout
  • 0.4 farm animals wander in
  • 0.4 wanderer joins
  • 1.5 transport pod crash
    neutral
  • 0.7 thrumbos
  • 2.0 ransom demand
  • 0.5 meteorite impact
  • 1.0 herd migration
  • 1.0 wild man wanders in
    bad
  • 1.0 psychic drone
  • 0.12 toxic fallout
  • 0.08 volcanic winter
  • 1.0 heat wave
  • 1.0 cold snap
  • 0.4 flashstorm
  • 1.0 short circuit
  • 0.3 crop blight
  • 0.5 alphabeavers
pine crescent
#

There definitely would have to be rather strict restrictions. Even with a point system it would be extremely easy to minmax.

woven cave
#

remind me what the numbers are, is it a value or weight?

regal ferry
#

basically 0 is the rarest 999 is the most frequent

pine crescent
#

Also getting her to understand the implications of all these different events will be challenging

regal ferry
#

i can give her descriptions

#

a bit of manual labor is alright, rimworld doesnt have that many different events

woven cave
#

also remember this mod is designed for play WITH Vedal
he can and WILL tell her (whine about) what she is doing
she'll get a lot of context from that

woven cave
regal ferry
#

yeah imo:

  • the game sends all the in-game info
  • vedal will talk about what he's doing giving neuro even more info
#

so she will have a pretty good idea of what's going on and whether it's good or bad

slate smelt
#

Oh vedal's building a farm? Blight

#

Thunderbolt

woven cave
#

@regal ferry Was looking at other modded storytellers, maybe we could use some sort of scaling system like this one uses?
idk the feasibility but its an idea

regal ferry
regal ferry
pine crescent
#

Wealth scaling difficulty is vanilla

woven cave
#

I see sorry

pine crescent
#

But i am sure that hitting up some experienced rimworld modders is a good idea. I am sure they have tinkered with these systems a lot.

regal ferry
#

implementation is not the problem

#

game balance is

pine crescent
#

Yeah that is what i was talking about

regal ferry
#

lol i remembered swarm control

#

that went "well"

woven cave
regal ferry
#

no i'm talking about after the ddos

pine crescent
#

There are dozens of mods that introduce new unique storytellers. The modders have put a lot of thought into balancing that stuff.

regal ferry
#

the thing is, these are ultimately algorithms

woven cave
#

yeah what Chay is saying

#

Neuro will permanently be an unknown variable

#

thats hard to balance around

pine crescent
regal ferry
#

i think the combination of making events hard to repeat and adjusting some parameters behind the scenes is generally a good idea

woven cave
#

agreed

#

okay once again, Chay if you end up needing help with the event descriptions for Neuro lemme know I can help with it

regal ferry
#

in vanilla expanded theres a storyteller that only produces bad events

#

probably a good idea to base neuro integration around it :^)

woven cave
regal ferry
#

yep

woven cave
#

hey I have a question
I havent played rim world in a while (like a LONG time)

regal ferry
regal ferry
#

then again

woven cave
#

the little coloured boxes that appear on the right when an event happens, if you click them is there info attached?

cause Im thinking (this is aside from the balancing issues) would it be possible to allow neuro to put in text whenever she makes an event happen?
like a reason or message like she does with timeouts

regal ferry
#

oh that's a cool idea

woven cave
#

I think that would be good content, though might be irrelevant due to Vedal being there

regal ferry
#

well, generally giving her more stuff to write into is always good, like minecraft signs

woven cave
#

agreed

regal ferry
#

might be a good idea to put her in charge of some random name generation too

woven cave
regal ferry
#

when feasible

woven cave
#

ye ye

pine crescent
arctic merlinBOT
#

You have unlocked new role

pine crescent
#

It is possible for sure though

woven cave
regal ferry
#

just consider me able to modify whatever and don't worry about feasibility

pine crescent
regal ferry
#

nothing scares me after making FTL integration

regal ferry
#

originally i also had the idea of telling her what event randy decided to generate and letting her just go with it if she doesn't feel like making an event herself

woven cave
regal ferry
#

but the thing is thats just random. Random doesnt care what event it's generating, but the player does - heat waves are helpful at winter but very bad at summer

#

and neuro knows that (if i give her enough context)

#

the question is what curve to use for event cost

#

let me open up desmos i guess

#

one option - 17/x

#

this heavily punishes immediate repetition but allows it soon enough, fully resetting after 17 events

#

i could even go lower, making events even cheaper than the default value if they haven't been seen in a very long time

#

theres the boring linear option, i think this is taking too much control out of neuro's hands by punishing repetition too much

#

or i can go for something in the middle like this

#

another option is lower initial repetition penalty but slower backoff

#

i don't actually think she will repeat that much, i think it's just good to encourage event variation while leaving neuro enough breathing space to decide which events to use

#

also: i guess since the base game already balances events' difficulty, just letting neuro run wild is not gonna go that badly

#

oh just realized that i will also have to store the point values in the save file

woven cave
regal ferry
#

yeah i now think that rather than encouraging neuro to spawn good events we should just encourage her to use a large variety of events

woven cave
regal ferry
#

more bad events, but bad events also give loot so they arent all bad

#

anyway, returning to the example of there being a total of 17 weights:

i think it's a good idea to start with 1 point requirement per weight, then if neuro decides to use a weight its point requirement gets doubled

#

but also any time that a weight is not chosen it gets divided by a certain factor

#

in this case, it gets divided by 2 to the power of 1/17

#

this means that after 17 turns of not picking an event option its cost returns to normal, and if you dont use it for 34 turns its cost becomes half the original cost

#

and since i'm too lazy to do math about how much points i should give neuro, i will instead give points to her according to how much points it would cost randy to generate whatever he generates

#

but multiply it like 1.5 or 2 so she can have fun with it

woven cave
#

that sounds great

regal ferry
#

hmm

#

it does sound close to what should happen ideally at least

#

so, on average, toxic fallout will occur every 141 misc events

#

so the idea is to roughly match that with how often neuro can trigger it

#

the variables at play here are:

  • how much does it initially cost to trigger a certain randomness outcome, depending on its weight?
  • how much cheaper or more expensive does it get over time?
  • how does the cost change when neuro picks it?
#

i actually have no idea what kind of curve i want

#

if we take the probability graph of something occurring once per N turns it will turn out like this

#

red for toxic fallout, blue for something common like heat wave

#

well, inverse probability graph

#

so i guess i should roughly emulate this shape

#

my goal is something similar but with a softer start i think?

regal ferry
#

as an option, i could make common events' repetition penalty lower than rare events' repetition penalty (even more than usual)

#

overcomplicating it is probably not a good idea

regal ferry
#

with that in mind, my new idea is:

  • each choice stores how many times it has not been selected in a row, and its weight in each selection (it can be different, but not by much usually)
  • then, calculate independently for each choice - given the odds from previous choices and the odds now, and assuming perfect randomness, what is the chance of not being picked N times in a row?
  • finally, the points for that choice are 1/(1 - chance of not being picked N times in a row)
  • when randy makes a choice, the choice is ignored but the points corresponding to that choice are awarded to neuro
  • for example, assuming the above "misc events" with total weight 17, if randy picks something with the base chance of 1/17 right after neuro picked the same thing, then neuro will immediately have enough points to get something with the probability 1/289 of occuring (even more because her point gain will have a multiplier)
  • to incentivize neuro to actually use her points, she won't get new points until she spent her previous points at least once (and will be occasionally reminded if she hasn't done so)
#

the question is whether a flat multiplier is enough to give neuro enough room for creativity, or if a different method of point calculation should be used instead

woven cave
#

that sounds effective

regal ferry
#

if neuro spams "heat wave" it will be funny, but if she spams "toxic fallout" it will be the end of the run

#

but i guess if i wanted to account for "can be safely spammed/can't be safely spammed" i would have to hardcode it for every event

#

which, again, might not be a bad idea

#

also, a lot of events in rimworld have a cooldown

#

for example, toxic fallout has a timeout of 90 days

regal ferry
woven cave
regal ferry
#

okay i will have to do some simulations

regal ferry
#

okay in my simulations this leads to low chance events being triggered more often than with randy even without the bonus

#

i'll try tweaking it a bit

#

(to be clear, this isn't necessarily a bad thing, i'm just noting it down)

#

i think this is because randy ends up giving lots of points by accident sometimes

#

honestly, i'll go with this, i wanted variety and i got variety, even if it's quite a bit more variety than i expected

#
[('volcanic winter', 127), ('toxic fallout', 176), ('crop blight', 482), ('flashstorm', 649), ('farm animals wander in', 729), ('alphabeavers', 731), ('wanderer join', 742), ('meteorite impact', 922), ('mass animal insanity', 952), ('ship part crash (defoliator)', 1119), ('heat wave', 1120), ('thrumbos pass', 1123), ('ship part crash (psychic)', 1159), ('cold snap', 1162), ('infestation', 1337), ('psychic drone', 1393), ('manhunter pack', 1427), ('psychic soothe', 1457), ('short circuit', 1642), ('wild man wanders in', 1745), ('ship chunk drop', 1804), ('resource pod crash', 1820), ('ambrosia sprout', 1822), ('herd migration', 1891), ('self-tame', 1946), ('transport pod crash', 2737), ('ransom demand', 3807), ('single animal insanity', 4469), ('enemy raid', 5427), ('visitor group', 6386), ('traveler group', 6497), ('trader caravan arrival', 6594), ('orbital trader arrival', 8681)]

^ randy simulations (not 100% accurate but relatively close)

[('volcanic winter', 572), ('toxic fallout', 787), ('alphabeavers', 1468), ('heat wave', 1475), ('cold snap', 1484), ('crop blight', 1490), ('infestation', 1769), ('ship part crash (defoliator)', 1835), ('flashstorm', 1879), ('psychic soothe', 1879), ('ship part crash (psychic)', 1881), ('psychic drone', 1892), ('thrumbos pass', 1978), ('short circuit', 2282), ('ship chunk drop', 2391), ('manhunter pack', 2540), ('ransom demand', 2554), ('mass animal insanity', 2574), ('wanderer join', 2602), ('resource pod crash', 2612), ('herd migration', 2673), ('self-tame', 2683), ('farm animals wander in', 2696), ('wild man wanders in', 2700), ('single animal insanity', 2705), ('ambrosia sprout', 2708), ('enemy raid', 2712), ('transport pod crash', 2735), ('meteorite impact', 2791), ('visitor group', 2884), ('orbital trader arrival', 2885), ('trader caravan arrival', 2953), ('traveler group', 3006)]

^ neuro simulations (not accurate at all but gives a rough idea of how much power she will have when compared to randy)

#

these are all the events btw

#

basically - the balance is not at all mathematically verified, but i think it will be good enough

#

i'll prompt her with something like "vedal winning = bad for content, vedal losing and ending stream = bad for content", everything else is up to her

regal ferry
#

^this is a fancy way of saying "the maths didn't quite work out but surely the balance will turn out fine anyway NeuroClueless"

woven cave
#

again if you want help with prompt stuff I can help

giving context for certain things like for the heat wave (good during winter, bad during summer) seems like itll be a lot of manual labour

regal ferry
#

i think she can figure that out by herself as long as you tell her it significantly raises the temperature

woven cave
#

makes sense

regal ferry
#

you can use the wiki for reference

#

here's my original atttempt (in a completely different format) but it only covers the core mod, you can use it for reference or copy most of it

woven cave
regal ferry
#

by default, randy can control threats' strength, from 0.5x the original strength to 1.5x the original strength

#

should neuro be able to do that?

#

also, i think i'll leave randy in charge of incidents outside of the player colony, that should be fine right?

#

and should i support the player having multiple colonies?

woven cave
regal ferry
#

true

woven cave
#

or not idk how the balance is

regal ferry
#

well its simple i can make using 1.5x the strength take 1.5x the points

woven cave
#

ah that makes sense

regal ferry
#

oh god, rimworld uses an old version of .net so i cant build mods for it targeting netstandard

regal ferry
#

oh its fine theres reference assemblies available nowadays

regal ferry
#

its pretty impressive actually, rimworld hasnt updated .net version in over 5 years

regal ferry
#

finally, it loaded without any errors

regal ferry
#

now all i have to do is actually write the code

empty hollow
#

aww man i was making a mod with smth like this before hand but vedal never got back to me

#

want some of my assets?

regal ferry
#

do you want to release a separate content mod that i'll link to or do you want me to put stuff in the main mod?

#

(either is fine with me)

regal ferry
#

(WIP) Neuro RimWorld integration

regal ferry
#

i think i've finished the neuro integration code now i need to playtest it

#

wait this was quick so i have an idea

#

what if we tell vedal not to play the tutorial and make neuro help him learn the game?

#

i can load a bunch of lore dumps that neuro can access

#

and a bunch of guides that neuro can tell vedal if she feels like it

#

it's more fun if we can make her backseat

#

(to be fair i still haven't even started giving her info on what's going on in-game so that will have to wait)

#

something tells me these values arent quite right neurOMEGALUL

#

(i mean, they could be right for all i know, it just seems wrong)

#

ok it seems correct actually

#

aaaaa randy give me points

#

oh here we go

#

it works!

#

neuro can trigger events, and randy gives her points to do it

#

@rancid hedge i've finished this part, and now i'm working on sending neuro all info on what's happening in the game (and letting her look up specific info too)

#

sorry wrong ping neuroCry

#

i meant @woven cave

#

if you want, you can make a guide for neuro to backseat vedal

woven cave
# regal ferry if you want, you can make a guide for neuro to backseat vedal

yeah I think its best to have little "examples" for each event
like: Heat wave - Description of what it does + "helps player during the winter, hinders players during the winter"
or
Psychic soothe - description + "best used when the player is nice to you"

Idk how far to go with it, since I dont wanna direct her use THAT much

regal ferry
regal ferry
#

well, first of all, she will have all the info about what's happening in the game
second, if vedal asks "how do i do X" or "so what do i do next", it would be nice if neuro could give him some tips on what he could do

woven cave
#

AAAh like a little guide for her?

regal ferry
#

i can give neuro something like a game wiki

#

yeah

regal ferry
woven cave
#

okay I can try that, but Im also not the MOST experienced with Rimworld, we should find a expert player for the player advice
but I can do as much I can from the wiki and stuff

#

she can also google herself

regal ferry
#

i have like 200h in the game do i count?

woven cave
#

probably yeah

regal ferry
#

(also keep in mind vedal hasnt played it i assume so even basic advice would be helpful)

woven cave
#

exactly so I dont think itll be THAT big a deal

#

this is probably as detailed as you want yeah? (the gameplay part not the startup)

#

also also
chat will do a lot of heavy lifting in this case
backseating will actually be helpful for once

regal ferry
#

yeah i just thought it'd be nicer if neuro took chat's job here

woven cave
#

yeah yeah we can try
Im saying that chat will have the "meta' and more optimal features down I think

#

for us to inform her of all that would involve a LOT of text

regal ferry
#

i'll try to get as much info as possible from the game itself

#

theres this thing for example

woven cave
#

right right
btw how do you give her this info?
idk how her API works
would we just give her a searchable database? or a really big txt type file?

regal ferry
#

there are many ways, the most obvious one is to give her a list of categories and letting her pick which categories to get the text for

#

the api works like any other LLM API (with many caveats), the game tells her what she can do and she decides what to do

woven cave
regal ferry
#

its not really anything surprising even if you havent

#

in the sense that its cool tech but it just works the same way any other API does

regal ferry
#

i'm doing something very ambitious right now - giving neuro list of all items that exists in the game and letting her query them and sort by various properties

#

most important thing here is actually creating a sane filter system

teal zodiac
#

@Mage Boy

#

@empty hollow

regal ferry
#

(your ping is useless)

teal zodiac
#

What do youmean

empty hollow
teal zodiac
#

Oh lol

regal ferry
empty hollow
#

oh rip

#

basically i had neuro, evil, anny (without ears), vedal hair

#

anny star apparel

#

and 3 statues

regal ferry
#

imo adding colonists inspired by real people wouldnt go well lol

#

or more fitting for a fan playthrough than an official one

empty hollow
#

it's just the hair

woven cave
#

@regal ferry I saw this looking at rimworld mods and stuff
I dont think we should do anything like this for obvious reasons, but the idea of giving her some sway over base mechanics is interesting

regal ferry
woven cave
regal ferry
#

rimworld is a large game so the biggest challenge here is how to make it understandable to neuro imo

scenic forum
#

There is the debug inspector

#

which exposes details about everything, but it might be pretty big and I don't know how you'd expose it

#

maybe a mod or whatever
or frequent saves

regal ferry
#

dont worry i know about it

#

and getting info from the game is not an issue at all

#

as i already said, the only issue is making stuff understandable for neuro and not overwhelming her

scenic forum
#

In terms of not overwhelming her what does she actually need?

#

Pawns of course

#

Plants are only needed for like blight, could possibly filter by trees/farms, but they do make up most of the data along with filth

#

buildings and blueprints, but you could probably trim a lot of that out, maybe only things in the home zone

#

and items maybe? but a summary is probably sufficient

#

rooms?

#

game conditions and events too

regal ferry
#

yeah and the thing is you say "pawns" but theres so much stuff you can say about a pawn

#

my point is its a lot of data and you need to know what to send and what not to and you need to give neuro access to specifically the data she needs

#

which is a lot of annoying plumbing work but that's what i'm working on

scenic forum
#

Oh wow I didn't realise pawns had so much data, but I am using psychology so that is probably making it bigger than it should be

empty hollow
#

i was going to try to feed her context any time a letter box pops up

regal ferry
#

thats easy

#

thats like not even a question

scenic forum
#

Slept on it a bit but if shes just control events as the storyteller, unless youre playing with anomoly, the face up infomration should be enough right? and even that could be trimmed a lot

#

Like needs for example, you woulndt need the exact values of the needs, just overall mood and summary of buffs

#

health wise, bills, pain, consciousness, moving and hediffs

regal ferry
#

i'll start with everything remotely relevant and trim it down later, i'm just a bit busy with work rn