<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: GarySto</title>
    <description>The latest articles on DEV Community by GarySto (@garysto).</description>
    <link>https://dev.to/garysto</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4174260%2F7b5e1f17-f17d-4d5a-8697-8f3af2e6c601.png</url>
      <title>DEV Community: GarySto</title>
      <link>https://dev.to/garysto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/garysto"/>
    <language>en</language>
    <item>
      <title>Why I Run AI at Home, and LM Studio Tips for Beginners</title>
      <dc:creator>GarySto</dc:creator>
      <pubDate>Thu, 19 Nov 2026 17:39:46 +0000</pubDate>
      <link>https://dev.to/garysto/why-i-run-ai-at-home-and-lm-studio-tips-for-beginners-1c1k</link>
      <guid>https://dev.to/garysto/why-i-run-ai-at-home-and-lm-studio-tips-for-beginners-1c1k</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://garystow.co.uk/articles/why-i-run-ai-at-home-and-lm-studio-tips-for-beginners/" rel="noopener noreferrer"&gt;garystow.co.uk&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I grew up poor, homeless poor, and that still shapes how I think about money. What might be £20 to one person can be a week's worth of food for another, so when I started building with AI, I wanted to prove it could be done without a monthly bill that climbs every time you use it. Running AI on my own PC, with no token cost, is a big part of that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Control, and finding out if I could
&lt;/h3&gt;

&lt;p&gt;Cost was only part of it, because I also wanted control. I wanted to build my own things and understand what it actually takes to run a good AI system, rather than just renting one.&lt;/p&gt;

&lt;p&gt;If I'm honest, I also wanted to know whether I could do it at all. I often feel like the idiot in the room when people start using big words, and I prefer the direct, simple approach. Building my own local AI, which I called Wade, was a way of finding out whether I was smart enough for this kind of thing.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I'm running it on
&lt;/h3&gt;

&lt;p&gt;My PC has a 16GB graphics card and 32GB of memory, which is enough to run mid-sized models comfortably. I'd love to run bigger ones, but my hardware sets the limit, and that's worth knowing before you start.&lt;/p&gt;

&lt;p&gt;These are the models I have in LM Studio right now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT-OSS 20B&lt;/strong&gt; from OpenAI, the biggest one I run, about 11GB, usually loaded with a 32,768-token context window&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Qwen2.5 Coder 7B Instruct&lt;/strong&gt;, a smaller coding model at about 4.4GB&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Qwen2.5 Coder 14B&lt;/strong&gt;, a bigger coding model at about 8.4GB&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Qwen2.5 14B Instruct 1M&lt;/strong&gt;, a general model built for very long inputs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemma 4 E4B&lt;/strong&gt; from Google, a small, quick model at about 5.9GB&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nomic Embed Text v1.5&lt;/strong&gt;, a tiny model used for searching and matching text rather than chatting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LM Studio runs as a local server on my PC, so my scripts talk to it the same way they'd talk to a paid AI service, except nothing leaves the machine and nothing gets billed. My website's automation team uses GPT-OSS 20B for its writing and checking jobs.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Wade does every day
&lt;/h3&gt;

&lt;p&gt;Wade helps manage my automated trading project and my website. Day to day, it keeps me on track with my personal project tasks, things like submitting pages to Google for indexing, writing articles and staying on top of where the website is against its goals. I wrote up exactly how I built it in &lt;a href="https://garystow.co.uk/articles/build-your-own-local-ai-assistant/" rel="noopener noreferrer"&gt;how to actually build your own local AI assistant&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  My first mistake with LM Studio
&lt;/h3&gt;

&lt;p&gt;I came into LM Studio feeling confident, because I'd already built agents with other AI tools. That confidence lasted about a minute, because I didn't have a clue where to click or what I was looking at. I loaded models that weren't right for my PC before I'd even started, and in the end I had to ask Claude which ones I should actually be downloading.&lt;/p&gt;

&lt;h3&gt;
  
  
  My advice for trying it for the first time
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Understand its limits.&lt;/strong&gt; A local model won't behave exactly like the big paid ones, and knowing that up front saves a lot of frustration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check your hardware first.&lt;/strong&gt; Your graphics card's memory decides which models will run well, so match the model size to it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask your other AI for help.&lt;/strong&gt; There's a lot in LM Studio, but in reality you only need a few things, and the AI tools you already use can point you to them quickly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Start with one job.&lt;/strong&gt; Get one job working properly first, then build on it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch the context window.&lt;/strong&gt; When my local model kept failing on bigger jobs, the fix was widening its context and trimming each request down to only what that job required.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The honest bit
&lt;/h3&gt;

&lt;p&gt;I love that there's no token cost, and I should probably use Wade more than I do, but I like Claude too much. In practice I use both: Wade for the jobs it does well and cheaply at home, and Claude for heavier coding and problem solving. Knowing which tool fits which job is a skill in itself.&lt;/p&gt;

&lt;p&gt;If cost is what's holding you back from AI, I wrote about exactly that in &lt;a href="https://garystow.co.uk/articles/local-ai-without-the-token-bill/" rel="noopener noreferrer"&gt;no, you don't need to spend thousands a month to actually use AI&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I write about practical AI for marketers and building with free tools at &lt;a href="https://garystow.co.uk/" rel="noopener noreferrer"&gt;garystow.co.uk&lt;/a&gt;. This piece first appeared &lt;a href="https://garystow.co.uk/articles/why-i-run-ai-at-home-and-lm-studio-tips-for-beginners/" rel="noopener noreferrer"&gt;there&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Run a Free Local AI Model with LM Studio and Use It from Python</title>
      <dc:creator>GarySto</dc:creator>
      <pubDate>Thu, 05 Nov 2026 20:43:21 +0000</pubDate>
      <link>https://dev.to/garysto/how-to-run-a-free-local-ai-model-with-lm-studio-and-use-it-from-python-1pdj</link>
      <guid>https://dev.to/garysto/how-to-run-a-free-local-ai-model-with-lm-studio-and-use-it-from-python-1pdj</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://garystow.co.uk/guides/how-to-run-a-free-local-ai-model-with-lm-studio-and-use-it/" rel="noopener noreferrer"&gt;garystow.co.uk&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most of the AI work my home automation teams do runs on a model on my own PC, not in the cloud. My website team's weekly review, my news digest and my assistant, which I named Wade, all talk to a local model through LM Studio, so none of that work costs me a penny in tokens. This guide shows you how to set up the same thing from scratch and get your first answer back in Python. The screenshots are from my own copy of LM Studio, and the red boxes show you exactly where to click.&lt;/p&gt;

&lt;h3&gt;
  
  
  Who this guide is for
&lt;/h3&gt;

&lt;p&gt;This is for marketers and other non-developers who want to try AI on their own computer, keep their data at home, or automate small jobs without paying per request. You don't need to know how to code, because you will copy one short script and run it. By the end you will have a model running on your PC, a local server that other programs can talk to, and a Python script that sends it a question and prints the answer.&lt;/p&gt;

&lt;h3&gt;
  
  
  What you'll need
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A Windows PC with a graphics card&lt;/strong&gt;, ideally. Step 1 shows you how to check how much memory your graphics card has, because that decides which models will run well.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LM Studio&lt;/strong&gt;, which is free. Step 3 gives you the right download link.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python&lt;/strong&gt;, which is also free. Step 2 covers installing it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;About 45 minutes&lt;/strong&gt;, plus download time, because models are several gigabytes each.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cost:&lt;/strong&gt; nothing, because LM Studio and Python are both free.&lt;/p&gt;

&lt;h3&gt;
  
  
  A quick word on model sizes
&lt;/h3&gt;

&lt;p&gt;You will see model names like &lt;code&gt;GPT-OSS 20B&lt;/code&gt; or &lt;code&gt;Qwen2.5 Coder 7B&lt;/code&gt;. The number with a B is the model's size in billions of parameters. Parameters are the numbers a model learned during training, and they are what it uses to work out its answers. As a rough rule, more parameters means a more capable model, but also a bigger download and more memory needed to run it. A 20B model has 20 billion parameters.&lt;/p&gt;

&lt;p&gt;Models are usually shrunk for home use with a process called quantization. You will see labels like &lt;code&gt;Q4_K_M&lt;/code&gt; next to a model, which means each parameter has been squeezed into about four bits. In practice, the download size LM Studio shows you is the best guide to how much memory the model needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Check how much memory your graphics card has
&lt;/h3&gt;

&lt;p&gt;The model has to fit into memory to run, and it runs far faster when it fits into your graphics card's own memory, called VRAM, rather than your PC's normal memory.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press &lt;strong&gt;Ctrl&lt;/strong&gt;, &lt;strong&gt;Shift&lt;/strong&gt; and &lt;strong&gt;Esc&lt;/strong&gt; together to open Task Manager.&lt;/li&gt;
&lt;li&gt;Click the &lt;strong&gt;Performance&lt;/strong&gt; tab. If you only see a small window, click &lt;strong&gt;More details&lt;/strong&gt; at the bottom first.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;GPU&lt;/strong&gt; in the left-hand list. If you have more than one, choose the one that isn't your processor's built-in graphics.&lt;/li&gt;
&lt;li&gt;Find &lt;strong&gt;Dedicated GPU memory&lt;/strong&gt; in the details below the graphs. That number is your VRAM.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; a figure such as 8GB, 12GB or 16GB. Mine is an AMD Radeon RX 7800 XT with 16GB, alongside 32GB of normal system memory. Write your number down, because you will use it in Step 4.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Install Python
&lt;/h3&gt;

&lt;p&gt;Python is the programming language your script will use.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the official &lt;a href="https://www.python.org/downloads/" rel="noopener noreferrer"&gt;Python downloads page&lt;/a&gt; and click the yellow download button for Windows.&lt;/li&gt;
&lt;li&gt;Open the file you downloaded and follow the prompts. Python's Windows download has changed over the last year, so your screens may differ slightly from older guides. If you see a box labelled &lt;strong&gt;Add python.exe to PATH&lt;/strong&gt;, tick it, because without it Windows can't find Python later.&lt;/li&gt;
&lt;li&gt;When it has finished, press the Windows key, type &lt;code&gt;PowerShell&lt;/code&gt;, and press Enter to open it.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;py --version&lt;/code&gt; and press Enter.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; a line starting with the word Python followed by a version number. If you see that, Python is ready.&lt;/p&gt;

&lt;p&gt;On Windows I always type &lt;code&gt;py&lt;/code&gt; rather than &lt;code&gt;python&lt;/code&gt; to run Python, because the Microsoft Store can grab the word &lt;code&gt;python&lt;/code&gt; and open the Store instead of running your script. Every command in this guide uses &lt;code&gt;py&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Install LM Studio, not Bionic
&lt;/h3&gt;

&lt;p&gt;LM Studio now makes two different apps, and the download page offers both. &lt;strong&gt;LM Studio&lt;/strong&gt; is the classic app this guide uses, with the model library and the local server. &lt;strong&gt;Bionic&lt;/strong&gt; is a newer, separate app from the same team, built as an AI agent. LM Studio's own announcement describes Bionic as a separate app and says you can keep using LM Studio alongside it for advanced configuration, so download the classic app for this guide.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the &lt;a href="https://lmstudio.ai/download" rel="noopener noreferrer"&gt;LM Studio download page&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click the button labelled &lt;strong&gt;Download LM Studio for Windows&lt;/strong&gt;, which shows a version number, rather than the button for Bionic. The direct link is &lt;a href="https://lmstudio.ai/download/latest/win32/x64" rel="noopener noreferrer"&gt;LM Studio for Windows&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Open the file and install it like any other program, then open LM Studio.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; the LM Studio window, with a column of icons down the left-hand side. Here is what each one does, because you will use them in the next steps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftiujr2yzwoyxrr0vavnc.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftiujr2yzwoyxrr0vavnc.webp" alt="LM Studio's left-hand icons with Chat, Developer, My Models and Model Search marked 1 to 4" width="800" height="872"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Find a model that fits your PC
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;Model Search&lt;/strong&gt; icon on the left, which looks like a robot with a magnifying glass, icon 4 in the picture above.&lt;/li&gt;
&lt;li&gt;Type a model name into the search box, marked 1 below, or browse the staff picks list.&lt;/li&gt;
&lt;li&gt;Click a model to see its details. Check its size in parameters, marked 2, and its download size, marked 3.&lt;/li&gt;
&lt;li&gt;Look at the badge under the download options, marked 4. LM Studio checks your hardware and tells you how well the model will fit.&lt;/li&gt;
&lt;li&gt;If it fits, click &lt;strong&gt;Download&lt;/strong&gt;, marked 5, and wait for it to finish.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi1gfbwszcvqzt6pkz84d.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi1gfbwszcvqzt6pkz84d.webp" alt="LM Studio Model Search showing the search box, the 27B parameter count, the 17.74 GB download size, the Partial GPU Offload Possible badge and the Download button marked 1 to 5" width="799" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my screenshot the model is 17.74GB and the badge says &lt;strong&gt;Partial GPU Offload Possible&lt;/strong&gt;. That means it is too big for my 16GB graphics card on its own, so LM Studio would run part of it on the card and the rest in normal memory. It works, but it runs noticeably slower.&lt;/p&gt;

&lt;p&gt;My simple rule is to pick a model whose download size is a few gigabytes smaller than your VRAM from Step 1, because the model needs some room to work as well. That is why my main model is &lt;code&gt;openai/gpt-oss-20b&lt;/code&gt;, an 11.28GB download that fits comfortably on my 16GB card. For help with code I use &lt;code&gt;qwen2.5-coder-7b-instruct&lt;/code&gt;, which is only 4.36GB. If you have 8GB of VRAM, start with a 7B or 8B model. Look for the word &lt;strong&gt;instruct&lt;/strong&gt; in the name, because those models are built to follow instructions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Load the model and chat with it
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;Chat&lt;/strong&gt; icon on the left, icon 1 in the Step 3 picture.&lt;/li&gt;
&lt;li&gt;Click the model picker at the top of the window, marked 1 below, and choose the model you downloaded. The first load can take a minute.&lt;/li&gt;
&lt;li&gt;Once it has loaded, type a message such as "say hello" in the box at the bottom and press Enter.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7c30bju1sbuo2r95xxdy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7c30bju1sbuo2r95xxdy.webp" alt="LM Studio model picker with the picker bar, the Memory Consumption figure and the model sizes column marked 1 to 3" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; a reply appears in the chat. The picker also shows &lt;strong&gt;Memory Consumption&lt;/strong&gt;, marked 2, so you can see how much memory the loaded model is using, and box 3 lists the size of every model you have downloaded. If you get a reply, the model works on your machine, and everything from here is about letting other programs use it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Switch on Developer mode
&lt;/h3&gt;

&lt;p&gt;The local server lives in LM Studio's developer tools, which are hidden until you switch them on.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;Settings&lt;/strong&gt; cog at the very bottom of the left-hand icons, marked 1 below.&lt;/li&gt;
&lt;li&gt;In the Settings window, click &lt;strong&gt;Developer&lt;/strong&gt; in the left-hand list, marked 2.&lt;/li&gt;
&lt;li&gt;Next to &lt;strong&gt;Developer mode&lt;/strong&gt;, click &lt;strong&gt;ON&lt;/strong&gt;, marked 3, so it turns blue.&lt;/li&gt;
&lt;li&gt;Close the Settings window with the &lt;strong&gt;X&lt;/strong&gt; in its top right corner.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn2qado8mc6wisvo8u9t7.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn2qado8mc6wisvo8u9t7.webp" alt="LM Studio Settings with the Settings cog, the Developer section and the Developer mode switch marked 1 to 3" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: Start the local server
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;Developer&lt;/strong&gt; icon on the left, which looks like a square box with a small arrow, like a triangle, inside it, marked 1 below.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Local Server&lt;/strong&gt; at the top of the menu, marked 2.&lt;/li&gt;
&lt;li&gt;Click the switch next to &lt;strong&gt;Status&lt;/strong&gt;, marked 3, so it shows &lt;strong&gt;Status: Running&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Check the address next to &lt;strong&gt;Reachable at&lt;/strong&gt;, marked 4. Mine is &lt;code&gt;http://127.0.0.1:1234&lt;/code&gt;. The &lt;code&gt;127.0.0.1&lt;/code&gt; part is your own PC, which programs also call &lt;code&gt;localhost&lt;/code&gt;, and &lt;code&gt;1234&lt;/code&gt; is the port number.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc54vpdn37mhbam7lox3c.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc54vpdn37mhbam7lox3c.webp" alt="LM Studio Developer Local Server with the Developer icon, Local Server, the Status Running switch, the Reachable at address and the endpoint tabs marked 1 to 5" width="799" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Box 5 shows the types of connection LM Studio supports: its own &lt;strong&gt;LM Studio API&lt;/strong&gt;, &lt;strong&gt;OpenAI-compatible&lt;/strong&gt; and &lt;strong&gt;Anthropic-compatible&lt;/strong&gt;. The OpenAI-compatible option is the one this guide uses. It means LM Studio understands the same requests as OpenAI's service, which is why so many tools can use it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 8: Check the server from PowerShell
&lt;/h3&gt;

&lt;p&gt;Before writing any code, prove the server answers.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press the Windows key, type &lt;code&gt;PowerShell&lt;/code&gt;, and press Enter.&lt;/li&gt;
&lt;li&gt;Copy this command, paste it into PowerShell, and press Enter:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(Invoke-RestMethod -Uri "http://localhost:1234/v1/models").data.id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; a list of your models' identifiers, one per line, such as &lt;code&gt;openai/gpt-oss-20b&lt;/code&gt;. Write down the one you want to use exactly as shown, because your script must match it letter for letter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 9: Install the one library you need
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the same PowerShell window, paste this command and press Enter:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;py -m pip install requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;requests&lt;/code&gt; is a small, popular library for talking to web addresses, and it is all you need here. When it finishes, you will see a line starting with &lt;strong&gt;Successfully installed&lt;/strong&gt;, or a message saying it is already installed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 10: Write and run your first script
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open Notepad and paste in the script below.&lt;/li&gt;
&lt;li&gt;Change the &lt;code&gt;MODEL&lt;/code&gt; line to the identifier you wrote down in Step 8.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;File&lt;/strong&gt;, then &lt;strong&gt;Save as&lt;/strong&gt;. Set &lt;strong&gt;Save as type&lt;/strong&gt; to &lt;strong&gt;All files&lt;/strong&gt;, name it &lt;code&gt;ask_local_ai.py&lt;/code&gt;, and save it in a folder you can find, such as &lt;code&gt;C:\Projects\local-ai&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sys
import requests

sys.stdout.reconfigure(encoding="utf-8", errors="replace")

URL = "http://localhost:1234/v1/chat/completions"
MODEL = "openai/gpt-oss-20b"

question = "Give me three ideas for a blog post about PPC reporting."

response = requests.post(URL, json={
    "model": MODEL,
    "messages": [
        {"role": "system", "content": "You are a helpful marketing assistant. Answer in British English."},
        {"role": "user", "content": question},
    ],
    "temperature": 0.3,
}, timeout=400)

if response.status_code &amp;gt;= 400:
    print("LM Studio said:", response.text[:1000])
    response.raise_for_status()

print(response.json()["choices"][0]["message"]["content"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;In PowerShell, move into that folder by typing &lt;code&gt;cd C:\Projects\local-ai&lt;/code&gt; and pressing Enter.&lt;/li&gt;
&lt;li&gt;Run the script by typing &lt;code&gt;py ask_local_ai.py&lt;/code&gt; and pressing Enter.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; after a short wait, three blog post ideas print in the window. That is your PC answering, with nothing sent to the cloud.&lt;/p&gt;

&lt;p&gt;A few lines in that script are there because of problems I hit, and they are worth keeping. The &lt;code&gt;sys.stdout.reconfigure&lt;/code&gt; line stops a crash on Windows when the answer contains characters such as curly quotes or emoji. The &lt;code&gt;timeout=400&lt;/code&gt; setting gives the model time to finish, because local models are slower than cloud ones. Printing &lt;code&gt;response.text&lt;/code&gt; when something fails shows you LM Studio's own explanation, which is far more useful than a bare error code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 11: Make it useful
&lt;/h3&gt;

&lt;p&gt;Once the basic script works, change the &lt;code&gt;question&lt;/code&gt; line to something you do every week, such as summarising a pasted report or tidying up a list of keywords. My website team reads its own data files, puts them into the question, and asks the local model to spot what changed, and that whole review runs every Friday evening without costing anything.&lt;/p&gt;

&lt;p&gt;My biggest disappointment with local AI is that the really strong models need much better hardware than most of us have at home. The models that do fit are still more than good enough for everyday jobs like these.&lt;/p&gt;

&lt;h3&gt;
  
  
  If it goes wrong
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"400 Client Error: Bad Request".&lt;/strong&gt; This was my most stubborn error. The script above prints what LM Studio actually says. In my case the cause was a model identifier that didn't match exactly, so compare the &lt;code&gt;MODEL&lt;/code&gt; line with the list from Step 8.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Connection refused", or the script waits forever.&lt;/strong&gt; The server isn't running or no model is loaded. Check &lt;strong&gt;Status: Running&lt;/strong&gt; on the &lt;strong&gt;Local Server&lt;/strong&gt; page from Step 7, then run the check in Step 8 again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There is no Developer icon.&lt;/strong&gt; Developer mode is off. Switch it on as in Step 6.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A crash mentioning "UnicodeEncodeError" or "charmap".&lt;/strong&gt; Windows is trying to print characters it doesn't expect. Keep the &lt;code&gt;sys.stdout.reconfigure&lt;/code&gt; line in your script. If one script runs another, also set the environment variable &lt;code&gt;PYTHONIOENCODING&lt;/code&gt; to &lt;code&gt;utf-8&lt;/code&gt; for the one being run, which fixed crashes across my whole website team.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Answers are painfully slow.&lt;/strong&gt; The model is probably too big for your graphics card, so LM Studio is running part of it in normal memory. Go back to Step 4 and choose a smaller model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;py&lt;/code&gt; isn't recognised.&lt;/strong&gt; Python isn't installed properly. Close PowerShell, run the download from Step 2 again, tick &lt;strong&gt;Add python.exe to PATH&lt;/strong&gt; if you see it, then open a new PowerShell window and try &lt;code&gt;py --version&lt;/code&gt; again.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Stuck? Copy this prompt into an AI assistant
&lt;/h3&gt;

&lt;p&gt;If something isn't working and the list above doesn't fix it, paste this prompt into Claude, Copilot or ChatGPT. Fill in the square brackets, and attach a screenshot of LM Studio or the PowerShell window.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I am following a beginner's guide to run a local AI model in LM Studio on Windows and call it from a Python script.
I am not a developer, so please explain each fix in simple numbered steps and tell me exactly where to click or what to type.
Where I am stuck: [which step, for example "Step 10, running py ask_local_ai.py"].
The exact error or what I see: [paste the full error message from PowerShell].
My setup: Windows [10 or 11], graphics card [name] with [number]GB of VRAM, LM Studio version [shown at the top of the window], model [identifier from Step 8].
The Local Server page says: [Status: Running or not, and the Reachable at address].
What I have already tried: [anything you have changed].
Ask me questions if you need more information before suggesting a fix.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Where to go next
&lt;/h3&gt;

&lt;p&gt;If you want the bigger picture of why I run AI at home, read &lt;a href="https://garystow.co.uk/articles/why-i-run-ai-at-home-and-lm-studio-tips-for-beginners/" rel="noopener noreferrer"&gt;why I run AI at home, and LM Studio tips for beginners&lt;/a&gt;. For the cost side, &lt;a href="https://garystow.co.uk/articles/local-ai-without-the-token-bill/" rel="noopener noreferrer"&gt;local AI without the token bill&lt;/a&gt; explains what running locally saves, and &lt;a href="https://garystow.co.uk/articles/build-your-own-local-ai-assistant/" rel="noopener noreferrer"&gt;build your own local AI assistant&lt;/a&gt; shows how I turned this into Wade.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;LM Studio: &lt;a href="https://lmstudio.ai/download" rel="noopener noreferrer"&gt;Download page&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LM Studio Blog: &lt;a href="https://lmstudio.ai/blog/introducing-lm-studio-bionic" rel="noopener noreferrer"&gt;Introducing LM Studio Bionic&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LM Studio Docs: &lt;a href="https://lmstudio.ai/docs/app/api/endpoints/openai" rel="noopener noreferrer"&gt;OpenAI compatibility endpoints&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LM Studio Docs: &lt;a href="https://lmstudio.ai/docs/developer/core/server" rel="noopener noreferrer"&gt;Local server&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Python: &lt;a href="https://www.python.org/downloads/" rel="noopener noreferrer"&gt;Downloads&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NVIDIA Blog: &lt;a href="https://blogs.nvidia.com/blog/ai-decoded-lm-studio" rel="noopener noreferrer"&gt;How to accelerate larger LLMs locally with LM Studio&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Python Requests: &lt;a href="https://requests.readthedocs.io/en/latest/user/quickstart/" rel="noopener noreferrer"&gt;Quickstart&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;I write about practical AI for marketers and building with free tools at &lt;a href="https://garystow.co.uk/" rel="noopener noreferrer"&gt;garystow.co.uk&lt;/a&gt;. This piece first appeared &lt;a href="https://garystow.co.uk/guides/how-to-run-a-free-local-ai-model-with-lm-studio-and-use-it/" rel="noopener noreferrer"&gt;there&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Actually Build Your Own Local AI Assistant</title>
      <dc:creator>GarySto</dc:creator>
      <pubDate>Thu, 29 Oct 2026 21:35:47 +0000</pubDate>
      <link>https://dev.to/garysto/how-to-actually-build-your-own-local-ai-assistant-4cfo</link>
      <guid>https://dev.to/garysto/how-to-actually-build-your-own-local-ai-assistant-4cfo</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://garystow.co.uk/articles/build-your-own-local-ai-assistant/" rel="noopener noreferrer"&gt;garystow.co.uk&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A few weeks ago I had nothing, no local AI setup, no idea where to even start, just a genuine question: could I build a proper voice assistant using only free tools. Here's the actual path, assuming you're starting from exactly nowhere.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start with your hardware, before you install anything
&lt;/h3&gt;

&lt;p&gt;This is the step everyone skips and it's the one that decides everything else. Local AI models don't run in the cloud, they run on your actual graphics card, and two numbers matter more than anything else.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VRAM&lt;/strong&gt;, the dedicated memory on your graphics card. This is what actually holds the model while it's thinking. More VRAM means bigger, smarter models running at full speed. Less VRAM means the model either doesn't fit at all, or spills over into your regular system memory, which is dramatically slower.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System RAM&lt;/strong&gt;, your computer's general memory. Less critical than VRAM for speed, but you want headroom here too, 32GB is comfortable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open Task Manager, go to Performance, click your GPU, and you'll see your dedicated VRAM figure right there. Then check whether you're on Nvidia or AMD. This matters because almost every tutorial online assumes Nvidia, using something called CUDA. If you're on AMD like me, that path isn't available, but it's not a dead end, it just means a different backend called Vulkan, which works properly and is built into the software you're about to install.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing LM Studio
&lt;/h3&gt;

&lt;p&gt;This is the actual engine everything else sits on top of.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to lmstudio.ai and download it. Make sure you get the plain version, there's a separate account-gated product on the same site called Bionic, that's not what you want.&lt;/li&gt;
&lt;li&gt;Install it and open it up.&lt;/li&gt;
&lt;li&gt;Load any small model to start (more on picking one below), ask it a basic question, and check Task Manager, Performance, your GPU, while it's replying. If you see GPU usage spike, it's actually using your graphics card properly rather than falling back to your CPU.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Picking your first model
&lt;/h3&gt;

&lt;p&gt;This is where people freeze, so here's the actual rule of thumb I use. Stick to models published by the model's original maker, so names like Qwen or openai, or by a group called lmstudio-community, who package models properly for this exact use case. Before downloading, check for a green badge saying full GPU offload possible, that confirms it'll actually fit on your card. And on quantisation, the technical-sounding number and letters after the model name, Q4_K_M is the standard, sensible default, a solid balance of speed, quality, and file size, don't overthink it beyond that at the start.&lt;/p&gt;

&lt;p&gt;On my own machine right now I've got a small model for quick general chat, a 14B all-rounder, a dedicated coding model, and a larger 20B model that's become my actual daily driver, all running through this same setup. Start with something smaller than that, get it working end to end, then upgrade once you trust the process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Turning it on so other things can actually talk to it
&lt;/h3&gt;

&lt;p&gt;Right now your model only talks to you inside LM Studio's own chat window. To let something like a voice assistant actually reach it, you need the Local Server.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In LM Studio, find the Developer tab.&lt;/li&gt;
&lt;li&gt;Switch Local Server to running. You'll see an address, something like a local web address ending in colon 1234, that's the door everything else knocks on.&lt;/li&gt;
&lt;li&gt;Leave Just-in-Time model loading switched on, this loads a model only when something actually asks for it, rather than eating your VRAM constantly.&lt;/li&gt;
&lt;li&gt;Set an auto-unload time if you plan on using more than one model, mine's set to an hour of inactivity.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Worth knowing honestly, if you switch between two different models regularly like I do, one for chat and one for code, only one properly fits in memory at a time on a 16GB card, so there's a genuine ten to thirty second wait the first time you switch. Not a bug, just physics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Giving it a personality, the fun bit
&lt;/h3&gt;

&lt;p&gt;Inside LM Studio there's a System Prompt field, this is a set of instructions the model reads before every single reply, and it's how a generic model becomes something that actually feels like your assistant rather than a chatbot. Mine's built in two modes, one for casual back and forth with real personality, and a completely separate one that drops that personality entirely and writes in my own voice instead whenever it's producing something meant to go out under my name. Worth deciding early which of those you actually need.&lt;/p&gt;

&lt;h3&gt;
  
  
  What to actually type once it's running
&lt;/h3&gt;

&lt;p&gt;Start simple. Ask it to introduce itself, see if the personality you set actually comes through. Ask it something you already know the answer to, to confirm it's genuinely working. Then, and this is the one that matters most for trust, ask it something it has no way of actually knowing, and watch what it does. If it confidently makes something up rather than telling you it doesn't know, that's the very first thing worth fixing before you build anything else on top of it.&lt;/p&gt;

&lt;p&gt;On LinkedIn I showed a live demo of this in action, worth a look if you want to see how it actually responds in real time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Teaching it to actually listen, without a click
&lt;/h3&gt;

&lt;p&gt;Everything so far still needs you to type. Getting it to genuinely listen, the way Wade does, needs something called a wake word, a tool called openWakeWord handles the actual detection. Here's a real snag worth knowing before you get your hopes up, there's no pre-trained wake phrase for whatever name you've picked for your own assistant. You get a short, fixed list, Alexa, Hey Mycroft, Hey Jarvis, that's genuinely it unless you train your own from scratch. Mine ended up answering to Hey Jarvis, still makes me laugh given the name I actually gave him.&lt;/p&gt;

&lt;p&gt;Worth knowing too, once it's wired up, if wake detection feels unreliable, check your actual microphone before you touch a line of code. Mine looked completely normal in every settings menu and was quietly too quiet to be picked up properly, swapping to a proper USB headset mic fixed detection completely, no amount of code tuning would have solved it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Giving it ears and a voice
&lt;/h3&gt;

&lt;p&gt;Faster-Whisper handles turning your actual speech into text, running fully on your own machine, no cloud involved. Piper handles the reverse, turning replies back into a spoken voice, also entirely local. Worth setting expectations honestly here, free local voices have a real ceiling on how expressive and natural they sound compared to paid cloud options, it's a genuine trade-off for staying completely free, not a flaw you've caused.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tying it all together
&lt;/h3&gt;

&lt;p&gt;This is the part where it stops being configuration and becomes real software engineering. A Python backend, using something called Flask, has to actually manage the whole loop, listening for the wake word, capturing your voice, sending it to Whisper, passing the result to your model, sending the reply to Piper, and displaying all of it somewhere you can see, in my case a HUD I built from scratch using HTML, CSS and JavaScript.&lt;/p&gt;

&lt;p&gt;And this is honestly where I have to stop holding your hand.&lt;/p&gt;

&lt;p&gt;Everyone's setup from here genuinely differs, your hardware, your microphone, your exact file paths, your chosen wake phrase, enough that writing out generic code steps would do you more harm than good, you'd end up debugging my assumptions instead of building your own thing. This bit takes real trial and error, proper coding, and patience with things breaking in specific, findable ways rather than a big leap forward. I'm genuinely still learning as I go here myself, so I can't pretend I've got a clean, universal path from this point through to a finished voice loop.&lt;/p&gt;

&lt;p&gt;If you've built something like this yourself, or you're further along than me, I'd genuinely love to hear how you approached it. If you're just getting started, you're already closer than you think. Good luck.&lt;/p&gt;

&lt;p&gt;If getting a build like this actually found by anyone matters to you once it's live, &lt;a href="https://garystow.co.uk/articles/website-seo-and-llm-readiness/" rel="noopener noreferrer"&gt;I wrote separately about what makes a site readable to search engines and AI crawlers&lt;/a&gt;, worth a look once you're at the publishing stage.&lt;/p&gt;

&lt;p&gt;Built something similar, or stuck on a step? Email me at &lt;a href="mailto:garystow.hq@gmail.com?subject=Local%20AI%20Assistant"&gt;garystow.hq@gmail.com&lt;/a&gt; — I read everything myself.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I write about practical AI for marketers and building with free tools at &lt;a href="https://garystow.co.uk/" rel="noopener noreferrer"&gt;garystow.co.uk&lt;/a&gt;. This piece first appeared &lt;a href="https://garystow.co.uk/articles/build-your-own-local-ai-assistant/" rel="noopener noreferrer"&gt;there&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>llm</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Build a Live Village Dashboard for Your AI Agents</title>
      <dc:creator>GarySto</dc:creator>
      <pubDate>Fri, 09 Oct 2026 21:50:12 +0000</pubDate>
      <link>https://dev.to/garysto/how-to-build-a-live-village-dashboard-for-your-ai-agents-318b</link>
      <guid>https://dev.to/garysto/how-to-build-a-live-village-dashboard-for-your-ai-agents-318b</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://garystow.co.uk/articles/how-to-build-a-live-village-dashboard-for-your-ai-agents/" rel="noopener noreferrer"&gt;garystow.co.uk&lt;/a&gt;. The free starter code is on &lt;a href="https://github.com/GarySto/village-starter" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Written by Gary Stow with help from AI tools. Every fact is checked and every article is approved by Gary before it goes live.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5qmbra523v1hyn6sga2w.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5qmbra523v1hyn6sga2w.webp" alt="Screenshot of the Gary HQ Village: a cartoon isometric town with website team offices, a Town Hall, a purple wizard tower, houses for web pages and demo trading fields"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I run a lot of automations. One team writes and checks articles for this site, another runs three demo trading strategies, and a supervisor sits over both deciding what needs me. For months the only way to see any of it was a dashboard full of tables. It worked for me, but when my wife or my children asked what I was actually building every evening, a table of job names meant nothing to them.&lt;/p&gt;

&lt;p&gt;So I turned the whole thing into a village. I built it to help explain my work to my family, and the visual approach made it far easier for them to understand than anything I could say. The style is a cross between RimWorld and South Park: I love playing RimWorld, and I have always been a fan of South Park.&lt;/p&gt;

&lt;p&gt;Every page on this site is a house. Every trading strategy is a field that grows or wilts with its results. Every request walks to the Town Hall, and builders are always working on the next house. You can see the live version in &lt;a href="https://garystow.co.uk/village/" rel="noopener noreferrer"&gt;the Village&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://garystow.co.uk/village/" rel="noopener noreferrer"&gt;Open the live Village ↗&lt;/a&gt; &lt;a href="https://garystow.co.uk/agents/#village" rel="noopener noreferrer"&gt;How the village works&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This guide shows you how to build your own, one step at a time. You do not need a game engine, and everything here is free. If you can run a Python script, you can do this.&lt;/p&gt;

&lt;h3&gt;
  
  
  What you need before you start
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Python 3 on your computer&lt;/li&gt;
&lt;li&gt;A text editor (I use VS Code)&lt;/li&gt;
&lt;li&gt;A web browser&lt;/li&gt;
&lt;li&gt;Something that already runs on its own, such as a scheduled script, an AI agent or a bot, that you want to watch&lt;/li&gt;
&lt;li&gt;Optional: a free GitHub Pages website, if you want a public version people can visit&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How the village works
&lt;/h3&gt;

&lt;p&gt;There are only three moving parts, and keeping them separate is what makes this manageable.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your automations write a line to a log file every time they do something.&lt;/li&gt;
&lt;li&gt;A small Python script reads those logs and writes one JSON file describing the village.&lt;/li&gt;
&lt;li&gt;One HTML page reads that JSON file and draws the village on a canvas.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The drawing never talks to your automations directly. That means a bug in the village can never break the real work, and you can rebuild the picture as often as you like.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Make every automation leave a trail
&lt;/h3&gt;

&lt;p&gt;The village can only show what your automations record. Give every script one shared function that adds a line to an activity log. One line of JSON per event, called JSON Lines, is the simplest format there is, because you only ever add to the end of the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
    &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;log_activity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;who&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;outcome&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ok&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;%Y-%m-%d %H:%M&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
               &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;who&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;who&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;outcome&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;outcome&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;activity_log.jsonl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;a&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;log_activity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;writer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Drafted: how to build a village&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Call it at the important moments: a job starting, finishing, failing, or waiting for a human.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Decide what every building means
&lt;/h3&gt;

&lt;p&gt;Before drawing anything, write down what each building stands for. This is the part that makes the village make sense to someone who has never seen your system. Mine looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Town Hall is the supervisor. Every request goes through it.&lt;/li&gt;
&lt;li&gt;Each team has its own district: website on one side, trading on the other. Work from one never walks into the other.&lt;/li&gt;
&lt;li&gt;Houses are web pages. Bigger houses get more visits.&lt;/li&gt;
&lt;li&gt;Fields are trading strategies. They all start the same size, then grow or shrink with their profit or loss.&lt;/li&gt;
&lt;li&gt;People standing outside the Town Hall are requests waiting for my decision.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep a simple lookup from the names in your log to the building where that work happens.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Turn the logs into one data file
&lt;/h3&gt;

&lt;p&gt;Save this as &lt;code&gt;village_data.py&lt;/code&gt;. It reads the last 48 hours of the log and writes the file the page will draw from. Run it on a schedule, or every time the page asks for it (Step 9 does that).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
    &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;

    &lt;span class="n"&gt;LOG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;activity_log.jsonl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;OUT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;village/village_data.json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;BUILDING_FOR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;writer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;workshop&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;checker&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hall&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;publisher&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;site&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;trader&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;field&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;recent_events&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;48&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;cutoff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;events&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;LOG&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;splitlines&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strptime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;%Y-%m-%d %H:%M&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;cutoff&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;time&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;:],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;from&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hall&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;# every job starts at the Town Hall
&lt;/span&gt;                               &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;at&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BUILDING_FOR&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;who&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hall&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]})&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;generated&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timespec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;minutes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pages&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;events&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;recent_events&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fields&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;OUT&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;OUT&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Home page&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;url&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;views&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;84&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;
              &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;strategy_a&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;strategy_b&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The page views can come from any analytics export you already have. Start with made-up numbers and swap in real ones once the picture works.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Draw the ground with isometric tiles
&lt;/h3&gt;

&lt;p&gt;The RimWorld style look comes from isometric tiles: diamonds that are twice as wide as they are tall. One small function turns a grid square into a position on the screen, and everything else is built on top of it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                 &lt;span class="c1"&gt;// one tile: 64 wide, 32 tall&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;toScreen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;               &lt;span class="c1"&gt;// grid square -&amp;gt; pixel position&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;sy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;tile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;colour&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;toScreen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;beginPath&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;moveTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lineTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lineTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lineTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;closePath&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fillStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;colour&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Loop over a grid and call &lt;code&gt;tile&lt;/code&gt; for every square. Use one colour for grass, another for roads, and blue for a river between districts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Draw buildings in a paper cut-out style
&lt;/h3&gt;

&lt;p&gt;A building is three shapes: a darker left wall, a lighter right wall and a roof. Thick black outlines give it the cut-out look. Draw from the back of the map to the front, sorted by &lt;code&gt;x + y&lt;/code&gt;, so nearer buildings cover the ones behind them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;poly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;pts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;beginPath&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nx"&gt;pts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(([&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;py&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lineTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;py&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;moveTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;py&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;closePath&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fillStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lineWidth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;strokeStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stroke&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;shade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;pct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;              &lt;span class="c1"&gt;// lighten or darken a colour&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;2.55&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;pct&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nf"&gt;f&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nf"&gt;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;padStart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;box&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;colour&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;    &lt;span class="c1"&gt;// h = height in pixels&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;toScreen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nf"&gt;poly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt; &lt;span class="nf"&gt;shade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;colour&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
      &lt;span class="nf"&gt;poly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sy&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt; &lt;span class="nf"&gt;shade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;colour&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
      &lt;span class="nf"&gt;poly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;TW&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;TH&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt; &lt;span class="nx"&gt;colour&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add windows, doors and signs once the boxes look right. Resist the urge to make it pretty too early. Get the layout working with plain boxes first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Make the people walk the real work
&lt;/h3&gt;

&lt;p&gt;This is the part that brings it to life. Every event in the data file sends a little person from one building to another. When the supervisor approves something, someone walks from the Town Hall to the executor. When an article goes live, a builder walks to the housing district.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;walkers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;playEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;                &lt;span class="c1"&gt;// ev.from and ev.at are building names&lt;/span&gt;
      &lt;span class="nx"&gt;walkers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BUILDINGS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BUILDINGS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;at&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="na"&gt;t&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;moveWalkers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;              &lt;span class="c1"&gt;// dt = milliseconds since last frame&lt;/span&gt;
      &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;walkers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;dt&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;4000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// 4 seconds a trip&lt;/span&gt;
      &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;walkers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;walkers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;walkers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;walkerPos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
               &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Play one event every few seconds and loop back to the start when you run out. Draw a coloured path for each team's flow, so you can see at a glance that website work and trading work never cross.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: Let the data change the world
&lt;/h3&gt;

&lt;p&gt;Now connect the picture to real numbers. These two rules do most of the work in mine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fieldScale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;net&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;              &lt;span class="c1"&gt;// net = profit or loss in pounds&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;net&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;houseFloors&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;views&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;views&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;views&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clamping matters. Without the limits, one great or terrible week would make a field fill the screen or vanish. Pick limits that keep the village readable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 8: Run the drawing loop
&lt;/h3&gt;

&lt;p&gt;Save the page as &lt;code&gt;village/index.html&lt;/code&gt;, next to the data file, with a &lt;code&gt;&amp;lt;canvas id="village" width="1200" height="750"&amp;gt;&lt;/code&gt; in it. Fetch the data once, then redraw about sixty times a second.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;village&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;DATA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;last&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setTransform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clearRect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setTransform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// grid square 0,0 sits top centre&lt;/span&gt;
      &lt;span class="nf"&gt;drawGround&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nf"&gt;drawBuildings&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nf"&gt;moveWalkers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nf"&gt;drawWalkers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nf"&gt;requestAnimationFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;village_data.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;DATA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nf"&gt;requestAnimationFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;drawGround&lt;/code&gt;, &lt;code&gt;drawBuildings&lt;/code&gt; and &lt;code&gt;drawWalkers&lt;/code&gt; are your own functions built from the pieces above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 9: Serve a private version from your own computer
&lt;/h3&gt;

&lt;p&gt;My private village runs from the same small Flask app as my local dashboard, so it can show everything, including the actual requests waiting for me. Clicking a person outside the Town Hall opens the decision.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;send_from_directory&lt;/span&gt;
    &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;village_data&lt;/span&gt;          &lt;span class="c1"&gt;# the Step 3 script
&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/village/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;village&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;send_from_directory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;village&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/village/village_data.json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;data&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;village_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;      &lt;span class="c1"&gt;# rebuild from the latest logs every time the page asks
&lt;/span&gt;        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;send_from_directory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;village&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;village_data.json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5007&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Flask once with &lt;code&gt;pip install flask&lt;/code&gt;, run the script, then open &lt;code&gt;localhost:5007/village/&lt;/code&gt; in your browser and you are watching your own system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 10: Publish a safe public version
&lt;/h3&gt;

&lt;p&gt;The public version uses the same page with a different data file. Before anything leaves my computer, a function strips out anything private. Requests become a generic title, and money is rounded.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;make_public&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;pub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;pub&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;requests&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;from&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;from&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A decision for Gary&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                           &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;requests&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[])]&lt;/span&gt;
        &lt;span class="n"&gt;pub&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fields&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fields&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pub&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A scheduled task then copies the page and the public data file into my website on a new branch, opens a pull request, and only merges it after an automatic layout check in a headless browser and an SEO checklist both pass. If either check fails, nothing goes live. I wrote about why I make automation check its own work in &lt;a href="https://garystow.co.uk/articles/the-independent-audit-why-i-make-ai-check-its-own-work/" rel="noopener noreferrer"&gt;the independent audit&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 11: Make it readable for everyone
&lt;/h3&gt;

&lt;p&gt;Small pixel text looks great and is impossible to read. Use a large, clear font for labels (I use Atkinson Hyperlegible, which was designed for low vision), strong contrast, and hide the smaller labels when someone zooms out so they never pile on top of each other. Test it on a phone before you share it.&lt;/p&gt;

&lt;h3&gt;
  
  
  What went wrong the first time
&lt;/h3&gt;

&lt;p&gt;Three things caught me out, so you can skip them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Labels overlapped as soon as the village grew. Showing department names only when zoomed in fixed it.&lt;/li&gt;
&lt;li&gt;My first version let trading work walk into the housing district. Separate districts and separate colours for each team's flow made the picture honest.&lt;/li&gt;
&lt;li&gt;My scheduled jobs run without a window, but every git command they started popped up its own black console box. On Windows, start those commands with the &lt;code&gt;CREATE_NO_WINDOW&lt;/code&gt; flag from Python's &lt;code&gt;subprocess&lt;/code&gt; module, or you will get a screen full of flashing windows.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Do I need to know JavaScript to build this?
&lt;/h3&gt;

&lt;p&gt;No. I am self-taught and built mine with help from AI tools. You need to be able to copy code, run it, read the error when it breaks and ask for help with that error. The canvas drawing above is the only JavaScript you need.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is it safe to show my automations in public?
&lt;/h3&gt;

&lt;p&gt;Yes, if the public version gets its own data file. Never point the public page at your private data. Build a function like &lt;code&gt;make_public&lt;/code&gt; that removes names, request details and exact money figures, and check its output before every publish.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I build this without paying for anything?
&lt;/h3&gt;

&lt;p&gt;Yes. Python, Flask, a browser canvas, GitHub Pages and Windows Task Scheduler are all free. If you want an AI assistant in the village too, you can run one at home with no token bill, which I explain in &lt;a href="https://garystow.co.uk/articles/build-your-own-local-ai-assistant/" rel="noopener noreferrer"&gt;how to build your own local AI assistant&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not use a game engine?
&lt;/h3&gt;

&lt;p&gt;You could, but a game engine adds a lot to learn before you see anything. A single HTML page with a canvas loads anywhere, can be hosted for free and is easy for an AI assistant to help you change. Start simple and move to an engine only if you outgrow it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start small
&lt;/h3&gt;

&lt;p&gt;You do not need eleven steps on day one. Get one building and one walking person working from a real log file. Once you see your own automation move across the screen for the first time, you will want to build the rest.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://garystow.co.uk/village/" rel="noopener noreferrer"&gt;See the finished village, live ↗&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you build your own village, I would love to see it. The full version of mine runs live at &lt;a href="https://garystow.co.uk/village/" rel="noopener noreferrer"&gt;garystow.co.uk/village&lt;/a&gt;, and I write about practical AI for marketers at &lt;a href="https://garystow.co.uk/" rel="noopener noreferrer"&gt;garystow.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
