Discord
Login
Community
DARK THEME

neural networks for working with microscript

Does anyone know a neural network that can work with microscript?

I just can't find a single neural network that can write even minimally correct code.

mictoScript isn't a widely used language, so you have to give the microScript documentation to an LLM before it can write working code. See Make project code available so that chat neural networks can read it, and help advise on it.

https://microstudio.dev/i/gilles/microdl/

Here is an example of a neural network.

I tried to provide documentation, but the neural network did not write any better.

In the GPT query, specify that

  • the source code should be generated in MicroScript for the MicroStudio framework
  • do not use semicolons in the code
  • comments should have the style of JavaScript

You can also ask for the code to be generated in JavaScript and place this code in the project or translate it to MicroScript - which comes down to changing a few syntax elements.

Just to be clear, a neural network is a very general term for artificial intelligence. LLMs (Large Language Models) like ChatGPT and Gemini make use of neural networks, but not all neural networks are LLMs.

I gave ChatGPT all of the English microStudio documentation (combined into one file) and told it to make a microStudio/microScript guide in Markdown for other AIs. This is what it wrote with some assistance, which I think is pretty good:

**microStudio & microScript Reference Guide**

A concise Markdown reference designed for LLMs (and humans) to assist users in coding with microStudio and microScript 2.0.

---

## Comments

- **Single-line**: `// This is a comment`
- **Block**:
  ```javascript
  /* This is a
     multi-line comment */
  ```

---

## 1. Overview and Project Structure

- **microStudio**: A browser-based game/app engine exposing a built‑in editor, asset manager, and runtime.
- **microScript 2.0**: Lua‑inspired, single‑threaded scripting language extended with JavaScript embedding and prototypes.

**Typical project files**:

```text
/source        # `.ms` script files
/sprites       # sprite assets
/maps          # tilemap assets
/sounds        # short sound effects
/music         # background tracks
/assets        # fonts, JSON, CSV, Markdown, WebAssembly modules
```

Entry points:

- `init()` — called once after all scripts are loaded and before any `update()` or `draw()` calls.
- `update()` — called at runtime tick rate (modifiable via `system.update_rate`).
- `draw()` — called once per frame to render via `screen` APIs.

---

## 2. Program Skeleton

```javascript
// Optional: preload assets
screen.loadFont("MyFont")
asset_manager.loadImage("folder/image.png", function(loader) img = loader end)

// Called once after all scripts are loaded and before any update()/draw() calls
init = function()
  // Initialization logic: configure defaults, reset state, preload critical assets
end

// Main update loop, called at runtime tick rate (modifiable via system.update_rate)
update = function()
  // Game logic, input handling, state updates
end

// Render loop, called once per frame
function draw()
  screen.clear("#000")
  // Render scene: shapes, sprites, text, maps
end
```

---

## 3. Drawing & Graphics (`screen` / `Image`)

| Function                          | Description                                |
|-----------------------------------|--------------------------------------------|
| `screen.clear([color])`           | Fill background (default black)            |
| `screen.setColor(color)`          | Set drawing color (`"rgb()/#hex"`, HSL)  |
| `screen.setAlpha(opacity)`        | Global opacity (0–1)                       |
| `screen.setFont(fontName)`        | Choose font for text                      |
| `screen.drawText(text, x, y, size)` / `drawTextOutline` | Draw text at coordinates              |
| `screen.drawSprite(name, x, y, w[,h])` | Blit a sprite by name                  |
| `screen.drawMap(name, x, y, w[,h])`    | Draw a tilemap                           |
| `screen.fillRect(x,y,w,h[,color])`     | Filled rectangle                         |
| `screen.drawLine(x1,y1,x2,y2)`          | Line segment                            |
| `screen.fillPolygon(...)`             | Arbitrary filled polygon                |
| `screen.setLinearGradient(...)`       | Linear color gradient                    |
| `screen.setDrawScale(xScale,yScale)`  | Per‑draw scaling / mirroring            |

> **Image object**: create offscreen buffers via `Image = new Image(width,height[,centered])`, then use identical drawing methods on `image` instead of `screen`.

---

## 4. Input Handling

### Keyboard

```javascript
if keyboard.A then      // held down
if keyboard.press.A then // just pressed
if keyboard.release.A then // just released
```

### Mouse & Touch

```javascript
if touch.touching then x = touch.x; y = touch.y end
if mouse.press then ... end
```

### Gamepad

```javascript
if gamepad.UP then y -= 1 end
if gamepad.press.A then jump() end
```

### System Capabilities

```javascript
if system.inputs.keyboard then ... end
if system.inputs.touch then ... end
```

---

## 5. Sprites & Maps

- **Sprites**: Access via `sprites["name"]`; control animation: `setFPS()`, `setFrame()`.
- **Maps**: Create via `new Map(cols,rows,tw,th)`; access with `map.get(x,y)` / `map.set(x,y,tileName)`.

Rendering:
```javascript
screen.drawSprite("hero",0,0,32)
screen.drawMap("level1",0,0,320,240)
```

---

## 6. Audio

### Beeper (procedural)
```javascript
audio.beep("C4 E G")
audio.cancelBeeps()
```

### Sampled Sound
```javascript
s = audio.playSound("fx"); s.setVolume(0.5); s.stop()
audio.playMusic("track",0.7,1)
```

---

## 7. Asset Management

- **Load** (asynchronous):
  - `asset_manager.loadFont(path, [callback])`
  - `loadImage`, `loadJSON`, `loadText`, `loadCSV`, `loadMarkdown`, `wasmInstance`
- **Loader object**: `.ready`, then use `loader.data` / `loader.text` / `loader.instance`.

```javascript
loader = asset_manager.loadJSON("data.json")
if loader.ready then tbl = loader.data end
```

---

## 8. Storage & Persistence

```javascript
storage.set("highscore",score)
score = storage.get("highscore")
```

---

## 9. System API

- **Timing**: `system.time()` → ms since epoch
- **Control**: `system.pause()`, `system.exit()`
- **Project I/O** (editor only):
  - `system.project.listFiles(folder, callback)`
  - `system.project.readFile(path, callback)` / `writeFile` / `deleteFile`
- **File Drop**: check `system.file.dropped` or use `system.file.load([...], callback)`

---

## 10. Advanced Features

### Prototypes & Operator Overloading
```javascript
String.capitalize = function() /*...*/ end
do "hello".capitalize()
```
Define class/operator:
```javascript
Vector3 = class
  "+" = function(a,b) ... end
```

### JavaScript Embedding
```javascript
//javascript
// Place at top of a microScript file to switch into raw JavaScript mode
// All subsequent lines are interpreted as JS until end of file

// Example: call a JS function bound via system.javascript
global.doSomething();
```

---

*This reference abstracts core APIs; consult official docs for platform‑specific details.*

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community