Appearance
The VS Code extension
This comes in stage 5.
You write your program in an editor. The extension brings the city to where the code is. It answers two questions without leaving the editor:
- What is my program doing in the live city, and why?
- What would my program do, if I ran it here?
Two modes
| Live | Local | |
|---|---|---|
| What runs | The real city | A city on your own machine |
| Can you stop your program on a line? | No. A live city never waits. | Yes. A local run waits for your program. |
| What it is for | Watching, and finding out what went wrong | Trying a change before you push it |
Decisions next to the code
The history of decisions is also a view in the editor.
Schema — The editor with the extension
main.py
46 best = max(free, key=lambda o: o.fee)47 storage = best.next_storage(car)48 car.go_to(storage.place, ...) 12 times today · earned 31052 def on_low_fuel(event): called 3 times · sent nothingDecisions
tick 3 380 · car 2 → Storage North
"order 881 pays 31" · delivered · +31
"order 881 pays 31" · delivered · +31
tick 3 361 · car 3 → Mart 7
"order pays 40" · broke down · fine
"order pays 40" · broke down · fine
code v31 0 errors
- Choose a decision, and the editor opens the file and the line that sent the command.
- Next to a line that sends commands, the editor shows how often it ran lately and what came of it.
- A handler that was called and sent nothing is marked. This is the usual sign of a quiet mistake.
Errors where they happened
An error in your live program appears in the editor's list of problems, at the right file and line, with the lines your program logged just before it. A new push clears the errors of the old version.
The state of your code
The bar at the bottom of the editor shows which version runs in the city, and whether your newest push was accepted. If it was refused, one click shows why.
A local run in the debugger
One click starts a local run of your program in the editor's debugger.
- You set stopping points as in any program. When your program stops, the city stops too, and you can look at every value.
- The run can hold several companies. You pick the other programs that play against yours.
- You choose where it starts: a new city, your live city as it is now, or a moment of its past.
- A panel shows the map of the local run, with pause, one tick forward, and speed.
Replaying a past moment
From an entry in the history of decisions, you can start a local run at that tick, with the code that is open in your editor.
This answers the question you will have most often: what would my new code have done at the moment my old code lost money?
In a shared city the rest of the city is played back, as described for local runs.
The control panel and the memory
The actions that your live program offers are shown in the editor and can be called from there. You can also read your program's memory.
Help while you write
The editor completes the names of events, commands and readable data, and shows their short texts. Each name links to its place in the API reference.
Signing in
The extension uses an access key, the same kind as the CLI. You create one on the game's website, on the Connect screen.
What it does not do
- It does not stop a live city.
- It does not change the city by itself. It can call your program's actions and send commands, in the same ways the CLI can.
- It shows nothing about another company that the city page would not show.