Easier engine control for better ships

This month I’ve been working on simplification. I realised that One Million Worlds was simply too complicated for players to actually play (I think I’ve known that for a while but wasn’t sure what to do about it)

To resolve that I’ve removed (or made optional) the whole concept of wiring up engines to command chairs (which allow keys on the keyboard to control wires in the game). Previously it was very difficult to build an interesting looking ship that was easy to add engines to such that going forward didn’t make it turn upwards if the engines weren’t perfectly symmetrical around the centre of mass (which was really boring!).

What I’ve done is have the standard WSAD keys as inputs to “the concept” of going forwards/backwards left/right and given that to a linear optimisation library to figure out which engines should fire. This makes it much easier to build ships, and also allows much smaller ships to be built (as no need for room for wiring)

In addition to being smaller because no need for wires this ship design would also have pitched down if all its rear engines were on full, but the linear optimisation library can figure out it needs to put the bottom rear engines on full and the top rear engine on just a little bit and that gives straight and level flight.

This keeps it true to my original vision though, that if you haven’t got engines that could make you move forward without pitching up then it still won’t magic it into going smoothly forwards. But if there is a complex solution to achieving that it will achieve it.

If straight and level flight can’t be achieved with the engines placed on the ship the linear optimisation library “does its best” and activates engines that make the ship go more or less forwards, so it degrades nicely if engines are destroyed (or just not placed by the player)

The “UI update” V0.6 released

Version 0.6 was planned to be the storyline update, but it turns out creating storyline elements takes ages, and you end up creating a bunch of other content as you go along. So while I continue working on the storyline features I’m releasing an assortment of random other stuff I created along the way. However, the most obvious change is a complete overall of the UI, so thats what this update is getting called.

Major features in this version:

  • Video Command Chairs – A kind of command chair that can have a camera feed connected to it; allowing you to remotely control a turret and still see whats going on
  • Reinforced glass panels – A bunch of shaped glass panels to produce more interesting cockpits
  • Ants and ant colonies
  • Improved inventory interaction – shift clicking on an item will auto move it
  • Improved cave creation algorithm – look more like caves and less like a knife has been passed through the planet
  • Glow mushrooms – primarily found in any colonies
  • A bunch of bug fixes – by which I mean there were never any bugs
  • And of course, the complete overhaul of the UI

One Million Worlds is released!

One Million Worlds is officially released (as early access) and available to buy on steam. Because its early access the updates will come thick and fast but this is a major milestone towards finishing the game!

Main Capsule

So, the games out, now to thoughts of Major Update 1 (no not a rest). This comes out of my research of open world games (read; playing games) where you can feel a little lost in the early game; not quite sure what you’re supposed to do. The One Million Worlds intro was built in response to that but it doesn’t go far enough so the first major update will be the Story Lines Update, this will be an (optional) guided path through the game taking you around the world and presenting you with challenges unique to the game.

Building that is going to be interesting as it will mesh a procedurally generated world with predefined story line elements. This means that the elements of the story line will appear in different contexts each play through; being familiar, but not quite the same. Should be fun.

Steam and Wiki

As I get closer to releasing the game in alpha (sometime in March) I’m starting to build and improve the non game parts of the project.

So the word doc manual (boo!) is now a wiki: https://onemillionworlds.gamepedia.com (yay!). And the the download from onemillionworlds.com is now a steam page: https://store.steampowered.com/app/1009770/One_Million_Worlds/

Its not actually available to buy and download from Steam yet, and won’t be until the game comes out in alpha. But you can wishlist the game there so you’ll be informed as soon as its own.

Scripting blocks

As a developer when you put a programming language inside your program its a good sign you’ve gone off the deep end. That is what I have done. I’m now going to try to justify why I’ve done this in an attempt to lie to myself that it was a good idea.

Scripting blocks are a response to wiring getting too complicated and ugly and look like this:

script block

The idea is that they can accept a small text program and replace a huge load of wiring with just a little bit of text. So they can convert something like this (which is an automated turret that tracks and fires at the player):


Into something like this:


This turret is actually something I intend to exist within spawned structures so I wanted the scripting block for my own use but I’m putting it as a general block for advanced players to use (see, justification).

Here’s a video of how its used:

The scripting block is available in the most recent version of One Million Worlds (version 0.4.3 onward)

So, that’s that done. Now its time for the documentation! Yay!


Once you’ve placed a script block look at it and press e to open up the script.

Inputs and outputs

The inputs and outputs are all referred to by the letters N,S,E,W,U,D for north, south, east, west, up and down. The N,S,E,W are shown on the chip itself, the up and down you’ll just have to figure out for yourself.

You can set a direction equal to a value and that value will be output to that directions. e.g.

N = 5


W = 'Hi there'

You can output to multiple directions in a single program

N = 5
W = 'Hi there'

You refer to the inputs in the same way, so say you have a number inputted in the West port and wanted North to be twice the West value you could use the following script

N = 2 * W //note that * means multiply

// indicates a comment, the rest of the line is ignored, so you can add notes to your script

Implicit outputs

If you only have one output equal to a simple equation (or want all your outputs to be the same) you can omit specifying what output you want the value to go to, so you can simplify the previous program to this:

2 * W //all outputs will receive a value twice the size of WEST

Asking questions

You can use the “if” keyword (and a whole bunch of brackets!) to do different things based on a question. So lets say you have an input W that is the distance away a player is (reported by a scanner block) and if the player is closer than 5 meters away you want to show on a screen (connected to N) “Go away” and raise a door (a Rail block connected to S) but if they do go away reopen the door you could use this program:

if(W<5){        // W is the distance away the player is
  N = 'Go away!'
  S = 4         //S is connected to a rail set to position mode, 4 is fully closed
  S = 1         //position 1 is fully open   


Sometimes you want to calculate something once and then use it several times, you can store it in a variable

someComplicatedCalculation= 2 * N + S
W = someComplicatedCalculation
E = 2 * someComplicatedCalculation


Sometimes a piece of data has several parts, like a position might have an x, y and z. These can be both read and creating within scripts. The main place you’ll see these is inputs coming from scanner blocks which report positions as an array of 3 numbers. For arrays that enter on inputs you can refer to them in 2 ways:

As x,y,z:

distanceAway = N.x      //N.x is the first value in the array, N.y is the second, N.z is the third
S = distanceAway

This way of referring to arrays only works with arrays entering on inputs, not ones you create yourself.

As a number:

distanceAway = N[0]      //N[0] is the first value in the array, N[1] is the second, N[2] is the third
S = distanceAway

Note that the first value is N[0], not N[1], arrays start at zero. 

You can create arrays using square brackets. for example this program would return an array of the numbers 1,2,3

N = [1,2,3]

You can of course use variables

distanceAway = N.x 
N = [distanceAway, 2*distanceAway, 3*distanceAway]

Inbuilt information

Some data is provided in variables for use in your script. At present these are:

  • firstRun – if this is the first time this script has run (i.e. you just edited it) this is true, otherwise its false
  • timeSlice – how much time this run of the script represents (aka how long there is between runs of the script)
  • scriptTime – the total time this script has run (its the sum of all the timeSlices since the script was changed)

Remembering things from the last time the script was run

Usually the script runs a fresh each time, forgetting all its variables, but it is possible to remember things from run to run, this is done using the persistent (or p) scope. Also because I really struggle to spell persistent you can also use the persistant scope and that will work fine. Anything in the persistent scope will still be available the next time the script runs.

So lets say we want to modify the “go away” script from the “asking questions” section so that if starts saying go away if you come within 5 meters but then it keeps saying it until you are 10 meters away:

    p.goAway = false //when the script first starts up default to not saying anything

if(W<5){     p.goAway = true } if(W>10){
    p.goAway = false
//note that if W is between 5 and 10 it is left at whatever value it had previously

    N = 'Go away!'

Inbuilt functions

I’ll be creating inbuilt functions as I need them (I’m selfish like that) for now these are available:

  • clamp – This will take a value and ensure it remains between two other values
N=clamp(W,5,10) //This will output the value of W, or 5 if W is below 5, or 10 if W is above 10
  • stabilise – This will provide functionality to stabilise a system, e.g. if you have a turret that’s looking at the player controlling a rotator block to make it look directly at the player…… its best explained by watching the above video. It is a PID controller that is used like:
stabilise(errorValue, proportionalTerm, integralTerm, derivitiveTerm)

The meaning of the terms are as follows:

errorValue –  how far the recorded value is from what you want it to be. E.g. if the player is 30 degrees to the left and you want to be looking at them the errorvalue is 30.
proportionalTerm – this is a tuning parameter, you need to play with it to see what works. You want to set it to a value such that your system swings quickly to the desired position (even if it overshoots)
intergralTerm – this is a tuning parameter, you need to play with it to see what works (you’ll probably want it to be zero. You can use it if you need to apply some force even if you are at the correct position (e.g. when you hold a weight up with your arm you still need to apply force even when you’re in the right position
derivitiveTerm –  this is a tuning parameter, you need to play with it to see what works. This controls overshoot, if the system keeps osculating about a set point increase the derivitiveTerm.


You don’t need loops, please skip this section.

Ok fine, loops are useful when you want to do something more than once.

A simple loop could be like this:

for(i = 0; i<5; i++){
   /*this area will be executed 5 times, 
   once with i as 0, then 1 etc until finally when i is 4*/

Lets say, in the “go away” example the closer they get the more you want to say go away, lets say one exclamation mark for every meter they get towards you. A loop can do that.

distanceAway = W
permittedDistance = 10
if(distanceAway < permittedDistance){
    message = "Go Away"
    exclamationMarksToShow = permittedDistance - distanceAway //closer they get the more exclamation marks

    for( i = 0; i < exclamationMarksToShow; i++){
        message = message + "!"
    N = message

Reading errors

If any problems occur with your script the errors are shown when you next open the script panel (note it doesn’t refresh until you open and close it). It will tell you the line number and letter number where it knew for sure that your script was wrong, its possible it went wrong before this but that’s its best guess at where it went wrong

Secretly its JavaScript

The script used within OneMillionWorlds is actually a variant of JavaScript. I’ve made some additions but broadly if your script is valid javascript it will work. I haven’t covered anywhere near the full features of the language so if you’ve got to this point and want more there are may resources for javascript available online.

Hover rails

This is a feature I’ve added based on some feedback from my friend Vincent, he was trying to create a floating city with a transport system and the existing rails didn’t really cut it since the rails going up to the floating city make it look like its not floating.

So: hover rails (or railless rails), these behave like a regular rail system exect you tell it what the waypoints are rather than it following real physical rails. So you can go up to the floating city on a predefined route without creating an eyesore


The UI for creating waypoints works but I think I need a more intuitive way to place waypoints, I’m thinking the way building are placed in real time strategy games might work, so you move a ghost version of the machine to the place where it will travel to and then click to place the waypoint

Automated Rocket Factory

At the end of the last video I promised that I would could create a load of circuitry to fully automate the rocket factory, and while that is possible it would have been a lot of circuitry so instead of that I created a new block, the procedure block that allows the “do this, then this, then that” to be a lot easier to set up.


When you click into this block you get a simple UI that allows you to set up a series of outputs to run through


So with just that addition we can automate the rocket factory! Which I’ve put on top of a space ship, because why not.


Now due to certain, explosion related issues I realize I didn’t give you a close up view of the factory running, so here it is:


I’ve had a few videos of fairly military technology, but in the next video I plan on going in a more peaceful direction with a tunnel boring machine (that also collects and sorts any resources it finds along the way).

Rocket Factory!

I’ve been creating a couple of new blocks that help automate building:

A placer block that can place blocks, either as a new machine or attached to an existing machine


The placement block is part of the pipes system so you can use pipes to fill it up with things to place (or just open it and put things in manually)

And an attractor block that can pull other machines towards it (and lock them in position when they are close enough)


And with enough of them you can build a rocket factory:


An interesting question is if a sign post is a sensible way to input data into a machine, ………., its a fair point.

I mentioned a “more complicated circuit” running it all in the video but that feels a little complicated so I’m planning on adding a “procedure block” that you can set to [output the number 6 for 5 seconds then output the number 7 for 2 seconds] etc that should simplify that sort of thing.

A Block Battle

I’ve been looking at improving the sunspear AI this weekend (making it attack things that aren’t imaginary for example). Here’s a video of three of them attacking a player controlled vehicle.


3 verses one was never really going to go very well, still got 1 one of them!

You’ll probably have noticed the next item for improvement; the AI doesn’t 100% care about the ground, or trees, or other AIs and will happily crash into anything that isn’t its target.

You’ll see none of these ships are shielded, that’s deliberate, I’m making shield blocks very heavy so that you end up with a choice; heavy and shielded or light, maneuverable but vulnerable.

I’d like to end with a video of me actually winning, but well, this is the closest I ever got

Sunspears – a hostile fighter

The previous Ai controlled ship; the trade ships, were large and neutral by default. I wanted to add something more like a fighter; small, nimble, forward firing and hostile by default.

Here’s the work in progress:



This ship is attacking an imaginary object just above the tower. I’m imagining a few of these surrounding a base and attacking intruders (as hostile ships them wandering around in the world might be a little player hostile, maybe for a hardcore mode).

I don’t think this ship body will be its final form as I wanted it to be more… like a spear. It will also probably attack things that aren’t in its imagination.

As a computer controlled ship this is all good but it immediately made me want to create something human controlled with equal maneuverability to fight it but the command  chair as is stands requires far to much external wiring to process the outputs before they go to the engines. So; I’m planning on allowing simple formulas to be put in the keybindings for the command chair as well as vectors

So the current command chair allows you to select a single key to output in each direction, so for example you might type “a” to bind the a key to the SOUTH output which means to get forwards, fire, up, down, left, right you need 6 outputs, which already means you need 2 layers of outputs which is fine for a capital ship but big for a fighter. But if instead you allow simple formulas you can have:

SOUTH = a-d (controlling left and right together, press a and SOUTH is +1, press d and its is -1, press both and achieve nothing, don’t do that)
EAST = w (for forwards)
WEST = o-l (for up and down)
NORTH = x (for fire)

Great, now were’re at a single layer of outputs, except we’ve got wires coming forwards from the cockpit, that’s going to obscure our view, and the game already supports vectors so how about this:

SOUTH = w, a-d, o-l
EAST = x (for fire)

Now we can get all the signals away from the player nice and easily!

So that’s the plan, if all goes well you should see us in a fighter battle with that sunspear soon

%d bloggers like this: