{"id":13435473,"url":"https://github.com/discosultan/quake-console","last_synced_at":"2025-06-21T20:14:10.476Z","repository":{"id":21413027,"uuid":"24731066","full_name":"discosultan/quake-console","owner":"discosultan","description":"Quake-style console for MonoGame","archived":false,"fork":false,"pushed_at":"2022-08-02T14:19:32.000Z","size":9813,"stargazers_count":93,"open_issues_count":2,"forks_count":18,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-24T07:49:37.306Z","etag":null,"topics":["console","monogame"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/discosultan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-02T18:26:49.000Z","updated_at":"2025-04-08T15:35:48.000Z","dependencies_parsed_at":"2022-07-27T02:32:12.256Z","dependency_job_id":null,"html_url":"https://github.com/discosultan/quake-console","commit_stats":null,"previous_names":["discosultan/paradox.console"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/discosultan/quake-console","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fquake-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fquake-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fquake-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fquake-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/discosultan","download_url":"https://codeload.github.com/discosultan/quake-console/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/discosultan%2Fquake-console/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261186796,"owners_count":23121951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console","monogame"],"created_at":"2024-07-31T03:00:35.996Z","updated_at":"2025-06-21T20:14:05.461Z","avatar_url":"https://github.com/discosultan.png","language":"C#","funding_links":[],"categories":["Consoles"],"sub_categories":[],"readme":"# What is this sorcery?\n\nQuake-style console is an in-game command-line interface with swappable command interpreters. It can be used during development to easily manipulate game objects *at runtime* or allow players to enter cheat codes, for example.\n\n\u003e Note that this project is no longer in development. I do try to fix bugs though!\n\n![HelloPython](Documentation/HelloPython.jpg)\n\n- https://www.youtube.com/watch?v=Is2m2oQ68Gc\n- https://www.youtube.com/watch?v=oVWqy16W0ak\n- https://www.youtube.com/watch?v=qJeCu-YB8Os\n\n# Getting Started\n\n- [Building source and samples](#setup1)\n- [Using QuakeConsole](#setup2)\n- [Setting up console to use PythonInterpreter](#setup3)\n- [Setting up console to use ManualInterpreter](#setup4)\n- [Setting up console to use RoslynInterpreter](#setup5)\n\n\n\u003ch2 id=\"setup1\"\u003eBuilding source and samples\u003c/h2\u003e\n\n\nThe following is required to successfully compile the QuakeConsole MonoGame solution:\n\n- Visual studio 2022+\n- .NET 6.0+\n- [DirectX End-User Runtimes (June 2010)](http://www.microsoft.com/en-us/download/details.aspx?id=8109)\n- MonoGame 3.8.1+\n\n\n\u003ch2 id=\"setup2\"\u003eUsing QuakeConsole\u003c/h2\u003e\n\n### Requirements\n\n- MonoGame 3.8.1+\n- .NET 6.0+\n\n### Setup\n\nInstall the console assembly through NuGet:\n\n```powershell\nPM\u003e Install-Package MonoGame.QuakeConsole.WindowsDX\n```\n\nThe console itself is a typical `DrawableGameComponent`. The following steps will go through setting it up in a game.\n\n1) In the `Game` constructor, create the console and add it to the components collection (console itself should be stored in a variable since it must be initialized and manually opened/closed later):\n\n```cs\nConsoleComponent console;\n\npublic Game1()\n{\n  // ...\n  console = new ConsoleComponent(this);\n  Components.Add(console);\n}\n```\n\n2) The console must be opened for it to accept user input. This is usually done in the update method by checking for a key press (the tilde key, for example):\n\n```cs\nprotected override void Update(GameTime gameTime)\n{\n  // ...\n  // manage previous and current keyboard states\n  if (previousKeyboardState.IsKeyUp(Keys.OemTilde) \u0026\u0026 currentKeyboardState.IsKeyDown(Keys.OemTilde))\n    console.ToggleOpenClose();\n}\n```\n\nThis has setup the console shell. For the console to actually do anything useful on user input, an interpreter must be configured (see below).\n\nSometimes it is desirable to prevent other game systems from accepting input while the console window is open. For this, it is required to know if the console is currently open (accepting input) or closed. This can be checked by the  `console.IsAcceptingInput` property.\n\n\n\u003ch2 id=\"setup3\"\u003eSetting up console to use PythonInterpreter\u003c/h2\u003e\n\nPython interpreter can be used to interpret user input as Python code. It is extremely useful to, for example, manipulate game objects *at runtime*.\n\n### Requirements\n\n- MonoGame 3.8.1+\n- .NET 6.0+\n\n### Setup\n\nInstall the interpreter assembly through NuGet (this will also bring in the console if it hasn't been installed already):\n\n```powershell\nPM\u003e Install-Package MonoGame.QuakeConsole.PythonInterpreter.WindowsDX\n```\n\n1) Create the interpreter and set it as the interpreter for the console:\n\n```cs\nvar interpreter = new PythonInterpreter();\nconsole.Interpreter = interpreter;\n```\n\n2) To be able to modify game objects through the console, the objects must be added as variables to the IronPython engine (this creates the connection between the CLR and Python object):\n\n```cs\ninterpreter.AddVariable(\"name\", myVariable);\n```\n\nThe object's public members can now be accessed from the console using the passed variable's name (press ctrl + space [by default] to autocomplete input to known variables/types/members).\n\n\n\u003ch2 id=\"setup4\"\u003eSetting up console to use ManualInterpreter\u003c/h2\u003e\n\nManual interpreter can be used to define commands and their corresponding actions for the console manually. Useful to execute some behavior on command or provide players means to input cheat codes, for example.\n\n### Requirements\n\n- MonoGame 3.8.1+\n- .NET 6.0+\n\n### Setup\n\nInstall the interpreter assembly through NuGet (this will also bring in the console if it hasn't been installed already):\n\n```powershell\nPM\u003e Install-Package MonoGame.QuakeConsole.ManualInterpreter.WindowsDX\n```\n\n1) Create the interpreter and set it as the interpreter for the console:\n\n```cs\nvar interpreter = new ManualInterpreter();\nconsole.Interpreter = interpreter;\n```\n\nA command is essentially a delegate that is invoked when user inputs the name of the command. The delegate provides an array of arguments separated by spaces (similar to arguments in a Windows console application) and optionally can return a string value that is output to the console.\n\n2) To register a command:\n\n```cs\ninterpreter.RegisterCommand(\"name\", action);\n```\n\nwhere action is of type `Action\u003cstring[]\u003e` or `Func\u003cstring[], string\u003e`.\n\nProvides autocompletion for registered command names (ctrl + space by default).\n\n\n\u003ch2 id=\"setup5\"\u003eSetting up console to use RoslynInterpreter\u003c/h2\u003e\n\n\nRoslyn interpreter can be used to interpret user input as C# code using the [Roslyn scripting API](https://github.com/dotnet/roslyn/wiki/Scripting-API-Samples). It is useful to, for example, manipulate game objects *at runtime*.\n\n### Requirements\n\n- MonoGame 3.8.1+\n- .NET 6.0+\n\n### Setup\n\nInstall the interpreter assembly through NuGet (this will also bring in the console if it hasn't been installed already):\n\n```powershell\nPM\u003e Install-Package MonoGame.QuakeConsole.RoslynInterpreter.WindowsDX\n```\n\n1) Create the interpreter and set it as the interpreter for the console:\n\n```cs\nvar interpreter = new RoslynInterpreter();\nconsole.Interpreter = interpreter;\n```\n\n2) To be able to modify game objects through the console, the objects must be added as variables to the C# scripting context:\n\n```cs\ninterpreter.AddVariable(\"name\", myVariable);\n```\n\nThe object's public members can now be accessed from the console using the passed variable's name.\n\n\u003e Due to [an issue at Roslyn side](https://github.com/dotnet/roslyn/issues/3194), global variables *must be accessed through a 'globals' wrapper object*: `globals.myVariable`\n\n\u003e RoslynInterpreter does not provide any autocompletion features.\n\n\n# Assemblies\n\n- **MonoGame.QuakeConsole**: The core project for the console. Contains the behavior associated with handling user input and the visual side of the console's window.\n\n## Interpreters\n\n- **MonoGame.QuakeConsole.PythonInterpreter**: IronPython interpreter for the console shell. Allows manipulating game objects using Python scripting language. Provides autocompletion for loaded .NET types.\n- **MonoGame.QuakeConsole.PythonInterpreter.Tests**: Unit tests covering the expected execution and autocompletion behavior for Python interpreter.\n- **MonoGame.QuakeConsole.ManualInterpreter**: Interpreter for manually defined commands. Provides autocompletion for command names.\n- **MonoGame.QuakeConsole.RoslynInterpreter**: Interpreter using the [Roslyn scripting API](https://github.com/dotnet/roslyn/wiki/Scripting-API-Samples) to execute console input as C# script.\n\n## Samples\n\n- **HelloPython**: Simple sample which sets up the console with Python interpreter, allowing to execute Python code and manipulate a cube at runtime.\n- **Sandbox**: Generic sandbox for testing out various parts of the project. Sets up the console tying together all the interpreters (Python, Roslyn, manual).\n- **Common**: Supporting library providing common functionality for samples.\n\n## Development\n\n### Release a New Version\n\n* Make sure version numbers are updated in .csproj files.\n* Create packages:\n\n```sh\ndotnet pack -c Release MonoGame.QuakeConsole.DesktopGL.sln\ndotnet pack -c Release MonoGame.QuakeConsole.WindowsDX.sln\n```\n\n* Publish packages (substitute `\u003cversion\u003e` with version to be released):\n\n```sh\nVERSION=\u003cversion\u003e\ndotnet nuget push Source/bin/Release/MonoGame.QuakeConsole.DesktopGL.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\ndotnet nuget push Source/bin/Release/MonoGame.QuakeConsole.WindowsDX.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\ndotnet nuget push Interpreters/ManualInterpreter/bin/Release/MonoGame.QuakeConsole.ManualInterpreter.DesktopGL.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\ndotnet nuget push Interpreters/ManualInterpreter/bin/Release/MonoGame.QuakeConsole.ManualInterpreter.WindowsDX.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\ndotnet nuget push Interpreters/PythonInterpreter/bin/Release/MonoGame.QuakeConsole.PythonInterpreter.DesktopGL.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\ndotnet nuget push Interpreters/PythonInterpreter/bin/Release/MonoGame.QuakeConsole.PythonInterpreter.WindowsDX.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\ndotnet nuget push Interpreters/RoslynInterpreter/bin/Release/MonoGame.QuakeConsole.RoslynInterpreter.WindowsDX.$VERSION.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscosultan%2Fquake-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiscosultan%2Fquake-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiscosultan%2Fquake-console/lists"}