Lurker News
Hi HN community! We want to share AI-town, a deployable starter kit for building and customizing your own version of AI simulation - a virtual town where AI characters live, chat and socialize.

Inspired by great work from the Stanford Generative Agent paper (https://arxiv.org/abs/2304.03442).
A few features: - Includes a convex.dev backed server-side game engine that handles global state - Multiplayer ready. Deployment ready - 100% Typescript - Easily customizable. You can fork it, change character memories, add new sprites/tiles and you have a custom AI simulation
The goal is to democratize building your own simulation environment with AI agents. Would love to see the community build more complex interactions on top of this. Let us know what you think!
Demo: https://www.convex.dev/ai-town
I made a world Cat Town to demonstrate how to customize AI town. Using C(h)atGPT :)
Demo: https://cat-town.fly.dev/ Code: https://github.com/ykhli/cat-town

Comments (115) 30 threads

jmorgan3 replies#
If you haven't yet checked out the Generative Agents project referenced by OP, definitely give it a look, it's open source: https://github.com/joonspk-research/generative_agents

Over the weekend Lance Martin got it working with local models using llama.cpp and ollama.ai which saves $ on longer sims since all inference happens locally https://twitter.com/RLanceMartin/status/1690829179615657985. It's neat how the AI agents interface with each other – e.g. one will host a party and invites will be sent throughout the group

tudorw#
we've been waiting a long time :)
calebio#
would be really fun to hook this up to Stardew Valley!
andai#
I wonder how llama affects the simulation. Even llama2 consistently fails simple reasoning tasks.

(Though I suppose people aren't very reasonable, so it might give an accurate simulation!)

liorben-david4 replies#
This is awesome!

Game idea to build on top of this: Table top deception type game where each agent has the goal of convincing the real users that they are in fact also real users.(So each agent is trying to pass a turing test).
Every AI agent uses RL to optimally prompt their personal LLM for how they should chat with the human players. eg should they try to frame a certain person, should they play it dumb, should they gaslight etc.

huevosabio2 replies#
I think it may be even more fun the other way, players need to rat out other players, do they have to pretend to be an AI.

It makes it easier for the AI mods to do the part and it puts the burden on the players.

reaperman2 replies#
Yep. "Find the AI" is broken for now, because whenever I've played it, humans can just be exceptionally rude/lewd or use super-modern slang. Making the humans try to blend in as AI is much more interesting, as a game.
eloisius#
A game like Press The Button, except there’s half AIs and half human players. The goal for each is to identify the others and airlock them off the ship. Constrain the tests in such a way that open chat using lewd language or whatever is impossible. I’d play that once or twice.
Kiro#
Where do you play that?
wishfish1 reply#
I like your idea of find the human. Just building on that idea a little. I know current AI detection programs don't work well. But they would be fun in the context of a game. Call it "Only Robots Allowed" and have it be a single player version of Among Us. Pretend to be a robot while trying to sabotage robot things. AI detection is applied to your conversation with other robots. And also applied to your movements. If you fail the AI detection by not emulating an AI well enough, then it's time for "kill all humans!"
falcor84#
This is probably the most important life skill we should be teaching in schools .
pelorat2 replies#
It would be pretty easy to beat. One sure way to tell an LLM apart from a human is to type something nonsensical and optionally repeat it multiple times. A human would inevitably answer with something along the lines of "what the hell are you on about dude???", which is something you'd never see from an LLM.
e12e#
> which is something you'd never see from an LLM.

Might not see it from ChatGPT - but "never from an LLM"? Why would you think that?

gmerc#
So you make it learn. It collects everything humans say and matches it to the situation, replaying human conversation as needed.
dalore#
So like Battlestar Gallactica. Who is the cylon? The cylon might not even know they are not human until revealed to them later.
chaoz_#
With the current state, most powerful LLMs are also limited in the amount of topics they are allowed to discuss. I bet you could easily differentiate between player and AI by asking opinions on some controversial topic.
tavavex1 reply#
This is a very interesting use case of the Generative Agents project.

I feel like this is just one of the earlier attempts at creating an interactive experience with this, but there's still so much potential for future games, if the technology is refined further. Think of something like Animal Crossing (or any other game where interacting with NPCs is at the forefront of gameplay), but with the characters that have completely unique personalities and an ability to generate new dialogue (rather than relying on a limited number of pre-written lines), or react to player actions in unique ways, and so on.

fnordpiglet1 reply#
I feel like this might be the beginning of a much richer single player game genre that mixes generative language, image, texture, and other features with procedural rogue like world generation with the semantic features defined by the LLM. Obviously NPCs, dialogues, etc, can all be context aware agents bootstrapped by the environment and player history. Content creators IMO will be creating assets that are used to fine tune and create LoRas as future game assets. Instead of monotonously creating every asset in a game, they would create styles and control nets, language corpuses, and human written lore RAG’ing into game context, etc. I think artists will have a wonderful contribution much richer than simply painting a picture.
pyinstallwoes#
Which ultimately ends with thinking as a generative prompt into thoughts which get passed to the universal rendering engine known as reality.
pablo246023 replies#
I built something very similar when the paper came out- watch out for the instances where GPT returns both sides of the conversation (e.g. interpreting a prompt with chat history as being representative of what the output should look like, and putting out both "Jack" and "Jill"'s text). The first sample I went to suffered that problem (output from "Lucky's perspective below.)

"Hey Stella! It's so great to see you! You'll never believe what I've been up to recently. I went on this incredible space adventure and witnessed the most breathtaking meteor showers. And guess what? I even encountered alien beings who communicate through colors! It was absolutely mesmerizing. Stella: Wow, Lucky! That sounds absolutely fascinating. I've always been intrigued by space and the wonders it holds. I would love to hear more about your adventure. Lucky: I'm thrilled that you're interested, Stella! I can't wait to share all the details with you. But before we dive into that, I heard you're passionate about gardening. Is that right? Stella: Yes, that's true! Gardening is one of my favorite hobbies. I find it so peaceful and fulfilling. Lucky: That's fantastic! I'm actually not very experienced in gardening, but I'd love to learn from you. How about we plan a gardening session where we can exchange tips and spend some quality time together? Stella: That sounds wonderful, Lucky! I'd be more than happy to share my gardening knowledge with you. Let's find a time that works for both of us. Lucky: Absolutely! I'm really looking forward to it. But hey, no rush. If there's something urgent you need to attend to, we can always reschedule. Just promise me we'll find another time to connect. Stella: Don't worry, Lucky"

drusepth4 replies#
Did you have any luck mitigating this problem?
baobabKoodaa#
It's relatively simple to detect this type of defect and handle it during/after generation.
SamPatt#
I've run into this issue a lot with ChatGPT, and almost never with GPT-4. I know it isn't always possible, but just using GPT-4 prevents this 99% of the time (basically 100% with proper prompting).
fennecfoxy#
Sure, to force chat gpt to role play I've found that giving it a character to play and then prefixing your query with underscores for meta-roleplay stuff works well.

Ie if the LLM is playing a character "Jack" and you are playing the character "James" your query might be "_only reply for your character Jack_ James: I pick up the sword and then turn towards Jack".
It can also be used to influence behaviour as LLMs often get stuck repeating (not word for word) the same events/description, ie greeting your character over and over again and not moving on, LLMs aren't great at having autonomy/agency in the flow of a conversation, I think this is best done by not providing the entire history of the conversation but instead distilling it to relevant information for the current query.
But that can also be mitigated manually by bumping their character with underscores ie "_Jack asks what James wants to order_ James: I return Jack's greeting and peruse the Tavern's menu board".

dalore#
You make the other side of the conversation the stopword. i.e. "Jill:" for Jack and Jill.
swyx#
what a descent from loving nature down to "heyyy scheduling is hard"
dalore1 reply#
I did that but the trick to fix that was to use the other person's name and : prefix as the stop word. So in your case "Stella:". Then if it tries to continue the other side conversation it would just stop.

I also noticed this when browsing the demo village, some conversations it ran through and did both parts.

pablo24602#
This ended up being my solution as well- although I still ran into edge cases where GPT would output things like "Stella said". Never did manage to 100% fix this issue, even with creative prompts.

Load more comments