Dev Log #15 - Artificial Stupidity and Economy

Dave Keating, my mentor in the Cybernetics Department would always so that before doing artificial intelligence, we should strive for artificial stupidity. After all, he would argue, we can't agree what intelligence really looks like but we can agree on stupidity!

This is borne out in games because you don't want them to be too intelligent but you want to strike a balance between being capable and fun. I don't think AI is a done deal but even with some simple state model techniques, you can create something that's a lot of fun. I've made a new release with the AI and save functionality in, which lets me concentrate on the next big thing: economy. I've not a got a video yet; have been playing with Davinci Resolve (which will let me do 1920 videos but won't accept FRAPS encoded AVI) and OBS (better than FRAPS but is giving me low frame rate so far).

Economy - Long Term Plan

The aim of the economy is to give the player reasons to explore and provide more complex decisions when building and fighting. I'm splitting economy into two bits: flotsam and people.

Flotsam (core currency) is scrap distributed around the world. You mine it, save it up and spend it on buildings and repairs. People are little characters that live in house buildings and have skills that make other things more effective.


This is scrap that will be lying around in the world to find. It'll use perlin noise maps to generate and will do so in clumps. When near Flotsam, the Cloudship will lower some kind of bucket/claw/thing and collect the Flotsam until the deposit has gone.

Like so:

Collecting Flotsam will require the player to keep the Cloudship in place. The Cloudship will need to have a store to collect Flotsam. If the store is destroyed (it's just a building), then the Flotsam will be lost. The base of the Cloudship will store a little Flotsam.

Flotsam will be spent on repair and buildings. As Flotsam needs to be put in a store building, stockpiling is avoided because of the need to balance space and weight on the Cloudship base.

I'll need a Flotsam gauge on the barrel, it will need to be visible for both driving and building modes, which isn't a problem. I want to make a gauge that swivels out when you're over Flotsam but that's later. I'm going to try and avoid updating the barrel until I have more buildings types.

Later improvements

Once I have economy in place, you'll also be able to upgrade your Cloudship base too. It's not really needed to prove the usefulness of Flotsam. Enemy Cloudships will also be a source of Flotsam, but not at first.


I chopped an old bug that meant terrain never disappeared and created a really rough "Flotsam deposit" model:

I'm now working on an algorithm to make it appear. It's probably going use Perlin Noise map and spawn them just outside of the player's view. That along with a "not near any others" and a limit on the number created at any one time should be enough. I hope to get the algorithm down by the end of the weekend. Then next week I can get on with the somewhat trickier act of scooooping it up!

brainwipe's picture

Three algorithms, 2 models and a lot of brain ache later, I've removed the dodgy lines from the dunes! I'll write up somewhere how I did it. I've also noticed that all the shadows have gone. I can't see why, so I've asked the community. Fingers crossed it's something obvious!

brainwipe's picture

Now that flotsam is appearing in the world (and disappearing too), I've added on some colliders so that the Cloudship knows when it is over the top of Flotsam. Now I need some sort of "collection" mechanic. The collection mechanic, at the very least just needs to let the player know that the stuff has been collected. At best, it should form part of the fun of playing itself. Here are my main ideas:

All of them will require the player to navigate the Cloudship over the top of the deposit.

  1. A magical column of dust rises up to your Cloudship, bringing boxes with it. You have to keep the Cloudship over the top for a short while.
  2. PING! Like collecting a coin in a Sonic game, the flotsam is collected.
  3. A bucket conveyor telecopes down to the ground and buckets pull it up. You have to keep the conveyor tip in the flotsam.
  4. Lots of little rope things dangle down and the boxes magically travel up.
  5. A bucket claw swings on the end of a rope, when full, it winds in. You drag it into the flotsam, using physics.

Which is more fun? Well, to me it's the bucket claw. I love the idea of this huge thing dragging across the sand. It is, however, the most complex. I started playing with it this morning and discovered that Unity has a bunch of built-in inverse kinematics built in. In simple terms, drag-and-drop a load of objects together and you have a chain-rope thing. Great! I am going to time box this one to 3 mornings. If I can't get it fun by then, I'll go with another one. It could well be bloody annoying, especially seeing as some deposits will spawn in a high-wind zone.

Which do you like best?

What then happens to the flotsam deposit?

I think I have a couple of options (unless you have a better idea). Firstly, most simply, as the flotsam is depleted, it just sinks down into the sand. Or I could make the flotsum up to actual objects themselves so that the claw/ropes/whatever are actually pulling things off the surface. I like the latter but it depends very much on how good the claw is. I can make the hit-boxes sensible to make sure it latches on easily. That's something I learnt from Extra Credits: sometimes it's best to be forgiving rather than accurate.

I'm still really enjoying it; if I didn't then I probably wouldn't be bothered to get up to do it at 6am!

brainwipe's picture

Well, since you ask :D

My nostalgia wants a Desert Strike style hook to slowly drop down when close, the the player still has to line things up a bit more until contact is made between hook and supplies, at which point the bulk of the supplies are haled up.

Effect-wise something like: flotsam would be made up of multiple items locked i a single lump, each grab would take a part, once X number have been removed the remaining should lose their bonds and either collapse or explode a bit and sink under the sand. Although that is a fair bit of work so option to is to go Desert Strike style and have the whole lump get lifted up and consumed by the metaphorical jaws of your cloudship (or actual jaws, that would be cool too).

Bigger Rob's picture

Ooooh Desert Strike.... good shout. If you've come to a near-halt over the flotsam (which under most wind cases isn't too hard: put it into wind and select Slow Ahead) then it will drop down vertically. I like the idea of lumps. I might also apply wind to the claw, which might make it swing a little.

I was thinking of a "fuck it" mode where you just chuck the jaws down and drag it along the sand. It would slow you down but would make "grab it and run" possible. That could be handy if you're between combats and need fast repair or if you've taken so much damage that you can't replace your boilers, don't have enough thrust to remain static and want to just grab enough to repair. That might have to wait, though! I won't need to do a lot of work for that feature if I get the physics right above; it would come for free (or the cost of a new button binding).

I'm going to carry on with the Gucci option as you suggest. I definitely want there to be skill involved, I imagine there will need to be a lot of testing to get this right. That's cool, though, I enjoy playing it!

brainwipe's picture

May I suggest giant suction cup arrow as an alternative retrieval method. Fired at the flotsam then reeled in on the end of a rope. Could even then add complexity like reel it in too fast you lose grip and so on.

Evilmatt's picture

That I also like, EMW. That might be harder than doing the rope, though. This took me 2 hours and I'm nearly there!

brainwipe's picture

I just stuck a heavy weight on the bottom and it's less wiggly with a bucket. To bed!

brainwipe's picture

I really want to play Desert Strike now...I used to love that game onthe Megadrive...

babychaos's picture

I'm now experimenting with "reel out" mechanics. This is my first attempt: spawn a link, move it down and then spawn another in at the top. It's starts off OK but then... not so good! I can't think of another way right now, so might end up doing the arrow method...

brainwipe's picture

That just looks wrong.

Bigger Rob's picture

You know, I hadn't thought of it like that but now you mention it... thanks for that, Big R.

I was thinking over lunch that I might be able to spawn them at the other end. Or perhaps I could spawn them all on top of each other at once and then slide the pivot points. That might work...

Whatever process I use must be reversible in some way.

brainwipe's picture

Read thought the documentation completely and found some interesting thoughts. As planned, I now spawn on top of each other and slide the pilot points over. Best thing is that the claw works in the same way but with a bit of weight.

I'm now onto pickup and pull in. I can do pull-in the same way and do the "dump the claw" thing too! Oh, and I've already made it quicker.

Well pleased with how this is turning out.

brainwipe's picture

Time for bed! That was a productive evening. Got reeling out and in working. You can see the hook going a bit mental when it's wound in. When the rope is retracted, I'll switch off the renderer so you can see it. Some polishing tomorrow morning and perhaps start breaking up flotsam into bits that can be collected.

Happy bunny.

brainwipe's picture

Well, that was easier than I expected. I need to add some mass to things, there's a weird tearing going on with the rope.

Next up to is to detect when the flotsam reaches the top and to suck it in. I've left the "make flotsam into separate pieces" for later, I still need to know if the concept of Cloudship is fun and if not, it needs shelving.

brainwipe's picture

without the claw it does look like the cloudship is a goldfish taking a shit :D

Evilmatt's picture

So true :)

Bigger Rob's picture

Been testing things a lot and discovered that physics worked fine when everything was static but when you tried to break it, it looses it.

Unity do say that the joint I'm after is designed for ropes but there's precious little information on how to set up mass, drag and whether the chain needs to be in a parent-child relationship or not. I've managed to get the problem above sorted but it's taken a good while to do!

brainwipe's picture

Additionally, I was on the brink of getting rid of the rope but - when it works - it's a lot of fun.

brainwipe's picture

Brief update!

I got shadows back! I worked out what was wrong: the new render pipeline lets you set "how far away shadows are cast". It was set to 50m. Since I did the re-scaling, the width of the Cloudship was 100m, so the sun was well out of range of casting anything. I don't feel bad about it, I wasn't expecting the shadow distance setting to be in the render pipeline settings. To my mind, it's a bit random (if a little obvious post hoc).

The upshot of shadows is that it's now much easier to line up the Cloudship when picking up flotsam. You can see which way the wind is going to blow you before you get there (and if it's blowing strong), turn into wind and judge it more easily. The hook and rope also cast a shadow, which is handy too. It takes a little skill but is satisfying when you get it right.

Flotsam Indicator

I've started a "flotsam indicator" on the controller. It'll be a dial, I don't have a picture yet because I'm not happy with it. I'm not going to let the player know the raw number for flotsam but instead tell them 100% full. When they select a building in the builder menu then the dial will show what the new level will be if they place the building down, the same goes for removing buildings too. I want to keep the building side pretty cheap: there will be no penalty to move buildings and removing them will give you all the flotsam back. It will have to stay this way for now because placing buildings is pretty tricky and it's easy to get wrong.

Project management stuff

I've split my single Project into multiple projects now. Release 1 is when I will start harassing gamer friends to give the game a good play. Release 2 will see a graphics overhaul and perhaps the wider economy, if I end up doing that. The only feature missing from Release 1 is some help text explaining what the keys are and why something is or isn't happening. No issue ticket for that yet, I'm still thinking about how that will work.

Even in the heat, Kate's shoulder being bollocksed and Ningbong teething, I'm making good progress! My commits have remained steady. I'm taking next week of work, largely to relax but also to make a big push towards Release 1.

brainwipe's picture

The dial is working! I've scaled this video to make it more obvious. When you're out collecting, you only care if it's "full or not" how much you need depends on what buildings you're going to put down. You can see me skidding over an "easy capture" here. The needle springs up to about 1/3 full. You can spot the easy ones because there are usually clouds over them. High winds tend not to have clouds over them and I think they tend to clump over time as they gather in a local minimum (that's to fix at some other point).

Next up is making buildings cost something, for which I will need to turn the dial 90 degrees and add a triangular marker on.

brainwipe's picture

Looking good, the shadow distance in the render pipeline makes sense it has to know the scale to generate the shadow box to work out what resolution the shadow are.

Evilmatt's picture

Ah! That does make sense. That's why it's grouped with the shadow map resolution:

Made a bunch of progress this morning - even though time was cut short by Naomi screeching the house down. Fixed an annoying bug where the terrain didn't always generate and Flotsam only spawned right in the centre of the terrain grid. Neither of them particularly nasty but head scratchers at 0615.

I updated the building system to subtract/add Flotsam depending on the buildings you have. I made the little model for the Flotsam "Proposed" marker on the dial and coded it but didn't have enough time to test.

I need a way of telling the user that they don't have enough Flotsam for a particular building. Initially, I was thinking that I could just not have the building show up and although that would do it, it's not good enough. I've just thought this morning that something physical could slide over the building in the circular build menu, so show that there isn't enough Flotsam. Just something simple. I'll give it some thought.

Also, in testing this morning, I discovered that if you're going to fast then the claw doesn't quite touch the ground as it lags behind the Cloudship. For it to attach onto Flotsam, it needs to intersect a special hit-box that is sunk into the Flotsam mesh (by design) to give it that look that it's sunken the claw teeth in. I can add another link or two into the rope to make it easier but I like this for "normal play".

brainwipe's picture