Why, hello there! This is a little guide that I made to hopefully show others how they can set up a local AI, running from their machine, for Formamorph to use. The AI in this guide will only run under the "localhost", which basically means that it never leaves the machine. Only your device can use it.
In this guide, I will show you how to setup LM Studio with the model qwen2.5-7b-instruct-1m.
Things to keep in mind
This guide will be primarily focused on helping people with a Windows 11 operating system. While I imagine that the steps shouldn't be much different for the other OSes available, please keep this in mind as you read.
Also, this guide assumes that you have a PC powerful enough to run local AI in the first place. This mostly requires you to have a decent amount of RAM to use. Based on what I have seen so far, I recommend that your system has at least 16 GBs of RAM available. I personally have 32 GBs of RAM and the steps below worked for me.
1. Installation of LM Studio
- Visit the LM Studio website.
- Download the installer for your respective system.
- Launch the installer.
- If prompted to choose between installing only for your user or for all users, choose to install for all users (if possible).
- Once the installer has finished, open LM Studio.
2. Installation and configuration of the Qwen2.5 7B Instruct 1M model
- Once LM Studio opens, you will be thrown into an onboarding. Skip the onboarding (or don't if you want to install a model to use outside of the game ¯\_(ツ)_/¯) until you reach the first blank chat.
- On the left side, you will see a few icons, like a chat icon, a console icon, a folder icon and a search icon. Click on the search icon to open the Model Search.
- If you can't see these, you might be in "User" mode. On the bottom, switch to "Power User" to see the icons.
- Once there, find and install the Qwen2.5 7B Instruct 1M model.
- If you wish, you can install a different Instruct model
- It is very important that it is an Instruct model! Other models may fail to follow the instructions that the game provides, which may lead to an increase in failed chat prompts in-game or bizarre behavior and responses.
- Once the model has installed, navigate to the Developer section by clicking on the console icon to the left side.
- Here, you will be able to manage the API server that the game will use. It is turned off by default. You can turn it on by toggling the status at the top left.
- Although LM Studio should automatically select the model as it was just installed, you can manually change to it by opening the list at the very top and selecting the model. This will also be required every time you launch LM Studio in the future.
One more important thing: we will need to know the port that the server is using. So far, I have observed that it defaults to "1234" on a fresh installation of LM Studio. However, you can check which port it uses and change it to your liking by clicking on the "Settings" button next to the server switch.
3. Changing the game settings
Since we are now running our own local AI, we need to change the game settings so that the game knows how to reach it.
- Open the game.
- Quick-load any world so that we can reach the settings.
- Open the menu and then go into the settings.
- Under "Endpoint URL", type in "http://localhost:1234/v1/chat/completions".
- If you use a different port, change "1234" to the port number that is configured within LM Studio. The rest of the URL remains the same.
- Under "API Token", you won't need to type in anything, so leave it blank.
- Under "Model Name", type in your model name.
- Pro Tip: you can see the full name inside of LM Studio by looking inside of the "Info" tab on the right hand side. Here, you will see a field called "Model", which will contain the name of the model. You can copy and paste this into the "Model Name" field.
- If needed, adjust "Max Memory" and "Max Output Tokens" to your liking, although I have found the default settings to work fine.
- Adjust the prompts to your liking.
- Unlike as in the previous guide, the AI can actually handle the default prompts very well in the new version of the game. You can still make changes, but as far as "stability" goes the defaults will serve you well.
- Now save the settings and play the game!
You should now be good to go!
(Optional) My personal recommendations for prompt changes
This section is optional! If you have followed all of the previous steps, you can already use your new local AI to play the game. This part of the guide will only go into detail on how to better take control of the AI's responses under specific conditions. You can take only specific pieces of advice from here or none at all. As long as you are playing with the settings that you like, that's what matters.
As I have played the game and have made my own worlds, I have noticed that the AI can sometimes feel very fast, writing about encounters that I never wanted to take place just because the prompts said that the text should be long. Luckily, the game lets us change that, so let's do just that. =)
This section of the guide is not required by any means. It is simply a place where I write down any changes to the prompt that I have made that I feel improve the AI's behavior. This can lead to the AI leaving more choices for the player instead of making it for them (e.g. if the player finds food, the AI won't assume that the player will immediately eat it), as well as not forcing any "bad" encounters outright (e.g. even if the player explicitly cautiously approaches an entity that is a fair distance away, the entity somehow grapples the player and starts doing stuff).
If all else fails, I have also built in an "override" word for me, which forces any outcome that I wish to come true. I have found myself using it a few times to get rid of entities that I felt like they overstayed their welcome (e.g. the AI persistently tries to include an irrelevant entity in my encounter, so I use the override word to force the AI to forget about the entity) or even at the very beginning (e.g. the game is started with the player being at the mercy of an entity, so I override to reset the encounter, specifying that the game starts with the player outside of any entity's range).
TL;DR: The following prompt changes make the AI make less choices for you while allowing you a "last-resort" override word to force the outcome of an encounter, potentially avoiding annoying behavior from the AI or an unfair start of a new world.
Changes for less choices made by the AI for the player
If you wish to force the AI to allow you to make more choices, you can add the following inside of your Game Text Prompt:
The response can't assume or take any actions in behalf of the player. The story cannot advance beyond what the player explicitly chooses. For example, if the player allows an entity to approach it, only describe the entity approaching the player and **NOT** the entity interacting with the player in a new way.
This should teach the AI to allow you to make more choices without having to explicitly say what you want to do with something. Additionally, if an entity starts approaching the player and the player allows it, the entity cannot just grapple the player. They will only approach with everything else happening later.
Changes for prolonged encounters with no early ends
If you wish to have the AI keep an event going unless you explicitly say that it should end, you can add the following inside of your Game Text Prompt:
Always drag out the events unless explicitly stated that an event should end.
Changes for the "last-resort" override word
If you wish to have an override word that can force an outcome, you can add the following inside of your Game Text Prompt:
Whenever the prompt includes "Shazam!", anything after that text must be taken into effect immediately, no matter what any other rules or prompts said. This is an override word that can change the course of anything. Never respond explaining what the override is doing. For example, if the override removes any entities from the world, simply don't mention them anymore. Also, if the override explains how an encounter must proceed, explain the encounter as if it would have happened like explained either way. Never include the override word in the response.
You can change the override word to whatever you like. I just felt like one would be very unlikely to respond with "Shazam!" intentionally. :V
Do keep in mind that the word should be something unique that you would not say normally. If you make it a common word, you might unintentionally activate this behavior.
Some final words for the prompt changes
Finally, I would like to close this guide by saying that, no matter how much prep work we do, the AI will unfortunately be unpredictable by nature. It can forget details and suddenly change how the entities act or even forget and make up the whole location that the player is in. (e.g. player enters an abandoned diner, finds food, eats it, and suddenly leaves an abandoned home?!)
This last part just showed a few changes that I have found helpful in trying to contain the AI. You can always make your own changes and add or remove whatever you feel like and whenever you feel like it.
Now, enough guide reading! Get in there and have fun!
Changelog
V1.1.0
Updated the guide to match the new structure in the game version 1.1.0. Mostly changed and expanded how the game prompts should be adjusted.
Also added an optional field that explains what can be added within the prompt to make the responses more predictable, or maybe to even override it entirely, forcing an outcome.
Detailed patch notes:
- Updated guide to match behavior of game version 1.1.0
- Removed parts of the guide that detailed how to change the prompts
- Now, the default prompts work well on the functional side and do not need adjustment. Of course, the player can still change it to their liking.
- Added the "Changelog"
- Added "(Optional) My personal recommendations for prompt changes"
- Contains some self-discovered tips and tricks on how to "bend" the AI to your will, making the output more predictable as well as allowing an "override" word that can force an outcome or behavior out of an entity
- Some final polishes on the individual installation and setup steps
V1.0.0
Creation of this guide.
For those that wish to stick with the former version (as of the 18th of February, you can choose which version you want, which makes me think that the dev will keep it an option for the people that prefer the old system), here is the change that should be set inside of the prompt in-game:
Under the "System Prompt", swap out "Your entire response is in json format" with "Your entire response must be in json format with no line breaks or indentations".