- Joined
- Aug 13, 2009
- Messages
- 124
- Reaction score
- 123
Creating MapleStory (odin based source) NPC Script AI using GPT4
This is a small technical demonstration showcasing the capabilities of GPT in relation to legacy MapleStory (odin-based source) scripts.- State based NPC script to stateless NPC script - These scripts are state-based and can often be laborious to write, and even more tedious to convert to a stateless alternative today (thousands upon thousands of them).
- NPC story-writer + script-writer.
Changes:
- 08/03/2023 -- With the release of gpt-3.5-turbo model today that makes it even better, I shall present you with the following that I have for a while.
- 29/03/2023 -- updated for GPT4
- 18/02/2024 -- An example has been included live.
You must be registered to see links
See it live here:
You must be registered to see links
You must be registered to see links
-------------------------------------
More examples:
Converting from state-based NPC script to stateless:
Creating a series of NPC scripts revolving around a single theme:
Creating complex Tic-Tac-Toe NPC script:
Have fun~! AI-ing~!!
Instructions to run
Installation & setup
- Install NodeJS 18:
You must be registered to see links
- npm install
- Create an account, and get an
You must be registered to see linkskey
- Go to config.ts and enter the API key under OPENAI_API_KEY
- Place your NPC scripts under _input\npc\ folder
Start
- npx ts-node script.ts
- You should see the refractored files under _output\npc\
FYI
Limitations
- You have to adjust the prompts according to your own MapleStory sources, it is not guaranteed to work as you may have different function names for the NPC conversation.
- It may not work 100% of the time. Try to change the "temperature" parameters to 0.2 from 0 for a little added randomless to the output instead of a fixed-deterministic output.
- ALWAYS test it, before going to production. Every single script.
- Further optimisation is possible down the road when
You must be registered to see linksof a model is supported for GPT3.5/GPT4 and above. To save both cost and for higher accuracy.
- It might not be able to refractor if the script's input size is > 32,768 tokens due to GPT4's current limitation.
- It may sometimes hallucinate to create functions that lead to nowhere, I'm relatively sure GPT is trained on other MapleStory Odin-based sources out there on GitHub. It might be possible to solve this by showing it more examples of scripts refractored manually by a human vs its unrefractored counterpart when the limitations of 4096 tokens are lifted. Example:
Code:
function onUserEnter() {
cm.say("I'm the head of this hair salon. If you have a #b#t5150053##k or a #b#t5151036##k allow me to take care of your hairdo. Please choose the one you want.");
}
function onUserExit() {
cm.say("Thank you for visiting our salon. Come back soon!");
}
function onDisconnected() {
cm.say("Oh no! You have disconnected. Please log back in and visit us again!");
}
How its done:
- [System] Prompts GPT what persona it needs to be, or to act as.
- [System] Tells GPT the stateless NPC functions available
- [User] Tells GPT to refractor the script to a stateless NPC script.
- [Assistant] Actually shows it a valid refractored example to guide its knowledge further.
- [User] Give it a real unconvered script, and ask for conversion.
Useful link
- Chat completions
You must be registered to see links
- Explore other AI prompts, to adjust its behaviour and personality
You must be registered to see links
-
You must be registered to see links(get the prompts from "/prompts" folder of this repo)
Attachments
You must be registered for see attachments list
Last edited: