> For the complete documentation index, see [llms.txt](https://wiki.redmodding.org/redengine3-research/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.redmodding.org/redengine3-research/debug-protocol.md).

# Debug Protocol

The game has a debug protocol which can be instantiated by running the game with the "-net" commandline parameter. This lets you interact with the game with other programs.

The address of this socket is <http://localhost:37010/>. It even has an unfinished https debug page but since it isn't finished it can't really be used for anything:

![Debug page](http://i.imgur.com/mUZPufZ.png)

The debug protocol has some various features some of which is utilized in script studio:

* Reload
  * This will recompile and reload all scripts. `self.w3net.send(Request().utf8("scripts").utf8("reload").end())`
* Modlist
  * This returns the list of installed mods. `self.w3net.send(Request().pkglist().end())`
* Rootpath
  * This returns the rooth path of the game. `self.w3net.send(Request().sc_root_path().end())`
* Execute(command)
  * This will execute "command" as if you would input it into the console. `self.w3net.send(Request().remote(cmd).end())`
* Opcode(self, funcname, classname=None)
  * This will return the opcodes for "funcname". `self.w3net.send(Request().opcode(funcname, classname).end())`
* Varlist(self, section="", name="")
  * Searches for config variables. `self.w3net.send(Request().varlist(section, name).end())`
* UnfilteredLocals(self, value)
  * Enables/disables the filtering of the list of locals received from the game `self.w3net.send(Request().sd_unfiltered_locals(value).end())`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wiki.redmodding.org/redengine3-research/debug-protocol.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
