#[Discontinued] AI Enhancement

1 messages · Page 1 of 1 (latest)

compact stirrup
#

Adds AI Generated Messages to grouped sims!

Originally this was just supposed to be a proof of concept, but by now I put too much time into it and people want to try it out.

WARNING:
Very early version, use at your own risk, might even cause your game to crash if the ai spits something out the game doesn't like.
As usual, this is a debug build. Let me know of any errors you might encounter.

Requirements

  • BepInEx Configuration Manager
  • Make sure the folder in the zip is in your BepInEx plugins folder, the files cannot be freely in the plugins folder.
  • If you're planning to use a local LLM see Running Locally below.
  • For users that do not want to run a local llm or can't:
    • Go to https://aistudio.google.com/app/u/1/apikey login and generate an API Key.
    • Plug that API Key into the mod config.
    • If you have no idea what any of the settings do, don't touch them, they are configured like my tests.

Usage
Once you have your local stuff setup or the google API key inserted, just invite sims and start talking to them with /group.
Be aware that this can most likely reach your usage limits with extended use if you're using the google api, i've integrated some fall backs but they do eventually run out as well.
They wont remember any previous sessions.

Running Locally
WINDOWS ONLY
Go to https://github.com/ggml-org/llama.cpp/releases/ and download the latest llama.cpp release that fits your requirements.
Then create a "llama" folder in the AIEnhancement folder that should be in your plugins folder.
Throw the llama stuff into that folder (llama-cli.exe is required!). (Should look something like Image)
Then put your models into the same folder.
Only .gguf models are supported.
You will need to setup all the values in the settings according to the model and to your liking.
(I highly recommend flan-t5-base-q4_k_m.gguf for the decision model)
Be aware that each sim will run their own instance of the model when a message needs to be generated, that means you need to calculate up to 3x the normal model usage.
Message times are dependent on how long the model takes to load into memory plus the time it actually takes to generate the message, this will happen each time the sim generates a message, unlike things like koboldai or text-generation-webui that tend to keep the model loaded in memory.

#1386424336931623104 message for latest version

flint pewter
#

I am also trying to use openrouter

feral atlas
#

@flint pewter
After you open Erenshor for the first run after the plugin has been installed, a config file will be created inside the BepInEx config folder:
C:\Program Files (x86)\Steam\steamapps\common\Erenshor\BepInEx\config

The AIEnhancement plugin creates the following config file:
mizuki.aie.cfg

At the very bottom of that file (open in Notepad) you will see:
*APIKey = *

Simply paste your API key there, i.e.:
APIKey = abc123

compact stirrup
#

or its missing something

#

it could also be an incompatibility with another mod

#

it's happening on reflection so it's checking all the loaded assemblies

#

i tightened that call a bit

compact stirrup
compact stirrup
#

There was an issue when using local where the context for the decision model was too big
also fixed that error from before

flint pewter
#

Which BepinVer do you use for this

#

I was able to add the key now, but still get red errors, I removed all mods and still get an error

flint pewter
#

Ah ok, I had to remove the llama folder. everything seems working

#

lol alrighty then

#

impressive

compact stirrup
sand laurel
#

Wow this is really cool

#

I've been taking a break as I haven't had the MMO itch lately but it'll be fun to tinker with

#

The possibility of being able to flesh out specific sims is really interesting to me

compact stirrup
#

found something new i have to consider

minor mango
#

This feature seems to fit in Erenshor very well and this mod is a great first step to it.
The biggest step, of course, would be to let Scrubby get in his 3rd person character, instead of calling me a noob.

compact stirrup
#

i'll probably need to make special cases for characters like scrubby

steady hill
#

FINALLY!!!

uncut iris
#

love this btw, have you consider a mcp to translate player text to common group commands?

#

behox is bugged out on my end for some reason, couldnt tell them to come to me they always just reply with some variance of them being there already

compact stirrup
uncut iris
#

ah, gotcha, it happened this session so i guess he might be just stuck somewhere. mb

compact stirrup
#

sorry, didn't mean to sound so rude aack

uncut iris
#

all g man didnt take it bad you just stated what the mod do

#

behox is now behaving

unreal wolf
#

Do you plan to keep working on this or is it going to stay a proof of concept.

compact stirrup
turbid vortex
turbid vortex
#

Better question. Has anyone used a local model? Suggestions on a good one? I'm thinking about trying to use my uncensored Gemma model. Since I pay for Gemini Pro, maybe that.

#

Luckily this game isn't heavy on the hardware so I think I could still run an AI model. Given its only doing basic chat.

compact stirrup
#

gemma3 worked fine when i tried it

#

anything bigger than that is a bit much when there's more than 1 instance going

#

but tbf my pc is ass

turbid vortex
#

I mean my GPU is dated... A2000, still 12gb of ram though and I have an I9 with 64bg ddr5 ram. Performance could drop but I can't imagine it'd be crazy.

compact stirrup
#

is what i had when running openchat3.5

#

all my tests were without gpu

turbid vortex
#

Okay 9gb. My gpu should be able to handle that. Ill have the lower the context window size to something reasonable i imagine. Or I can just use Gemini and not worry about it. Idk. Im still laying bed lol.

compact stirrup
#

just be aware that it'll break if the context size is too small and the context doesn't fit, llama doesn't like that at all

turbid vortex
#

Fair. Do you have a recommendation for size?

#

Ill play with it but curious

compact stirrup
#

i've tested with 2k but the context was a lot smaller before i used the google api, i'd start there and increase it if you notice nothing is working, the default is 4k

turbid vortex
#

Gemini has 1 million... at least in the studio. Idk if the normal one does.

#

Ill try both if I have time today

turbid vortex
compact stirrup
#

by break i mean it errors and nothing happens

turbid vortex
#

But the game will be playable. Ill just have to clear the context window?

compact stirrup
#

you'll have to increase context size

#

most of the context comes from chat and you can't clear that

#

well not really, it's gonna be the chat if you've been typing with them for a long time

turbid vortex
#

Well if I restart the game does the chat get wiped? I haven't noticed yet.

compact stirrup
#

yes when the mod reloads, could also be on zone change but im not 100% sure on that right now

turbid vortex
#

Alright I get it then. I was just looking for ways to 'fix' it once its broken.

compact stirrup
#

actually no it should only wipe on mod reload

#

it's been a minute since i've worked on this

turbid vortex
#

Oh I see. Well its a very cool project. So is the coop mod.

#

Given I dont have anyone to play with, this mod got my interest because I enjoy adding a little spice to the NPCs in games. This is also the first time I've seen an option to integrate AI into direct gameplay.

compact stirrup
#

#1386424336931623104 message is just the game doing it cause it has builtin commands

#

i don't actually think the ai said anything there

turbid vortex
#

Okay im out of bed. Gonna see how much of a pain this is to set up. I might just try to run it off Gemini first.

#

oooh Gemini API can cost more money.

#

Trying to find the free limit.

#

might be better off just running a local onee.

compact stirrup
#

i have a lot of fallbacks for when you run out of limits

#

it just picks the next lower tier

#

(i don't pay for any ai service)

turbid vortex
#

which of these is the config where i put the api

#

none from what i can tell lol

compact stirrup
#

it's in here after you've run the game once

#

or use config manager, which is prefered

turbid vortex
#

oh shoot okay is this the right path for the plguin?

C:\Users\JohnM\AppData\Roaming\Thunderstore Mod Manager\DataFolder\Erenshor\profiles\Erenshore\BepInEx\plugins

compact stirrup
#

oh i would have no idea because i don't use mod managers

turbid vortex
#

ah ya i just googled the mod and it took me to the manager

compact stirrup
#

it wont work if it's not in that folder

turbid vortex
#

well i have AI enhancements in the plugin folder via the manager. but im not seeing the config file.

#

i might just back track and go to github

compact stirrup
#

it wont be there unless you run the game at least once

turbid vortex
#

ok ill try that

#

like log into the character

compact stirrup
#

nah just run the game

turbid vortex
#

ahh thar she be!

#

does this look right?

compact stirrup
#

yep

turbid vortex
#

I think there was a long delay lol. Local LLM mighht be the way

#

but Aria spoke back, even did an emoji. I addressed the group but only got one reply.

compact stirrup
#

yeah there's a decision ai running in the back that decides if a sim should answer or not, it's to prevent sims going too crazy if they're talking to eachother

turbid vortex
#

lol yeah they just starteed talking to each other

#

pretty cool

#

im watching my usagee on my second screen.

#

if its crazy ill go local

compact stirrup
#

it shouldn't go too bad, even in all my crazy testing i didn't even get close to the limits

turbid vortex
#

Do you think theres a way to make the AI less mean? Lol

#

Well I asked them. Well see haha

compact stirrup
#

it could be that they're just not adhering to their character enough

#

gotta play around with topP and temp

turbid vortex
#

Ah yeah I didn't want to mess with the settings

#

I also might have chosen three npc with the same personality

jovial ore
#

Hello, i need some help getting the local llm to work. When i say something in the group i see the "llama-cli" command prompt popping up in front of the game window then it closes but there is no response in the game from any simplayer.

compact stirrup
#

spinthink there shouldn't be a cmd window popping up

jovial ore
#

that is what i thought too

compact stirrup
#

did you set up the folder structure correctly?

jovial ore
#

i think so, i put all the files for llama inside "Erenshor\BepInEx\plugins\AIEnhancement\llama"

#

i can see in the task manager that it is starting llama-cli.exe so at least that should be in the right place

compact stirrup
#

what models are you using?

jovial ore
#

the one that was recommended in the first post

compact stirrup
#

and for decision?

#

i mean not decision

jovial ore
#

maybe i need to change anything else here?

compact stirrup
#

the other one

#

you'll definitely need a much bigger model for message

#

that small one wont be able to handle the context size

jovial ore
#

ok so flan model only for decision?

compact stirrup
#

yes

jovial ore
#

ok that was not clear in the top post

#

anything you can recommend?

compact stirrup
#

gemma3 works well

#

i think the tags were like this

#

maybe without the space

jovial ore
#

Thanks i am giving that a try

#

still the same problem 😦

#

what should i say in the /group to test if it is working

compact stirrup
#

anything should make it work

#

im sorry it's not working for you, you should try with the google api

jovial ore
#

i only see the cli command pompts opening and closing

#

i really don't want to use anything online

#

does this look correct?

compact stirrup
#

yes

jovial ore
#

ok maybe i downloaded the wrong llama files

#

This is what it is sending to the cli, i notice the slash is the wrong way around

#

"--repeat_penalty" "1.5" "-ngl" "32" "--temp" "0.6" "--top-p" "0.9" "-c" "4000" "-n" "50" "-no-cnv" "--simple-io" "--no-display-prompt" "-m" "C:\Program Files (x86)\Steam\steamapps\common\Erenshor\BepInEx\plugins\AIEnhancement\llama/flan-t5-base-q4_k_m.gguf" "-p" "You are Leliril. You are in a group chat with Rafnor, and Cyndara. Only answer YES or NO. No explanations."

turbid vortex
#

Lol idk if its the base game or the AI but they do not want to be nice to me. No matter how hard I try they tell me I suck and im a noob lol.

So I said F you, if I suck so bad find a new healer and my tank said "k bye". Yeeesh hahah

compact stirrup
#

though you're right it should be a backslash

#

also it looks like you don't have llama correctly in the folder

#

oh no nvm

#

how did that happen

#

that shouldn't even be a path there

#

should it? i'll test it

jovial ore
#

i replaced "llama-cli.exe" with my own exe just to read the parameters you send to the cli. I really hope i can get this to work offline. The fact that the cmd is not opened hidden is already very strange to me

#

i downloaded your plugin files from here #1386424336931623104 message was that the correct ones?

compact stirrup
#

honestly i can't get it to work either, only the decision works for me and i really don't have time to work on this right now

#

i know @analog pivot got it to work

jovial ore
#

don't sweat it, i will wait patiently for a fix someday

soft mason
#

Any way to make them sound more intelligent, instead of saying "lol" constantly, or using "u" instead of "you"?

lyric island
#

Have you never seen chat in an mmo? This is pretty accurate. Hah.

compact stirrup
#

play with topP and temp, just looks like they aren't adhering to their character

#

and once it's that far there's really no way back, the ai sees that and thinks "this is how i talk"

#

i really can't fix that without a much better prompt and i suck at that

soft mason
soft mason
compact stirrup
#

if you're not using config manager for it then yes

turbid vortex
#

Maybe i could try to come up with something... more? lol but also in know you said you have no time for this mod.

compact stirrup
turbid vortex
#

nice okay ill look at it and then ill send you back what i come up with. idk if itll be today though

feral atlas
compact stirrup
#

private static Dictionary<MODEL_SELECT, string> models = new()
{
{ MODEL_SELECT.FULL, "gemini-2.5-flash"},
{ MODEL_SELECT.FALLBACK1, "gemini-2.5-flash-lite-preview-06-17" },
{ MODEL_SELECT.FALLBACK2, "gemini-2.0-flash" },
{ MODEL_SELECT.FALLBACK3, "gemini-2.0-flash-lite" },
{ MODEL_SELECT.FALLBACK4, "gemini-1.5-flash" },
{ MODEL_SELECT.DECISION, "gemma-3-27b-it" },
};
Im using these models, but that prompt isn't 100% complete it's missing sim examples, and specific zone info + the item info but that's not always there anyway

faint flare
#

This is very cool

sage grove
#

llama isnt starting :( and im not seeing any settings to select models in game, what did i do wrong?

compact stirrup
#

you're still on google api

#

literally the first big button in the settings

#

it also might still not work though, at least last time i tested i couldn't get it to work popokek

sage grove
compact stirrup
#

oh i see

#

your folder name is wrong

#

it should just be "AIEnhancement"

sage grove
#

gonna go fix it rn

#

hope it works

#

okay it works now for the settings but no messages being responded to

#

after sending a message in group chat cpu usage spikes with llama so i know its doing something atleast, just not in game :(

compact stirrup
#

i assume it's just doing decision, or always saying nah to answering

#

you do need a bigger model for message

#

than the decision model

sage grove
#

im new to all this and never really did anything with ai, this is what i have for my settings with it

#

should i use something else?

compact stirrup
#

im not sure how gemma will work for decision? do you have the console?

#

it'll definitely be a lot slower than using a really small instruction model

sage grove
#

i have the beepinex console up but nothing in the history that involves the ai mod

compact stirrup
#

try the model i recommended for the decision

sage grove
#

thank you again for helping me with it, im downloading flan rn

compact stirrup
#

gemma might just not work for it (different prompt setup)

#

or it's not answering in the correct way

sage grove
#

okay got it setup like this now

compact stirrup
#

nnoo keep message on gemma

sage grove
#

okie dokie, gonna restart

#

okay i have gemma for message and flan for the decision, llama isnt showing up as running in task manager now

compact stirrup
#

it takes some tries sometimes, there's some randomness for even running the models

#

to save on some resources mostly

#

i'll add an option for that eventually

sage grove
#

i see i see

compact stirrup
#

if you see the decision model answer in the console then you know its working

#

doesnt mean it's gonna spit out a message though sad

#

i haven't really looked into what made it not work on my end, i just have too much work to do with coop right now

#

that's why i recommend using the google api rn

#

(its free)

sage grove
#

understandable, google api did work for me

#

thank you for all your help with it

turbid vortex
#

havent got to play since the update. Mizuki, do you think the memories update will affect this mod?

compact stirrup
#

nope

median mulch
#

Should note: Google currently offers a 90 day trial with $300 worth of credits that can be used with gemini, so thats $300 of free api usage free of charge before you run out. Not sure if this is a permanent offer or timed. But if youre like me and have like 3 or 4 emails, thats a full year of saving too if youre going to mainly use them for this.

compact stirrup
#

actually all the models im using are free up to like iunno a shit ton of requests a day

#

no need to pay for it if you wanna use this

median mulch
# compact stirrup no need to pay for it if you wanna use this

Oh thats awesome! Yeah this one has a free tier as well. Im only using it since I already had a 3 month trial for for gemini pro on my phone. And then this one popped up. But I definitely couldn't afford the normal prices 😂😂. Having ai really makes the simpcs shine when you go questing and just want some chatter. Its amazing! I did set up LLama, but wasnt sure if it was working

median mulch
#

Hmmm, so I finally started testing everything, im using the Google api, and everytime I ask the group or message them. The game freezes for about half a second but then I never really get a response from them. Its always just a bunch of "huh" "okay" "sure" and them shouting what they're doing during a fight. Any possibility as to why?

turbid vortex
median mulch
turbid vortex
#

if the mod is istalled correctly it should run when the game runs.

#

itll be in the background. you can alt-ttab to it

compact stirrup
#

the console isn't active if you installed bepin by yourself

median mulch
#

Okay, I think im getting close. I was lacking a lot. No python installed etc. But I've got everything set up, and I just made sure my models were working with Ollama. So I know the ai is working now locally on my laptop. Let's see if I can figure out why its not working in game

median mulch
#

I did indeed install it myself

compact stirrup
#

in here somewhere i would assume

#

also this mod uses llama cpp that doesn't require python

median mulch
#

agh, just cant seem to get it idk, the log says it loaded up the mod fine, and i have it pointed tot he right models. but when i use /group to talk, it doesnt show anything in the log

compact stirrup
#

did you set it to llama as well?

#

what models are you using

#

you said you manually installed it, did you get config manager?

median mulch
#

yeah! i believe evrything should look alright, the log just doesnt show me as having sent a command tho with /group even though it does message the group

compact stirrup
#

yeah that looks fine

#

could just be that they all decided not to say anything (there's some randomness in there before it even hits the ai)

#

could be that flans context size is too smal and i have to increase it

median mulch
compact stirrup
#

should be like @turbid vortex has shown

median mulch
#

is the only thing i can get to pop up, when i try to change the max token value

compact stirrup
#

maxtokens is the output size anyway haha, and that error isn't my fault

#

config manager is sometimes a bit dumb

median mulch
#

Haha nah I figured, its just the only thing that shows anything in the unity log :O, I shall keep trying tho

compact stirrup
#

i can put a version that shows the actual output of llama

median mulch
#

would be awesome!

#

also not sure if this is supposed to happen? this is from the mod manager log

compact stirrup
#

yes bepin wants to load llama but doesnt

#

or rather cant

#

not sure if i can tell it not to try

median mulch
#

I notice when I end the message in a question mark, it takes. Second and it almost looks like my character reloads into position. Im assuming its trying to do its thing, but I guess its failing. Im going to leave it installed and see if anything magically starts working later xad

#

XD

compact stirrup
#
  • Added 3 new settings
    • Sim to Sim Respond Chance
    • Sim to Player Respond Chance
    • Enable Debug

if you enable debug, it will ONLY show the PREVIOUS error log of llamacpp (im too lazy to make it show right after) so basically run it twice

#

it should really be called response

#

who cares

#

@median mulch now we can actually figure out whats wrong but tbf i didn't test this popokek

median mulch
#

I'll just leave it be until i can pinpoint what the issue is.

compact stirrup
#

i'm testing now

compact stirrup
#

found the issue aslF

median mulch
#

Awesome!

compact stirrup
#

still doesn't explain why your DECISION doesn't work

compact stirrup
#

didn't set my model up correctly but it's working now!

#

also for some reason thinks it's called neryssa aslF

median mulch
#

Sorry wrong one lmao

#

It was

#

llama-b5823-bin-win-cpu-x64.zip

compact stirrup
#
  • fixed llamacpp message model not working because it was getting about 10000k sim instructions
compact stirrup
rugged fulcrum
#

so, if i have ollama running on a remote server, i can't just plug an API key into this mod? (because it serves a different kind of API)

i'm asking because it's not that hard to scrape the game wiki and set up RAG search over it so the bots can actually tell you what drops where and how to finish quest but nah i'm not running that on my home pc.

median mulch
# compact stirrup that's the one im using so it should work

Mmm honestly I've given up for now, neither the Google api or llama are working in game right now :/, idk what it may be tbh. It simply doesnt show anything in the logs even though the mod shows up in game and all, either that or they simply never want to answer me lmao

whole monolith
#

Hey! Mod looks great and a lot of what I'm looking for in a game like Erenshor. I was wondering, however. Does the mod allow the AI to be contextually aware at all of what it's doing in-game (e.g.: killing a monster, or that it's even in a dungeon) or does it generate context based on conversation alone?

compact stirrup
#

it's only conversation

#

it's a proof of concept not a full implementation

whole monolith
#

Makes sense! And still a very nice addition all the same. I'll just express a firm interest in this feature, but no expectation. Thanks for the fast answer 😌

distant wraith
#

@compact stirrup I know you're booked up with coop mod stuff rn. I want to put some work into this mod and get it fully functioning and your proof of concept here would be a great place for me to begin and help with a bit of a jumpstart. Could you send me the cs files you have for the latest version or possibly the github repo? Not sure what ur using

compact stirrup
#

since the code doesn't only contain the ai model stuff i don't really want to release it

#

it also has code for a neural net for skills/spell use (it's disabled)

#

i dont really feel comfortable having shit code on that for people to look at (besides you can decompile the dll)

distant wraith
#

No worries! Appreciate the quick response😊

#

And also appreciate the permission to decompile. Didn't want to mess with ur work

compact stirrup
#

i do have other plans for it though, the original idea of this is to make sims generally a bit smarter

distant wraith
#

And I can also keep what I make for my own personal use if you have a vision you're trying to accomplish here. I just wanted to play the game with AI bots cause itd b more fun for me haha

lilac kayak
#

Does this allow for the usage of a different API/provider?

#

I have a thingy with Featheless so I'm curious if I can use that instead of the google api

compact stirrup
lilac kayak
lilac kayak
#

Ah, I don't seem to get responses from the simplayers in group chat

#

I just get like a brief hiccup when sending a message in

vital glade
#

the game stutters for up to 2 or 3 seconds before any reply comes in. would running it locally help with this?

compact stirrup
#

that would make it worse

vital glade
#

hmm

bold jay
#

hey I was going to try it out, but with everything installed the UI doesn't show up when game launches.

ashen scroll
#

Hello, since its already support api call, you should replace the provider field by an url field
Then instead of having to run llm from the game, only a single instance of llm could run on ollama/llmstudio/independant llama.cpp, so we would just have to input localserver url into that api url field and also all provider would be supported
As its not usable to either user private api or 3 llm to make bot talk

woeful hedge
fast parcel
#

I'm guessing this is not going to see an update, right?

narrow sluice
#

Any updates?

compact stirrup
tacit acorn
#

New here; is this still functional with the current game build?

compact stirrup
#

it hasn't been functional since .2 came out

#

[Discontinued] AI Enhancement

#

or rather i haven't worked on it since then so i don't know if it still does

sly spire
#

@compact stirrup I have some questions 👉👈

narrow sluice
#

Why is this Discontinued

lyric island