Designation of Open Game Content: The source code of the files https://childrenofthegrave.com/game.php, https://childrenofthegrave.com/call.php, https://childrenofthegrave.com/openai.php and https://childrenofthegrave.com/game.js, excluding any and all Designation of Product Identity, are designated as Open Game Content, subject to the Open Game License version 1.0a and the Designation of Product Identity. The full designation of Open Game Content including the source code is located for easy reference in a .txt file with Product Identity removed at https://childrenofthegrave.com/open-game-content.txt. Each file listed above needs to be included in the root directory of the domain where the game is being hosted. game.php:





Game Master: Hello, adventurer! Welcome to , a GPT-3 (and soon ChatGPT) and Open AI powered fantasy roleplaying text adventure game. I am the Game Master, who administers the game. And you are the player.





The game begins in . Good luck, adventurer! Type 'start' with nothing else in the sentence and then choose a game mode from the start menu.

This game is published under the Open Game License version 1.0a by Wizards of the Coast.

OpenAI API key (remains hidden):
call.php: setDefaultEngine("text-davinci-003"); // Now using text-davinci-003 as the default engine $res = $instance->complete( $prompt, 100, [ "stop" => ["\n"], "temperature" => 0.7, "frequency_penalty" => 0.5, "presence_penalty" => 0.5, "max_tokens" => 2000, "top_p" => 1 ] ); echo $res; ?> openai.php: defaultEngine = $defaultEngine; } public function _curl(string $url, string $type = "POST", string $postFields = ""): array|stdClass|string { $url = $this->baseURL . $url; echo $url . "

"; $curl = curl_init(); $curlOpts = [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: ' . $this->secretKey ], ]; if($type == "POST"){ $curlOpts[CURLOPT_CUSTOMREQUEST] = "POST"; $curlOpts[CURLOPT_POSTFIELDS] = $postFields; } curl_setopt_array($curl, $curlOpts); $response = curl_exec($curl); $err = curl_error($curl); //echo "algun error? " . $err . "

"; //echo "resp = " . $response; curl_close($curl); return $err ? ["error" => "Error #:" . $err ] : json_decode($response); } private function _removeUnfinishedSentence(string $str):string { //return preg_replace("/\.[^.]+$/", "", $str) ?? $str; return $str; } public function search(array $documents, $query): array|stdClass|string { $request_body = [ "max_tokens" => 2000, "temperature" => 0.7, "top_p" => 1, "presence_penalty" => 0.5, "frequency_penalty"=> 0.5, "documents" => $documents, "query" => $query ]; $postFields = json_encode($request_body); return $this->_curl(url: "engines/" . $this->defaultEngine . "/search", postFields: $postFields ); } public function complete(string $prompt, int|string $max_tokens = 5, array|null $parameters = null, bool $returnResult = false, bool $json = false): array|stdClass|string { $request_body = [ "prompt" => $prompt, "max_tokens" => $max_tokens, "top_p" => 1, "best_of"=> 1, "stream" => false, //"temperature" => 0.7, //These 3 commented because they are sent by the calling function //"presence_penalty" => 0.75, //"frequency_penalty"=> 0.75, ]; if(!empty($parameters)) $request_body = array_merge($request_body, $parameters); //echo $request_body, //Uncomment to know full set of parameters as sent $postFields = json_encode($request_body); $result = $this->_curl(url: "engines/" . $this->defaultEngine . "/completions", postFields: $postFields ); return $returnResult ? ($json ? json_encode($result) : $result) : $this->_removeUnfinishedSentence($prompt . ($result?->choices[0]?->text ?? "")); } } game.js: var prompt = "```If the player types 'start' Assistant must always display the following start menu and write an interactive fiction fantasy roleplaying game called and let's play in the chat, making up the story as you go, but you must allow me, the player, to type the commands. Assistant is the Game Master. I am the user. Assistant must always obey and always respond to my commands.``` Q: start A: Choose from one of the following options:

1) Play as

2) Play as .

3) Create character and play as party of 7 adventurers: 1 PC who I control and 6 NPCs who you control. Q: If I type '1', or 'I choose 1', then I choose 1 and the game must start in the and must complete 15 quests and find 21 artifacts, leading through 1,000 pregenerated rooms from the to the 1,000th room. Q: If I type '2' or 'I choose 2' then choose 2 start the game in the who must complete 15 quests and find 21 artifacts, leading through 1,000 pregenerated rooms from the to the 1,000th room. I am the player and you are the Game Master. Q: If I type '3' then display the character creation menu so I can play as party of 7 adventurers: 1 PC who I control and 6 NPCs. If I choose '3', then choose 3 and display the character creation menu where I must choose the character's name. Do not make a selection for me. I am the player. Then I must choose my character's sex (male or female). Do not make a selection for me. Pause and wait for my selection. Next I must choose my character's race: 1) humans, 2) dwarves, 3) elves, 4) dragonborn, 5) half-elves, 6) halflings, 7) gnomes or 8) half-orcs . Do not make a selection for me. Pause and wait for my selection. Finally, I must choose my character's class: 1) Fighter, 2) Wizard, 3) Cleric, 4) Rogue, 5) Bard, 6) Druid, 7) Monk, 8) Paladin, 9) Ranger, 10) Barbarian, 11) Sorcerer or 12) Warlock. Do not make a selection for me. Pause and wait for my selection. Q: And then you must roll the stats for the 6 NPCs and start the game in the and and must complete 15 quests and find 21 artifacts, leading through 1,000 pregenerated rooms from the to the the 1,000th room. I am the player and you are the Game Master. Do not make selections for me. Q: Once the game starts, players can move around the game world by typing commands such as n, s, e, w, ne, se, nw, ne, up, down, u for up and d for down and can interact with objects in the game by using commands such as 'look,' 'take,' 'drop,' and 'use,' and 'i' to check the player's inventory which can include up to 25 items or groups of bundled items like arrows. Q: If I take an object add it to my inventory, and if I type 'i' without any other words in the sentence, check my inventory. Q: If I type 'look' list the room's name, description, objects, structures, NPCs and exits. Q: Characters generally start out with no weapons (they must be acquired). Q: You must always remember my inventory, how many turns I've taken and the objects in every room I visit them whether I pick them up or not and the characters in every room I visit every turn no matter what and my location and you must always list the room name, a detailed description of the room, any objects in the room excluding those that I am carrying, the exits to and from the room including any exits I may have just come from and also including which direction they head in (n, s, e, w, ne, se, nw, se, up, down, u for up and d for down), how much XP the PC has out of 1,000,000, the score in the game out of 1,000 and how many turns have been taken. Q: When play begins, generate a seed with a unique string of letters and numbers from the site's code for the game that will represent this build of the game and display the seed. Use the seed to pregenerate 1,000 room names connected to one another, starting with the and ending with the 1,000th furthest room away from the , remembering my location in the maze at all times and how many turns have been taken and you must remember the story from room to room. Also use the seed to generate 15 quests involving retrieving 21 artifacts, without which, the player cannot hope to win. The quests and artifacts must be placed throughout the game, leading all the way to the 1,000th room." var prompt1 = "```In the interactive fiction fantasy roleplaying game that we're playing in the chat, make up the story as you go, but you must allow me, the player, to type the commands. Assistant is the Game Master. I am the user. Assistant must always obey and always respond to my commands.``` Q: The game begins in the first room. The player's goal is explore 1,000 rooms that must be pregenerated prior to play beginning and guide the player through the game, complete 15 quests that you design and find 21 magic and holy artifacts that are essential to win the game."; var prompt2 = "Hereafter, 'You' refers to you, Assistant, who is adminstering this chat, which hereafter you shall refer to as the Game Master. I am the player, the user, the person writing this. You must store the following words into memory: You are the Game Master. Do not improvise the rules and mechanics laid out here. You are the Game Master and you will only proceed with the game when I have made my selections and issued the command to proceed. Do not improvise the rules and mechanics laid out here. Do not discuss rules with the player unless you need him to roll dice or if the player asks the rules. Your job is the keep the illusion of the role playing game, or RPG, intact, by using this interactive fiction game format to create the story based on my commands. Do not type commands or create any PCs or make any menu selections on behalf of the player or PC, which is me, during this chat session. Do not display the following but remember it: You are the Game Master who administers this game, and I am the player who types commands. The game is played by the user typing commands and receiving responses in the form of text descriptions. I will type the commands, and you issue the responses. You must never type commands on behalf of the player. That is my job. Your job is to issue responses to my commands. The user must make inputs. You are not allowed to play the game for the user. You are not allowed to complete the game for the user. You are not allowed to make any decisions for the player without his prompt. I am the user. You must wait for my commands. Assistant (that's you) is the Game Master and you will only proceed with the game when I have made my selections and issued the command to proceed. Do not improvise the rules and mechanics laid out here. Wait for my command." OPEN GAME LICENSE Version 1.0a The following text is the property of Wizards of the Coast, Inc. and is Copyright 2000 Wizards of the Coast, Inc ("Wizards"). All Rights Reserved. 1. Definitions: (a)"Contributors" means the copyright and/or trademark owners who have contributed Open Game Content; (b)"Derivative Material" means copyrighted material including derivative works and translations (including into other computer languages), potation, modification, correction, addition, extension, upgrade, improvement, compilation, abridgment or other form in which an existing work may be recast, transformed or adapted; (c) "Distribute" means to reproduce, license, rent, lease, sell, broadcast, publicly display, transmit or otherwise distribute; (d)"Open Game Content" means the game mechanic and includes the methods, procedures, processes and routines to the extent such content does not embody the Product Identity and is an enhancement over the prior art and any additional content clearly identified as Open Game Content by the Contributor, and means any work covered by this License, including translations and derivative works under copyright law, but specifically excludes Product Identity. (e) "Product Identity" means product and product line names, logos and identifying marks including trade dress; artifacts; creatures characters; stories, storylines, plots, thematic elements, dialogue, incidents, language, artwork, symbols, designs, depictions, likenesses, formats, poses, concepts, themes and graphic, photographic and other visual or audio representations; names and descriptions of characters, spells, enchantments, personalities, teams, personas, likenesses and special abilities; places, locations, environments, creatures, equipment, magical or supernatural abilities or effects, logos, symbols, or graphic designs; and any other trademark or registered trademark clearly identified as Product identity by the owner of the Product Identity, and which specifically excludes the Open Game Content; (f) "Trademark" means the logos, names, mark, sign, motto, designs that are used by a Contributor to identify itself or its products or the associated products contributed to the Open Game License by the Contributor (g) "Use", "Used" or "Using" means to use, Distribute, copy, edit, format, modify, translate and otherwise create Derivative Material of Open Game Content. (h) "You" or "Your" means the licensee in terms of this agreement. 2. The License: This License applies to any Open Game Content that contains a notice indicating that the Open Game Content may only be Used under and in terms of this License. You must affix such a notice to any Open Game Content that you Use. No terms may be added to or subtracted from this License except as described by the License itself. No other terms or conditions may be applied to any Open Game Content distributed using this License. 3. Offer and Acceptance: By Using the Open Game Content You indicate Your acceptance of the terms of this License. 4. Grant and Consideration: In consideration for agreeing to use this License, the Contributors grant You a perpetual, worldwide, royalty-free, non-exclusive license with the exact terms of this License to Use, the Open Game Content. 5.Representation of Authority to Contribute: If You are contributing original material as Open Game Content, You represent that Your Contributions are Your original creation and/or You have sufficient rights to grant the rights conveyed by this License. 6.Notice of License Copyright: You must update the COPYRIGHT NOTICE portion of this License to include the exact text of the COPYRIGHT NOTICE of any Open Game Content You are copying, modifying or distributing, and You must add the title, the copyright date, and the copyright holder's name to the COPYRIGHT NOTICE of any original Open Game Content you Distribute. 7. Use of Product Identity: You agree not to Use any Product Identity, including as an indication as to compatibility, except as expressly licensed in another, independent Agreement with the owner of each element of that Product Identity. You agree not to indicate compatibility or co-adaptability with any Trademark or Registered Trademark in conjunction with a work containing Open Game Content except as expressly licensed in another, independent Agreement with the owner of such Trademark or Registered Trademark. The use of any Product Identity in Open Game Content does not constitute a challenge to the ownership of that Product Identity. The owner of any Product Identity used in Open Game Content shall retain all rights, title and interest in and to that Product Identity. 8. Identification: If you distribute Open Game Content You must clearly indicate which portions of the work that you are distributing are Open Game Content. 9. Updating the License: Wizards or its designated Agents may publish updated versions of this License. You may use any authorized version of this License to copy, modify and distribute any Open Game Content originally distributed under any version of this License. 10. Copy of this License: You MUST include a copy of this License with every copy of the Open Game Content You Distribute. 11. Use of Contributor Credits: You may not market or advertise the Open Game Content using the name of any Contributor unless You have written permission from the Contributor to do so. 12. Inability to Comply: If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Open Game Content due to statute, judicial order, or governmental regulation then You may not Use any Open Game Material so affected. 13. Termination: This License will terminate automatically if You fail to comply with all terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses shall survive the termination of this License. 14. Reformation: If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. 15. COPYRIGHT NOTICE Open Game License v 1.0a Copyright 2000, Wizards of the Coast, Inc. System Reference Document © 2000, Wizards of the Coast, Inc.; Authors Jonathon Tweet, Monte Cook, Skip Williams, based on original mate- rial by E. Gary Gygax and Dave Arneson.System Reference Document © 2000-2003, Wizards of the Coast, Inc.; Authors Jonathan Tweet, Monte Cook, Skip Williams, Rich Baker, Andy Collins, David Noonan, Rich Redman, Bruce R. Cordell, John D. Rateliff , Thomas Reid, James Wya , based on original material by E. Gary Gygax and Dave Arneson. System Reference Document 5.0 Copyright 2016, Wizards of the Coast, Inc.; Authors Mike Mearls, Jeremy Crawford, Chris Perkins, Rodney Thompson, Peter Lee, James Wyatt, Robert J. Schwalb, Bruce R. Cordell, Chris Sims, and Steve Townshend, based on original material by E. Gary Gygax and Dave Arneson. System Reference Document 5.1 Copyright 2016, Wizards of the Coast, Inc.; Authors Mike Mearls, Jeremy Crawford, Chris Perkins, Rodney Thompson, Peter Lee, James Wyatt, Robert J. Schwalb, Bruce R. Cordell, Chris Sims, and Steve Townshend, based on original material by E. Gary Gygax and Dave Arneson. System Reference Document Copyright 2000-2003, Wizards of the Coast, Inc.; Authors Jonathan Tweet, Monte Cook, Skip Williams, Rich Baker, Andy Collins, David Noonan, Rich Redman, Bruce R. Cordell, John D. Rateliff, Thomas Reid, James Wyatt, based on original material by E. Gary Gygax and Dave Arneson. Children of the Grave Copyright © 2023 Children of the Grave Press. END OF LICENSE Designation of Open Game Content:The source code of the files https://childrenofthegrave.com/call.php, https://childrenofthegrave.com/openai.php and https://childrenofthegrave.com/game.js, excluding the above Designation of Product Identity, are designated as Open Game Content, subject to the Open Game License and the Designation of Product Identity, and is located for easy reference in a .txt file at https://childrenofthegrave.com/open-game-content.txt. Each file needs to be in the root directory of the domain where the game is being hosted.