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.
See it live here: https://chat.openai.com/g/g-P3LABcaro-maplestory-npc-scripter
- 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. Link
Have fun~! AI-ing~!!
- Install NodeJS 18: https://nodejs.org/en/
npm install
- Create an account, and get an OpenAI API key
- Go to
config.ts
and enter the API key underOPENAI_API_KEY
- Place your NPC scripts under
_input\npc\
folder
npx ts-node script.ts
- You should see the refractored files under
_output\npc\
- 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 fine-tuning of 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:
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!");
}
- [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.
- Chat completions https://platform.openai.com/docs/guides/chat
- Explore other AI prompts, to adjust its behaviour and personality https://github.com/f/awesome-chatgpt-prompts
- GPT Playground (get the prompts from "/prompts" folder of this repo)