Rovots and You

Hi folks! I’m Peter Hastings – the programmer on the UnEarth Initiative. A few weeks ago, John told you all about our plans for rovotic companions. He also alluded to the fact that they’d be programmable – and that’s what I’d like to fill you in on: Each rovot that you construct in the game is actually a fully complete, programmable computer. Like futuristic Roombas, you’ll be able to command them to patrol sections of your colony, repair damage, or water your house plants while your colonists are away.

How do you do that, exactly? Well, the UnEarth universe if full of traveling aliens, many of which are willing to trade. Among them are engineers who will (for a price) program a rovot to do any one of those tasks, or a variety of other common things. We also want to encourage an active community of players – so you may be able to get useful rovot code from other computer-savvy gamers.

From a design standpoint, we’re still experimenting with just how important the role of rovots will be in a colony. Is it necessary to have them, or your crops won’t get watered? Definitely not. Colonists should be able to handle even the most mundane jobs on their own if they have to, but a well programmed rovot will be able to take work of everyone’s hands, and thereby increase the happiness and productivity of your colony.

Alright then, let’s take a look at how rovot code actually works. Here’s some simple code I wrote to make a rovot run around in a circle:

while( true )
{
  Move( 1 );
  Turn( 90 );
}

The “Move(1)” command tells it to move forward one meter, while “Turn(90)” tells it to make a 90 degree right turn. Both of those commands are nested inside the statement “while( true )”, which is a computer’s way of saying “Do please continue doing this forever”. And here’s that same rovot in the game, cheerfully turning in circles:

Wheeeeeeee!

A literal endless loop.

RovotCircles

One of the first things that excited me about the rovot concept – and the reason why I’ve gone to the trouble of making them fully programmable – is that I’m hoping they will become an introduction to coding for some of our players. My first coding experience was LOGO, which lets you draw by writing commands to move and turn a cursor on the screen. The rovots aren’t too different from that. Only the simplest commands are necessary to make them move, and by gradually adding more to their code, you can get more and more out of them. Hopefully, this creates a smooth learning curve that takes leads a programming novice to the point where they’re coding rovots to run entire wings of their colony.

Okay sure“, I hear you  say. “I could make it drive around, but if it’s supposed to be a computer, can I make it compute things?

Certainly! Here’s some rovot code to calculate the value of Pi:

var x = 1;
var divisor = 1;
var pi = 0;

for(var i = 0; i < 10000; i++)
{
  pi = pi + (x / divisor);
  x = x * -1;
  divisor = divisor + 2;
}

pi = pi * 4;

print( "Pi is " .. pi );

Don’t worry if that code seems a bit arcane, I’m just trying to prove that, yes, you can make these little guys do anything. If you plug this code into a rovot in the game, and it will dutifully calculate Pi for you, like so:

RovotPi

Well, that’s not exactly Pi. But to get much closer, we’d need to write a better approximation.

“So that’s all well and good, but how about some code that does something useful?”

Sure! Rovots are meant for automating repetitive jobs around your colony – the sorts of jobs that your Colonists could do, but would be happier if they didn’t have to. For instance, let’s suppose you’re growing a crop of alien shrubbery that needs constant watering. It’s not too hard to make a rovot cycle through watering all the plants:

RovotWateringCan

And if you’re curious, the code for that rovot looks like this:

var rows = 4;
var rowLength = 4;

while(true)
{
  for(var row = 0; row < rows; row++)
  {
    Move( 2 );
    Turn( 90 );

    for( var column = 0; column < rowLength; column++)
    {
      Move(1);
      Turn(-90);
      WaterPlant();
      Turn(90);
    }

    Move(-rowLength);
    Turn(-90);
  }
  Move( -rows * 2 );
  Wait( 300 );
}

This may look like so much techno-babble, but it’s actually not doing much more than moving, turning, and watering. Our hope is that, with the support of other players in the community, a lot of players will discover the joy of code this way. =)

We’re also experimenting with some even more ambitious ideas for rovot programming.One promising one is that we’ll allow rovots to edit each other’s code and data. These could allow you to build rovotic ‘teams’, where one surveys your colony and then dispatches others to do work. And even more crazily, we’re considering giving them access to the internet. If you’ve equipped your colony with wi-fi routers, and built an ansible array capable of communicate with Earth from across tens or hundreds of light years, then your rovots will be able to fetch data off the actual internet. I’m not sure what productive thing you could do with this, but when was the last time the internet was used productively? And at least you’ll be able to have a rovot follow your colonists around displaying RSS news feeds:

RovotRSS



Leave a Reply