Previous skills and experience

I have been writing software for more than thirty years. I've learned a range of languages including C, C#, CSS, HTML, Java, JavaScript, Perl, SQL, and Visual Basic. I enjoy learning new languages (I'm currently experimenting with Lisp) both to find new ways of solving of problems, and to see where and how much languages overlap (ignoring syntax, low level features like if statements and for loops are very similar across most popular modern languages).

I dislike boring, repetitive tasks, and try to automate them where possible. My previous role included manually updating HTML pages (which was both boring and error prone), which lead to me creating a new guidance platform for HMRC that eliminated that role. (That also won me an "Innovator of the Year" award).

I worked as a telephone advisor for HMRC's contract centers for more than a decade, answering customer queries by phone and updating customer records in line with guidance and HMRC security policy. This job gave me strong empathy with our customers, and convinced me of the importance of the mission statement "Putting customers at the heart of everything we do."

That role also taught me how to explain complicated technical issues to non-technical people, and how to adjust the level of technical detail in an explanation in realtime based on the recipients reactions.


Laying on the sofa with a book and a kitten. Life is not all terrible.

In other news I've put in an application for a promotion at work, should be about £300/month extra for the same sort of work (mostly programming, although with a bit more authority).


Have I mentioned that I like the "Murderbot Diaries" series of books? I've just finished a re-read and they were still good.

The protagonist is a cyborg with poor social skills due to a history of slavery and abuse. Don't let that put you off, the books are entertaining and give an extreme version of what it feels like inside my head quite a lot of the time.


Each endpoint has:

  • Name (string, human readable, short for preference)
  • Uri
  • LastChecked (Timestamp)
  • LastSuccess (Timestamp)
  • FailedCheckCount (number, default 0)
  • LastAlert (Timestamp?)
  • Enabled (bool, default true)

Timestamps are probably going to be ISO format, but they could just be counts (although storing wallclock time does allow for periodic reminders)

A healthy host has last success equal to last checked.

Each failed check adds one to FailedCheckCount. A successful check resets FailedCheckCount to zero.

If FailedCheckCount is over a specified threshold, then an alert is sent and LastAlert is set.


Not much going on, waiting to hear back about the job application, otherwise same old, same old.



Signed up to Andrews and Arnold last night for their VoIP/SmS service, probably overkill for the monitoring system but at least I'm confident it's not a scam. (Plus, now I'm a customer it might be easier to justify using them as our ISP once the BT contact is done)


All tired right now, not sure why, factors likely to be affecting me include:

  • Depression
  • Antidepressants (and that those two pull in the same direction sucks)
  • Interrupted sleep (woke up a couple of times for the loo, husband snoring)
  • Late night (aimed to go to bed at 23 yesterday, wasn't asleep until at least 00:30)
  • Early morning (Woke up around 06:30, was at work by 07:20, felt at the time that I should have slept more, but also felt that when I have tried to sleep another hour in the morning I've ended up feeling worse)
  • Ate early (Had a sandwich before work, generally has a negative effect on the whole being awake thing)

I've been thinking about getting a "proper" (expensive, mechanical) keyboard for a while, I'm getting close to a requirements list:

  • ISO-UK layout (deal-breaker)
  • Wired (deal-breaker, work security rules require it)
  • "Brown" switches (Tactile (have positive 'yup, I've been pushed' feedback) but not clicky)
  • Number pad
  • Media keys (at least play/pause, volume, next/previous)


I'm in limbo at work, I'm waiting to hear about this promotion but I think someone else is a better fit. Obviously I want the money, but, I dunno, I'd pick them. (Mostly it's that they asked for time to write the docs for a project. Seriously! Who does that! Grab 'em quick before they realise what they're letting themselves in for).

Ah, well.


If I want to build a DOM in C, then I'll need a base Node type, probably an Element type, and a bunch of functions with names starting with dom_, node_, and element_.

Doesn't sound hard in principal...

typedef enum {
  NODE_ELEMENT,
  NODE_TEXT
} NodeType;

typedef struct node {
  struct node* Parent;
  struct node** Children;
} Node;

... except I'm not sure what it gets me.

I want to transform the stuff in the HTML5 spec into something machine readable, so I can parse HTML and then render it.

I keep going round on this, I've got a range of languages available and they've all got advantages and disadvantages. It would probably help me to have a clearer picture of what I want, but that (at least partly) depends on what language I'm thinking in at the time.

C# has got cross platform support (except it can't do GUI on Linux), it's got three really good IDEs (two owned by Microsoft, one with a licensing fee) that make it really smooth to write, but it's big (a carefully engineered "hello world" can get down to maybe 30Mb) and poor to zero JavaScript support.

C has poor Windows support, OK IDE (which will improve once I've learned ctags for vim), good JavaScript support (hello QuickJS), but it's a bit painful to write. I'd need to find/choose a GUI library (or two, one for Linux and WinForms for Windows), and either pick s library or write my own networking code.

I've got two options for "interpreted code on C", JavaScript (via QuickJS), or Loxish (based on Crafting Interpreters). They've both got the same "need to wrap libraries/write low level code" that C does, but with the option of working in a higher level language. The more code I write in the interpreted language the slower the app, but that's balanced against less C work (e.g., exposing low level read()/write() network primatives Vs a fetch() method).

Of the two, it will be easier to get help for JavaScript, but it will be easier to mould Loxish into what I want. I'll need to pull QuickJS in as a dependency either way, but it's not nearly so heavy (and much easier to isolate) if I'm only using it for document scripting.

I think I want to use C+Loxish for the control and the "I built it"-ness, but I'm scared of how much work I'm looking at.

But circling back to the start, I'm going to need to write the HTML parser in something, sooner or later. (Ah-ha! Something in my head just said 'but if I write it in C#, it's easier to reuse '.)



[HttpGet("Inbox")]
[Authorise(Role = "me")]
public GetInbox() => store.Inbox

[HttpPost("Inbox")]
[AllowAnonymous]
public PostInbox(Message m) => store.Inbox.Add(m);

[HttpPost("Outbox")]
[Authorise(Role = "me")]
public PostOutbox(Message m) => m.To.Select(address => network.Post(address, message));

[HttpGet("Outbox")]
[AllowAnonymous]
public GetOutbox() => store.Outbox;



abstract class APObject {

	[JsonPropery("@context")]
	public string Context {get;set;} = "https://www.w3.org/ns/activitystreams";


	[JsonProperty("id")]
	public string? Id {get;set;} = default;

	[JsonProperty("type")]
	public string Type {get;set;}

}

abstract class Activity ; APObject {


}

Every 3 or 4 generations after the previous Empire falls, the next starts to rise. It's happened often enough that some historian is trying to get a natural law named after themselves.

Starting an empire, given the right conditions, is easy. You need a small, well armed, and focused polity; a couple of systems and a strong religion normaly does it, although a burning need to bring 'peace' or 'justice' has also worked.

And 'well armed' doesn't always mean millitray might, although that is considered the easy path. Fierce debating skills, a solid traiding tradition, once even a strong sense of empathy have all started empires.


Bought a keyboard/mouse/headphone set yesterday, took it back to the shop today, it was nearly brilliant, but was actually crap. Really quite disappointing.


I forgot/never really grocked that Lisp identifiers don't have to be alphanumeric. This opens up a bunch of toys, but specifically makes adding attributes to html tags much cleaner; instead of (p (attr (class "info")) "hello world"), I can do something like (p (@ ... (although I think that @ already has meaning attached).


Game thoughts

Thing is, I don't really want a 'game' with winners and losers. I want an interesting simulation of something like a world that I can watch develop, and maybe influence (and maybe see what ifs? for).

I've got techniques (in the sense of "I know what they're called, and roughly what the limits are) to generate landscape ("Diamond/Square" for large scale, simulated erosion for smaller). I can populate the world with agents that have goals and behaviours, and that interact with each other. I think it just feels weird to build it as art.

I'm also not sure what to write it in. JavaScript gives me the browser (although don't forget QuickJS). C# gives me a server. C gives speed (theoretically). Loxish gives me control.

I think I should stay very much focused on writing for myself, rather than for what I think other people might want. Yes, it would be cool to make a world that other people want to play in, but I'd far rather build a world that I want to play in.

I very much want a clean separation between the display and the rest of the code so I can e.g. start using OpenGL later (or sooner).

I've got a fuzzy picture in my head of writing code for agents in a way that allows me to tweak (or rewrite completely) without stopping the main engine. I also want to be running lots of agents, so that stuff is happening all over the map even if the player isn't looking.


Game components

Display

Takes the state of the game and shows it to someone. Could be graphical, drawing the terrain and agents, or could be textural, describing the game state and events.

Engine

Takes the game state at tn and ptoduces the state at tn+1

Terrain Generator

Makes a new world


Store terrain as a single linear array of longs, and use masks/shifts to store data.

Start with terrain being read only after generation, and maybe do something like a piece table later for changes (e.g., roads, landscaping).

Call the surface a torus, with the top/bottom linked and the two sides linked.

I'm assuming some kind of grid here, do I want to use hexes? Do I want to tie actors to the grid, or is it just for terrain?

square grid, tied actors is most simple and therefore least realistic. (Although the grid can be much finer than the actors, which helps hide the simplicity).

Hex grid solves some of the square grid problems (diagonal movement, mostly), but has a chunk of extra work, and ongoing integration/understand issues (plus, most algorithms assume a square grid).

Disconnecting actors from the grid gives them much more freedom, but then we have to handle "what if an actor straddles a border" issues. (Same as the fine grid option above, I guess)

Hmm.


Messing with OpenGL (well, WebGL really) again, it is nice and fast, but it's a bugger to get all the bits lined up right.

Roughly:

  • Objects are made of triangles
  • Triangles are made from vertexes (vertices, but no one says that)
  • One can load a bunch of data up to the GPU, and it stays there. I think this is a Virtual Buffer Object (VBO)
  • Drawing is getting everything set up, then calling 'draw' (Imagine a huge panel with switches, sliders, dials, and a big red button. Toggle the switches, set the dials and sliders, and then press the button. A printer in the corner busts into life.)
  • WebGL doesn't know anything about frames, one just lines up the data, calls draw, and then calls clear when it's time to start the next frame
  • There's a bunch of stuff (model/view/perspective transforms, lighting, shading) that's nearly standard, but not really.

I've implemented diamond- square (whoop!), and the GPU is drawing triangles (double whoop!), I want to get lighting/shading next (Husband says use cross product to get normals, i.e., at any given triangle corner, get the vectors to the other corners and the normal is the cross of that), and then start on camera movement.

I'm starting to get pictures in my head of flying close to the ground around tree covered mountains. This could be really quite cool.


Medium term choices include:

  • scale factor: How big is a heightmap pixel relative to (e.g.) trees, or the camera viewpoint.

  • An I going to actually draw the torus, or am I going to cheat and just draw cpoies at the edge of the map.

    I really like the idea of the torus, and hopefully the transform isn't that expensive (I think it might just be a matrix multiplication, but there's probably trig in there somewhere).

Anyway. Sleepy time, g'd night fair reader.


I've started following a roguelike tutorial, which has been bloody good so far.

The tutorial's code is written in Java, which is well easy to convert to C#. The prose is easy to read and goes into detail where needed (so far I haven't found anything that it should explain that it doesn't explain), and feels like it's written by someone who knows their stuff.

Luckily, I've got the windows console/ANSI/vt100 stuff from the editor, else I'd need to write that all. I'm leaving it in text mode for now, I'm sure I'll start thinking about a web front end sooner or later (but since it's all keystroke driven, I can have an engine sleeping in the server that only wakes up on a POST. I can probably store the state somewhere, and have a pure update function. But that's next version).

The tutorial is very much "here's the minimum you need to get x working", but the x's are things like random dungeons, fighting, separate screens for inventory so it's fairly comprehensive.

I wonder how far I'll get?


This is pretty bad, I lasted less than 15 minutes before running out of energy/motivation at $WORK this morning. I guess I need to do something about that.

(And I'm waiting to hear back about this job application as fast as I can, but even if I get it it's going to me more of the same, only better paid) (And yes, better paid is cool but doesn't actually make the job any better)


The cheap way to port dungeon to the web, I think, is to write a JavaScript terminal emulator.

It looks like terminals have a bit of state (cursor (x,y), colours, and is the cursor visible), and rules like "writing a visible character increases cursor.y by one" (where visible characters have an ASCII code of 32 or more).

Given what I need the terminal for, i think it's going to be easiest to use canvas as the substrate, for easy x,y positioning. Alternatives that I've thought about are tables and grid.

Table based output needs to be generated in one pass, so any overwriting needs to be worked out ahead of time. (Which is roughly parsing to a screen sized buffer and then reading that out to the table.

Grid is easier than table, because each cell is addressed directly, so later cells with the same location overlay older cells (note: set explicit opaque background).

Transport can be basic request/response, send a keystone (converting arrow keys too escape codes) and get the screen back. Given a http2 connection the response time shouldn't be that bad. Using a websocket will cut out some overhead from repeated headers.


Although it might be worth implementing a terminal as an off screen grid of cells, with glyph and colour properties, and then just banging that to the display every so often.

I guess it's the difference between a proper terminal emulator that handles a steam of characters/instructions in real-time, and what I need for the web based dungeon client, which is to translate the IDisplay calls to HTML.

(Yes, I am still thinking about an IDisplay implementation that outputs html)


Talked with a nurse practitioner at my GPs yesterday to get a referral to counciling, and a referral to the local adult ADHD assessment centre.

Not very convinced, but I'll see what comes back.


Web terminal

Uses CSS grid. Basic setup with

#terminal {
  --rows: 25;
  --cols: 80;
  display: grid;
  grid-template-rows: repeat(var(--rows), 1em);
  grid-template-cols: repeat (var(--cols), 1em);
}

gives a grid of addressable cells.


To remember your current position in the blog, this page must store some data in this browser.

Are you OK with that?