# In-game scripting

## Client-side

* Works like game mods, something like load Rust library into game via API
* Probably WASM-based, though JS is possible too (due to no need for gas)
* For running more complex logic that are not latency-sensitive, like client-side autopilot

## Server-side

* Probably in WASM, with gas fees for limiting allocation of server resources.&#x20;
  * We could also support JS, using Deno or similar
  * Deno vs wasmtime vs wasmer is probably the biggest thing to decide
  * Do we wanna support a Lua or JS API? (backed by something like QuickJS compiled to WASM) Might be easier for people
* Gas is paid in in-game currency
* Would be used for latency-sensitive things, like a PID controller to track another ship

## Challenges

* Need to design a system for integrating the two pieces seamlessly
  * Basic building block: a simple IPC channel between the client and server-side code
* What about "logically in-game client-side code"? e.g. cockpit panels
  * Ideally this can be zero-gas on the server side and zero-latency from the client's perspective
  * Do we need a third category of "in-game UI mode"?


---

# Agent Instructions: 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:

```
GET https://ostomo.gitbook.io/ostomo-notes/in-game-scripting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
