Jul 142020
 

Last year, before I started working on my Frozen game, I started with something a bit simpler for my then-3 year old – a 2D Little Mermaid game. I wanted to make something very simple to teach basic 2D pad controls with minimal buttons required. On the plus side, no UI or text was required as she can’t read. Ariel is my daughter’s original favourite character, and some kind of swimming game sounded like a good idea. Also I hadn’t tried tilemaps in Unity before, and this was a good excuse to investigate. Here’s the end result:

The initial idea was to help a mermaid find her children who were hiding in a little maze, and bring them back to her. I’d picked up one of the Humble Bundles for creators that had some basic tile sets in, so I thought this would be easy. Unfortunately when I actually looked at the tileset it was completely useless – most of the tiles weren’t even square! Long story short, I eventually hopped into GIMP and drew my own, hence they don’t look very good!

But after making a simple maze, chucking in a parallax underwater background and adding a few simple fish sprites that moved back and forwards, it actually looked OK and I excitedly showed my daughter.

She takes the pad, goes straight up to the roof of the cave and says “Daddy, I want to go to the surface and see Prince Eric”. Except there isn’t a surface, or Prince Eric. But she does have a bit of fun swimming around looking for mermaids.

A couple of days later I’ve added some scrolling waves, some sky, and Prince Eric standing on the shore. “Daddy, I want Ariel to turn into a human and go into Eric’s castle.”

This game is going to be a little more involved that I’d anticipated. Oh well, it give me some direction, and it’s not like I’m not used to the whims of demanding designers.

Soon it had escalated. “Daddy, put in a giant penguin that goes up and down and has water spraying out of its head. And some monsters.” But finally I called it a day – after rescuing the mermaids you retrieve Eric’s castle key, do a little bit of platforming inside to grab your luggage, find the keys to chests containing other vital supplies, and then you sail off with Eric on a boat. Phew.

It’s not a technically great game by any stretch, I was just hacking stuff in quick. But it was pretty fun to make, and it was great for my daughter to see it being made (we mostly played it together in the editor, chucking sprites in and moving things around – she was obsessed with making the seagulls huge and green at one point). The only thing I’ve changed since is the music it originally had – after hearing the same jingly song from the musical on loop for hours on end, I just had to replace it with some generic background music.

Feb 272020
 

I’ve published my first asset on the Unity Asset Store! Find it for free here: https://assetstore.unity.com/packages/slug/162856

Or get the code directly from GitHub: https://github.com/AndyFenwick/FenceLayout

[EDIT: If anyone is interested, it’s had 142 downloads in the first five weeks after release. 29 in the first three days but it’s steadily getting a few each day since. That’s actually more than I was expecting.]

Fences

While making the Frozen game I wanted to put some fences down and assumed there would be a simple script on the asset store for this. There were a few fence tools available but they were all paid for. I’ve bought a bunch of art assets and tools (modelling definitely isn’t my strong point), but writing a simple tool to put a few objects in a line seemed like a perfect learning opportunity!

Here’s the tutorial video if you want to see what it does:

Writing the actual layout script was mostly simple. Add the prefabs, set up spacing, scaling and offsets, sample the terrain height and plop the prefabs down between the waypoints.

The only non-trivial part was dealing with uneven ground. On mostly flat ground the fences all line up nicely and look good. However on sloped terrain their disjointed and partially underground. The solution is to shear the fence model in Y so that both ends are on the ground. The only problem here is that Unity transforms don’t directly support shear. However there is a workaround by using two parent transforms and a series of rotations and non-linear scales. See this: https://answers.unity.com/questions/961330/shear-transformation-using-gameobject-transformati.html

I implemented that and it works well, with nice curving fences:

I’m not sure what happens to the colliders – the debug rendering becomes detached somewhat from the geometry, but it’s close enough that it works in my game so I’ve not investigated further.

Custom editor

The most fiddly bit was getting the custom editor and inspector working nicely in Unity. The input handling / selection handling stuff is pretty confusing – controls either wouldn’t consume input events, or they’d consume too many events and it would be impossible to select anything else. After some experimentation, this setup seems to work:

void InputUpdate(SceneView sceneview)
{
	Event e = Event.current;
	int controlID = GUIUtility.GetControlID(GetHashCode(), FocusType.Passive);

	if (e.control)
	{
		HandleUtility.AddDefaultControl(controlID);
	}

	if (e.type != EventType.Repaint && e.type != EventType.Layout)
	{
		GameObject fenceObj = Selection.activeObject as GameObject;
		if (fenceObj)
		{
			FenceLayout fence = fenceObj.GetComponent<FenceLayout>();

			// Do things with the fence...
		}
	}
}

public void OnEnable()
{
	SceneView.duringSceneGui += InputUpdate;
}

public void OnDisable()
{
	SceneView.duringSceneGui -= InputUpdate;
}

I also had various bugs with things not saving until I found out you have to manually set the object as dirty:

EditorUtility.SetDirty(m_fenceLayout);

And then found that editing a prefab still wasn’t saving. The fix for that was to mark the whole scene dirty if anything has changed:

if (EditorGUI.EndChangeCheck())
{
	EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
}

Have a look at the full code on GitHub to see the specifics.

Admin

I hadn’t quite realised the amount of admin that’s required to get something on the asset store. We publish enough apps in my day-job, but when you just want to publish a simple script it’s a bit of work to make (and work out what to put on) the required thumbnails, screenshots, social media banners etc. Plus write the documentation, record a tutorial video, write descriptions and all that. Good learning experience though.

Feb 162020
 

I bought a bunch of the popular Unity landscape tools recently, namely Gaia Pro, Vegetation Studio Pro, Complete Terrain Shader and River Auto Material. I also picked up a couple of the Nature Manufacture asset packs.

Here’s a little video of using the tools to quickly create a landscape. Note that I have spent a decent amount of time setting up the biomes and rules first so there’s work to be done after acquiring the tools, but once that’s done it’s super quick to create landscapes!

Gaia Pro

Gaia Pro from Procedural Worlds is primarily a tool for creating terrain heightmaps. It includes a wide range of ‘stamps’ (predefined heightmaps) which you can move, scale and rotate, and then apply to your terrain. There are loads of modes for applying stamps – add, subtract, blend, or apply effects like erosion, steps or peak enhancement. Stamps can be further combined with distance masks or other heightmaps for plenty of control. There’s a nice preview visualiser so you can see more or less what it’s going to do to your terrain before you apply.

Gaia Pro has loads of other features bundled in. You can set up texturing rules based on angle and height to automatically texture your terrain, as well as add rule-based spawners to add trees, rocks and buildings. Also bundled in are other asset sample, such as water, environmental audio, post-processing control, and a selection of trees, rocks and building assets.

This was the first tool I bought, and it’s a good all-in-one package to get started with. The terrain editing bit is great, but personally I don’t used the texturing and spawning controls – I find that Vegetation Studio Pro does that better.

Vegetation Studio Pro

Vegetation Studio Pro from Awesome Technologies is a must-have if you’re making large outdoor terrains. It takes a bit of setup, but afterwards you can author whole terrains in minutes.

You set up a series of biomes, each of which consists of terrain texturing rules and vegetation placement rules. The terrain texturing is similar to Gaia. You defines rules for each texture based on height and slope, convex or concave terrain, and Perlin noise, and they’re all combined to get the final texture. Vegetation follows similar rules – drop in your prefabs and set up similar rules for each based on height and slope, underlying texture, and density.

One massive bonus of the Pro version is that it supports multiple biomes types simultaneously. You define a default biome and can then drop other biomes into the scene and define their extents. The highest priority biome at each point is the one used, and there are cross-fade rules and curves to blend textures and reduce vegetation density or scale across the border.

In my game I have a default grass biome. I’ve defined a couple of different forest biomes so I can drop them into the level, mark the borders and you’ve got instant forests. And it uses its own batching and rending system so everything draws super fast! It’s the most expensive tool I’ve bought but definitely worth it.

Complete Terrain Shader (CTS)

Complete Terrain Shader is also from Procedural Worlds. It replaces the default Unity terrain shader with a more advanced one with more options. I think it has two main uses – the simple one is to add interest to distant terrain and break up the tiling, and the second is to use height maps for each terrain textures to completely change how textures are blended together.

The standard shader variant adds ambient occlusion, low frequency detail normal maps, height-based geological banding and snow, lower frequency tiling on distant terrain, and a few other features. These tweaks will make your distant terrain more visually interesting and less flat. Whether it’s worth it probably depends how much stuff you have in your world – if there’s a lot of detail and objects over your distant terrain it might not be so noticeable.

There’s an advanced shader variant that uses per-texture heightmaps, combined with the standard texture blending, to determine which texture to use per-pixel. I’ve not looked into this too far, but done well it can give far higher resolution, sharper texture blending.

River Auto Material (R.A.M.)

River Auto Material is a tool for creating river, lake and road geometry. You just click to add river spline nodes, set the scale and rotation of each node, apply a material preset, and paint transparency for blending. Fast and slow water effects are applied automatically based on the river gradient, or you can paint them yourself.

You can also simulate river flow, which I use a lot. Drop in the start point, hit the Simulate button and it’ll generate a river that flows downhill. Then there’s a terrain carving tool – draw the river bed profile in the graph editor, hit the Carve button and it’ll reshape the terrain around the river and blend it in to the existing terrain.

The other great feature is Vegetation Studio Pro integration. For each river preset you can define an associate biome type. Simply set the desired biome width, press a button and it’ll automatically generate a matching biome mask around your river. This makes it really easy to blend your rivers into your scene – the sand and rocks in the screenshot above were added like this.

I’ve not dived too far into the possibilities yet, but it’s a fun tool to use and I like the results a lot.

Feb 092020
 

It’s been a while. Turns out that having a child takes up a lot of your free time. Who knew.

It’s a tricky balancing act with children and technology. Too much screen time is bad, but they need to learn to use technology and feel comfortable with it. Being from a tech background, I often wonder if we were more conscious of this and a bit too strict (somewhat hypocritically, thinking back to my own youth…).

Everything is touch screens these days. Direct control is so much easier than indirect control, so I wanted to make sure that my daughter had some practice with a controller. Time to get back to Unity and make something!

I did a couple of simple 2D games early on (I’ll share them later), but I wanted to try something in 3D. My daughter loves Disney and Frozen, and after a quick Google I found some passable Elsa and Anna models (3D modelling is definitely not in my skill-set). After a quick proof of concept and a bit of research, the Unity Black Friday sale was upon me and I went all-in with a bunch of the popular tools. I may follow up with a technical post later.

The only slight hiccup is that we have another child due any time now, and nothing is going to get done for a few months afterwards. So this is what I’ve come up with so far:

There’s no real gameplay there, but my daughter always prefers to play in a sandbox than be told what to do, so running around and exploring is fine. You can summon snowmen, push them around, throw snowballs at things and cast magic at wolves to scare them off. I could spend hours more detailing the world and adding areas things (there’s loads of black areas), but I think it looks pretty cool so far.

Obviously the game will never be finished or distributed as they’re not my characters, but it also has the advantage that it only has to run well on my own beefy gaming PC so I don’t have to waste limited time on performance and optimisation!

Games for kids

Thinking about games for children in general, every child is so different that it’s really hard to find anything ideal off-the-shelf. They’re either too complex, or too simple, or require reading skills, or the theme isn’t interesting. Which is why I just make my own games, which can become more complex as my daughter grows up. And most importantly she can see how things are made and give ideas and suggestions about what to add, and see me make changes in real-time. Much better than games being some mysterious black box (I realise I’m lucky in being able to do this). If my kids are going to be gamers, they might as well start with early-access, moddable PC gaming! Much closer to the Spectrum scene I grew up with.

Co-op modes

Co-op mode is the best thing ever in gaming. It’s the ideal way to share a game with your family, and done well it can let an adult handle the complicated bits while the child does what they can.

This fit really naturally with a Frozen game, with two main characters. It’s not really in the video (because I recorded it myself and using two pads at once is hard) but one pad controls Elsa, and one controls Anna. Both pads can control the camera, so the child doesn’t have to. If there’s no input on a pad for five seconds, that player drops back to AI mode (they just follow you around for now) and the camera focuses on the active player. Any input will put them back under player control and the camera will keep them both in view. No rules around this, no complicated explicit join/drop-out mechanics, it ‘just works’. I’ll definitely be keeping this concept for future games.

Oct 302015
 

It’s been a slow year on the blog. This is mainly due to taking up a few new hobbies (learning Norwegian, and getting into astronomy and astrophotography) and preparing for a new child. I may write about some of these in future. But in the meantime I’ve done a little bit of work on my previously-untitled “spaceship game”, and figured I should put it up for download on the off-chance that anyone wants to play it.

I’ve mainly improved the frontend and UI, as it used to use the terrible looking built-in UI system in Unity pre-4.6. However, as my day job is making nice UIs for mobile apps, it’s not really the sort of thing I want to spend all my spare time on as well, so it’s pretty minimal (but not as embarrassing as before). The graphics are also terrible, because I’m not an artist. You may have heard the term “programmer art” before. If not, you have now.

At least the game now has a title. Using the time-honoured method of picking pairs of vaguely relevant words at random and putting them in Google until no existing game comes up, it is called Galaxy Arena. Download it here:

PC: GalaxyArena_PC.zip (13.1MB)

Mac: GalaxyArena_Mac.zip (15.1MB)

shipgame1

The Game

Galaxy Arena is a multiplayer-only game where you competitively build a spaceship out of square parts against the clock, and then fight everyone else with your creation. It’s pretty obviously heavily inspired by the board game Galaxy Trucker if you’ve played that (and if not, you should).

You can play free-for-all or with teams, and it supports 2-12 players. Team support is flexible but rudimentary – simply type a team number into the Team box by your name in the lobby, and the game will form teams accordingly.

I’ve only actually tested it on a LAN with up to eight players, but I presume it works over the internet. It uses the Unity development server for posting open games, and this is occasionally down for maintenance. If it is, you’ll just have to try again later (sorry), or use the Connect to IP option (port 33104).

Build Controls

The first phase of the game is where you build your ship. Your Core module in the middle of the screen. This has tiny engines and a puny laser built in, and your match is over when it’s destroyed. Around the edge of the screen are eight stacks of tiles, shared between all players. You have 60 seconds to grab tiles from the edge and attach them to your ship.

Left-click: grab a tile / place a tile if valid (when green)

Right-click: rotate the grabbed tile 90 degrees

Esc key: discard the current tile

Building Rules

Ships must be built following a few rules:

  • Tiles must connect to an existing part of the spaceship
  • Edges of the new tile must match all existing neighbouring tiles – either connector-to-connector, or blank-to-blank
  • No tile can be placed in the square directly in front of a weapon (shown with a red cross)
  • No tile can be placed in the square directly behind an engine (shown with a red cross)

After the time is up, you’ll be taken to the arena to fight.

Tiles

ga_coreCore. Lose this and you die.

 

ga_engine

Engine. Provides thrust and increases turning rate.

 

ga_laserLaser. Rapid firing, low damage weapon. Faster projectile than the missile.

 

ga_missileMissile. Slow firing, high damage weapon. Slightly higher DPS than the laser.

 

ga_gyroGyroscope. Increased turning rate.

 

ga_crewCrew. Increases rate of fire, and increases engine power.

 

ga_batteryBattery. Increases total energy reserves and recharge rate.

 

ga_armourArmour. More hit points than other modules.

 

 

Fight Controls

The arena stage is last man (or team) standing. There is no time limit and no walls around the arena, so just play nice and don’t run away forever… (this is remaining a prototype, not a polished full-featured game).

W/ S / Q / E : thrust forwards / backwards / right / left. Fires whichever engines you have pointed in that direction

A / D : steer left / right. Steering is faster the more engines and gyros you have, and slower the more mass of ship you have

Space : hold down to boost your engines, but this drains your energy bar quickly

Arrow keys : fire all of your weapons that face in that direction. Firing uses energy, and weapons won’t fire if there isn’t enough.

Tab : show the scores (just for fun, they don’t mean anything). Score is purely the amount of damage you’ve inflicted.

Your team mates have green names, and have green arrows pointing to them. Your enemies have red names and red arrows. You can damage your team mates, so be careful.

And that’s about it. Here’s a video of the previous version of the game. Enjoy!

Jan 282015
 

Just before Christmas I had a couple of days off work and planned to give Elite a proper play, but then something happened: a friend very kindly bought me a copy of Kerbal Space Program. I knew of the game and I’d always been curious, but I assumed I would quickly get bored of a predominantly sandbox experience. Apparently I was wrong – I booted it up one morning and spent the next three days solid engrossed in orbital mechanics, staging, lander design and “delta-v”.

The game involves building rockets and space planes from a huge variety of components and launching them into space to explore the solar system (different to but based on our solar system, which I guess stops people nitpicking about accuracy), while using reasonably realistic physics. As such, it was humbling as a self-confessed science/space nerd that it took an hour of failures and a tutorial before I managed to get a rocket into orbit. It’s refreshing to play a game that pays so little attention to traditional ‘gaming’ experience and relies so much on a knowledge of physics.

kerbal1

A brave Kerbal on his way to the moon

There are three different game modes – sandbox mode where everything is available, “Science sandbox” where new parts are unlocked by doing new things and using scientific instruments, and a full career mode which also adds money earned through contracts. I was warned that the career mode was really hard, so I went with Science mode. This lowers the learning curve of Sandbox mode by introducing new components slowly, while removing the stress of money and crew management. The game is still in Beta but when it’s done I’ll have a stab at Career mode now I vaguely know what I’m doing.

kerbal2

This little guy can’t get home. I’ve reclassified him as Moon Base 1

I was struck by the familiarity of my progression during the first few hours compared to the real space programmes, and the real sense of accomplishment that I’d not felt in a game for years:

  1. Fire a rocket up into the air. Heh, this is cool.
  2. Fire a rocket up into the air and parachute the capsule back home. First successful mission.
  3. Blast well into space before splashing down in the ocean. Sub-orbital space flight!
  4. Making it into orbit (eventually) and safely de-orbiting. Ooh, reentry looks cool.
  5. Getting into orbit, firing off towards the moon, slingshotting round the back and getting back home again. Landing there looks tricky!
  6. Getting to the moon, going into obit and landing on the surface in one piece. Having no fuel left for the return journey (real-life thankfully skipped this stage).
  7. Landing on the moon, grabbing surface samples, getting back into space and making it back in one piece for the first time. A real accomplishment!

kerbal3

About to ditch the last stage and deploy the parachutes for splashdown

Each stage presents new challenges and physics concepts to master. Getting into space requires staging (jettisoning empty fuel tanks and engines to make the rocket lighter). Obtaining a circular orbit needs an understanding of the apoapsis and periapsis orbital nodes (farthest and nearest points) and how burning at one side of the orbit only affects the other side. And then you can worry about orbital transfers to get to other moons and planets.

kerbal4

Get used to the view, son, you’re stuck on Eve for the forseeable future…

Thankfully the game provides a great maneuver planning tool. The current orbits of all bodies and ships are shown, and you can add planned maneuver nodes along the path. Drag the node in each of the six directions (prograde and retrograde, normal and anti-normal, radial and anti-radial) and the predicted path updates, including closest approaches to other bodies and ‘encounters’ (getting within their gravitational sphere of influence). While I’m sure NASA use complicated maths to plan their paths, in this game dragging nodes around until you hit on something useful also works while you’re getting the hang of what each direction does to your orbit. Then you just follow the directions on your control panel to carry out the planned burn.

kerbal5

The aerodynamic model is very simple, otherwise this rover and sky crane would never get off the ground

 After that the sky is, indeed, the limit. I’ve got “small colonies” (read: failed return missions) on Eve (Venus) and Duna (Mars), and used a sky crane to drop a small rover on the moon. The other planets require even more powerful rockets to reach, and as we speak there are probes scouting the outer planets for my future (probably suicide) missions…

And finally, for the truly brave, there is the small matter of orbital rendezvous and docking. Why get just one spacecraft where you want it to go when you can get two in the same place, at the same speed, at the same time? Building substantial space stations requires launching them in multiple sections, and this is my next project. My first and only successful docking took an hour, but it must get easier. I mean, it’s complicated, but it’s not rocket science.

Jan 212015
 

The wait is over, Elite: Dangerous has been out for a month now and I’ve been playing it quite a lot. I was going to wait until it was actually released before diving in, but I had the chance to borrow an Oculus Rift DK2 for a weekend right at the end of the beta, so I dived in early. And both are awesome!

I’ve heard a few predictions that the Rift won’t turn out to be any good. I don’t know how it’ll fare as a consumer device in the market, but from a technical perspective I can safely say it works great.

elite1

Prepare to be randomly attacked by many of the psychotic NPCs

I had a quick go on the original devkit about 18 months ago at the Rezzed show, playing a completely unsuitable game (it used FPS controls on a joypad) and it was… quite good. You could see the giant square pixels, and everything was a bit blurry and smeary, although that was probably a combination of steamed up lenses and the fact I wear glasses. But still, you could look around it was pretty immersive – until the point when I moved my head both in real life and with the stick at the same time and felt instantly sick. Moral of the story – the Rift and FPS controls don’t mix.

The DK2 is a massive improvement. The resolution is higher and it added full head positional tracking. The positional tracking is the biggest improvement to immersion – the best games and demos involve sitting in some kind of chair, and the first time you lean over and look behind or underneath you, you almost forget where you really are.

elite2

On my way to the Pleiades

Elite is an unashamedly slow-paced space simulation, which really benefits from the immersion offered by the Rift. Despite the complicated controls it’s completely possible to play on an Xbox 360 pad (assuming you don’t have a flight stick) without touching the keyboard, which is vital for VR (use the Advanced Pad preset in the options – lots of controls are mapped to “hold a button and press the D-pad” which takes a bit of learning but works well). In particular, the dogfighting is much better with the Rift as you can look up out of the roof to keep track of your target. The only downside is the text is a bit small, so you have to lean it to read it easily. But the fact that you can do just that is awesome in itself!

elite3

Ringed planets can be very pretty

The first few hours are a bit of a grind as you carry out delivery missions for a few thousand credits each, but pretty soon you can get into a dedicated trading or fighting ship and make some serious money. My early goal was to get into the classic Cobra Mk3 and kit it out, and then go on a jaunt somewhere interesting. Looking around the map, the closest landmark I could find was the Pleiades star cluster and the thin nebula around them, at a mere 300Ly away. The journey there took an hour or two, scooping fuel from stars on the way, and watching the nebula grow bigger after each jump thanks to the dynamic sky box.

elite4

A young planet around one of the massive, bright Pleiades

The attention to realism is what makes the game for me. Everything is to scale, from the layout of the stars to the planets in a system, and planets and stations move and orbit correctly within systems. That’s such a surprise after being used to the static universes of Eve and the X games – for example when you find your trade route has got a bit slower because the station is now on the wrong side of the planet compared to an hour ago.

Arriving at the Pleiades, it’s all massive, bright, young stars with new lava-riddled planets around them as you’d expect. Slightly less expected was the random NPC cruiser that started shooting at me shortly after I took the screenshot above, hundreds of light years from civilisation. But I suppose the game needs to attempt to give the illusion of a populated universe.

elite5

Back to space trucking between outposts

One criticism I do have is the multiplayer aspect. I admit that when I’m trading I play in Solo mode, with no other human players. There are no ‘positive’ interaction you can have with other players – all you can do is randomly blow them up or crash into them. Given that losing a ship full of expensive cargo can set you back hours of game time, I don’t have any desire to risk it. I appreciate that some like the thrill and the adrenaline, but being on the wrong end of a pirate encounter isn’t for me. Hopefully Frontier will add some other incentive to play with others, but in the meantime I’m happy enough in my own little world.

It’s also not a game you necessarily want to play for hours at a time, as it can get fairly repetitive grinding money for the next ship. But by mixing up a bit of trading, fighting, mining, exploring and keeping up with the evolving story, as well as playing in small doses, it’s still a game I feel excited to get back to and play. A worthy new (old) entry into the sparse space sim genre!

Oct 012014
 

This is part 2 of how my spaceship building/fighting game is structured. Find part 1 here.

Space network synchronisation

Each player’s ship consists of a parent object with a PlayerShip script and a Rigidbody 2D, and a bunch of children (one for each attached ship module). I very much like the fact that you can just add a selection of children with box colliders (i.e. the modules) to an object with a Rigidbody and the physics interactions Just Work (certainly well enough for my purposes).

With that in mind, the only objects created with a Network.Instantiate() are the parent ship objects, one for each player. The server owns all network-instantiated objects, and nothing is network-instantiated on a client. The server keeps track of which object belongs to which player.

The clients have already been told which modules make up all the ships, so they create them all locally and attach them as children of the ships. The parent PlayerShips are the only things in the game that use the NetworkView state synchronisation (which automatically updates position and rotation 15 times/second). This is very efficient as there is only one synchronised object per player.

Prediction and interpolation

The ships use some simple prediction to minimise the effects of lag. I’ve seen a few people asking about how this works, so here’s the serialisation code:

void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
{
  if (stream.isWriting)
  {
    Vector3 position = rigidbody2D.position;
    Vector3 velocity = rigidbody2D.velocity;
    float rotation = rigidbody2D.rotation;
    float rotSpeed = rigidbody2D.angularVelocity;

    stream.Serialize(ref position);
    stream.Serialize(ref velocity);
    stream.Serialize(ref rotation);
    stream.Serialize(ref rotSpeed);
  }
  else
  {
    stream.Serialize(ref syncPosition);
    stream.Serialize(ref syncVelocity);
    stream.Serialize(ref syncRotation);
    stream.Serialize(ref syncRotSpeed);

    syncPositionFrom = transform.position;
    syncRotationFrom = transform.rotation.eulerAngles.z;
    syncBlendTime = 0.0f;
  }
}

And here’s the update code to calculate the transform every frame:

void Update()
{
  if (!Network.isServer)
  {
    syncBlendTime += Time.deltaTime;
    float blend = Mathf.Min(1.0f, syncBlendTime / blendTimeMax);
    transform.position = Vector3.Lerp(syncPositionFrom, syncPosition, blend);

    float newRot = Mathf.LerpAngle(syncRotationFrom, syncRotation, blend);
    transform.rotation = Quaternion.Euler(0.0f, 0.0f, newRot);

    // Update the from and to values by velocity.
    syncPositionFrom += syncVelocity * Time.deltaTime;
    syncPosition += syncVelocity * Time.deltaTime;
    syncRotationFrom += syncRotSpeed * Time.deltaTime;
    syncRotation += syncRotSpeed * Time.deltaTime;
  }
}

This will predict the position/rotation in the frames following an update, and blend out previous prediction errors over blendTimeMax (set it the same as your time between updates). This will fix all positional discontinuities (nothing will pop to a new position) but there will still be first-order discontinuities (velocity will pop).

That’s not a problem at all for the other ships, as it’s not noticeable in a game like this with slow controls. The only issue is if the camera is fixed relative to your ship (which it currently the case), because a tiny change in the ship rotation leads to a large movement of the background at the edge of the screen. It’s still barely noticeable, but ideally the camera position/rotation needs to be slightly elastic.

Controlling the ship

The Space scene contains a PlayerControls script which takes input from the keyboard and sends it to the server. You have controls for applying thrust in four directions (forwards, backwards, left and right), firing in each of the for directions, and steering left and right. The PlayerControls sends an RPC to the server whenever any of the inputs change (e.g. started or stopped steering) to minimise server calls. On the server, the inputs are passed to the PlayerShip owned by that player.

Ships are controlled by applying physics forces to the Rigidbody. Every FixedUpdate(), the PlayerShip uses GetComponentsInChildren() to find all the Engine components (scripts attached to the engine module prefabs) and send them the net horizontal and vertical thrust. If the engine is facing the right way is applies a force to the parent Rigidbody with AddForceAtPosition().

Applying the force at the actual engine location results is wild spinning for even slightly unbalanced ships, so I blend the position nearly all the way back towards the centre of mass to make is more controllable (97% of the way in this case, and even then it’s hard to drive with off-centre engines).

Steering simply uses AddTorque() to rotate the ship.

shipgame1

A ship with unbalanced engines

Weapons

Weapons are fired in a slightly different way to engines. Because there are a variety of weapons systems, I use BroadcastMessage() to call a function on every child script that responds to it (scripts are added to each weapon module). Each weapon script keeps track of its own cooldown and fires if it can.

Firing weapons creates Projectile objects. Each weapon module prefab has a Projectile prefab referenced in it, and each Projectile can have different graphics, speed, lifetime, damage and particle effects. The projectile is created on all clients by doing a Network.Instantiate().

Because projectiles go in straight lines there is no need to synchronise the transforms over the network. The initial position and velocity are set precisely the same as on the server, and the parent ship velocity is added immediately after creation with an RPC (use the new object’s networkView.viewID to identify it on the client). The projectile can then move itself locally and be in exactly the right place.

Impacts and damage are all calculated on the server. OnTriggerEnter2D() is used to detect when a ShipModule has been hit. Network.Destroy() is called on the projectile, a particle effect is instantiated on all clients, and damage is applied to the ShipModule.

If the ShipModule has been destroyed it informs the parent PlayerShip which checks if any other components are no longer connect. RPCs are then used to tell clients to destroy the relevant modules. If the red central component is destroyed then you’re out of the game.

No physics calculations or collisions are processed on the clients at all. The game is entirely server-authoritative to minimise cheating possibilities – the clients simply sends off inputs and receive updates. Overall I’m pretty happy with how it all works, and very happy that the entire game comes in at under 3000 lines of code (total, including comments and blank space)!

Next it needs a load of polish – better graphics, add some sounds, a building tutorial etc, but it’s a decent start.

Sep 282014
 

A little while ago I posted about my spaceship building/fighting game, made in Unity. Because Unity is quite different to how I’m used to writing games (pure C++), it required a bit of getting used to how to structure things. This post will give a high level overview of how it works and all fits together. Again, as a Unity novice I’m not saying this is exactly right, but I’m happy with how easily everything came together so it can’t be too far off!

I plan to do a few more improvements and usability tweaks to the game and then I’ll probably put it up for download. No guarantees on when though.

Scenes

The game consists of just three scenes: Lobby, Garage and Space.

The Lobby contains the UI for creating, joining and leaving servers, a Start button and a chat panel. There is a singleton NetworkManager that stores state about which server you’ve created or joined, and the other players in your game. I talked about that here.

On starting the game, every player loads the Garage scene. This scene contains the base ship and the components available to build it. After 60 seconds of building, the server calls time and tells every client to load the Space scene.

The Space scene contains very little except for a textured quad for the Background, a camera and a couple of manager scripts. All players are added in code, and at the end of the game the Lobby is reloaded.

Quickly about the networking side of things. The server player also plays the game as a client, so as much as possible the code is split out into Server and Client parts. The client-running-on-the-server goes through all the same processes as any other player for simplicity (but the NetworkManager shortcuts the message passing, as I spoke about before).

Garage structure

The Garage scene contains a bunch of GarageSlots which are where the available components appear. There’s also a GarageManager object which has references to all the GarageSlots (set up in the inspector). Finally there’s a PlayerShip which is mainly a container for ShipModules (the square tiles you add to your ship).

Each individual ShipModule is defined as a prefab which contains a sprite, a box collider, a ShipModule script (with info about the connectors on each face, hit points etc), and any module-specific scripts. There are currently eight types of module and around 30 different module variants, so there are 30 different prefabs.

unitygarage

All very straightforward. One problem is then how to create a global accessor for these modules, so that both the Garage and Space scenes can get references to the prefabs. Looks like we need another singleton, which we’ll call the ModuleLibrary.

Singletons with configurable parameters

The ModuleLibrary script contains references to every module prefab, set up in the inspector. This is all fine if the script only exists in one scene because you can just drag one into the scene and set it up. However, singletons like the NetworkManager work by newing up a NetworkManager script and adding it to an object. Instead I want a singleton that I can configure in the editor.

To do this we can set up an object containing a ModuleLibrary script, configure it by adding all the Module prefabs to it, and save that as a prefab. Then you can use this singleton get() function to instantiate it from the prefab:

static ModuleLibrary m_instance;
public static ModuleLibrary Instance
{
  get
  {
    if (m_instance == null)
    {
      GameObject obj = Instantiate(Resources.Load("ModuleLibrary")) as GameObject;
      m_instance = obj.GetComponent();
      DontDestroyOnLoad(m_instance);
    }
    return m_instance;
  }
}

One thing to note is that Resources.Load() takes a path relative to the Resources folder in your Assets list. This folder doesn’t exist by default so you’ll have to create it.

unityResFolder

Now we are able to get a prefab for any tile from this singleton and a module ID number.

Garage security

For a small hobby game I’m not at all worried about cheating, but it’s good practice to design a robust hack-proof system as much as possible anyway. To that end, the server keeps track of and verifies all steps in the ship building process.

The server generates the IDs of the modules that will be available in the slots, and tells all clients. When a player clicks a module to pick it up, their client sends the chosen slot ID back to the server. The server stores which type of module that client has selected, and generates a new one to fill the gap.

When a player then clicks to attach a module to their ship, the client only sends the grid coordinates and the rotation (one of four). The server already knows which component is selected and verifies that it’s valid. Therefore it’s not possible to send new modules back, or create invalid ships, by sending fake packets to the server.

From the Garage to Space

The details of everyone’s ships are stored in a ShipStore, which is another configurable singleton. The ShipStore on the server is what keeps track of the ships that each player is building. When the Space scene has loaded, the server ShipStore uses RPCs to tell every other player the details of all the ships.

Unfortunately the built-in Unity networking doesn’t support sending arbitrary byte arrays, so the transmission is a bit cumbersome – an RPC call is made for every single component on every ship and contains the player, coordinates, module ID and rotation. It’s not ideal but it works, and there are at most a couple of hundred messages.

At this stage there is a little bit of message passing to ensure that every client has finished loading and receiving ship data. Everyone has now build a ship and made it into space so it’s time for some action, but that can wait until part 2.

Sep 042014
 

I’ll try to keep this brief, I don’t normally like to get too serious on here and everything has been said before more eloquently that I could put it.

I 100% support Anita Sarkeesian and her work on Feminist Frequency, as well as everyone else who has received abuse as a result of working on or expressing a view on video games.

If you don’t know what I’m talking about, count yourself lucky that you’ve been spared this particular display of vulgarity from a small segment of the “gamer” community in response to the Feminist Frequency videos. And if you have any interest in video games and how they can be improved, you could do far worse than watch them yourselves.

femfreq

My main emotion while writing this is embarrassment. I’m embarrassed to have to state the blindingly obvious: that women and minorities have the right to criticise a medium of entertainment without being subjected to abuse and death threats. I’m embarrassed that the gaming community has allowed mysogynists and sociopaths to be such a prominent part of how the public (and even gamers themselves) perceives it. In 27 years of being a gamer I’ve never once been ashamed of my hobby, but the events of the last few weeks have pushed me perilously close.

This is me stating that those people do no represent me. Along with many many many many others, I believe it’s important to make a public stand – to do my little part in counteracting this toxic culture.

Games have been fighting to be recognised as art for years. Now they’re made it – and they’re starting to get the same level of critical examination as any other media. Some of it is valid, some less so, but any high-quality reasoned commentary is welcome, especially in a medium that has been mostly devoid of it for so long. As a (ex-professional, now spare time) game developer, I wholeheartedly welcome any criticism that makes me think harder about what I do, and what can be improved.

To end on a positive note: in the long run this sorry episode may actually achieve something. The developer community is small, close-knit and predominantly comprised of rational, educated, well-meaning professionals. I believe the issue of equality in games has very much been brought to the forefront for most of those developers. And I believe that gaming will continue to accelerate along the sometimes-rocky road to being a fully-fledged respected artform, one that we can all be proud of.

Thank you. Normal service will be resumed shortly.

Aug 232014
 

Today’s post is a rather mixed bag of  vaguely-related topics. Lets kick off (ahem) with Kickstarter…

Kickstarter

Last weekend I was supposed to be at Alt-Fest, a crowd-funded goth/metal/industrial festival that was shaping up to be awesome. Then three weeks ago it imploded spectacularly – cancellation rumours circulated on Twitter, before finally a statement was released saying they’d not sold enough tickets and had run out of money. I suspect the UK alternative community is too small to support such an ambitious festival, but it was worth a punt. I suspect that this could be the first and last large-scale crowdfunded festival.

I love the concept of Kickstarter, but I’m done for the time being. I went in with some friends on the Deadzone game, but by the time we received it we’d all rather lost interest in miniatures wargaming, so I’ve got a small pile of useless plastic I may never use.

chaosreborn

Chaos Reborn concept art

It’s not all been bad. The other project I’ve backed recently is Julian Gollop’s Chaos Reborn, a remake of the best game ever made: the original Chaos on the ZX Spectrum. To be honest I don’t know if I’ll actually get around to playing the finished product, but as a ten year old I spent hundreds of hours playing dodgy copies of Chaos and Rebelstar, so I figured some back-payment was due. It’s looking pretty good though.

Space sims

On a similar note I’m done with pre-ordering games as well, and I can pin that down to one game: X Rebirth. I’d been a fan of the X games since my university housemate made me play X-Tension years ago. It was a modern-day Elite with trading, shooting, pirates, space stations and fleets of ships. It was quite slow and the interface was awkward but I spent months building my space empire. The sequels were more of the same but bigger, better and prettier.

xrebirth1

World’s most annoying co-pilot with character design straight out of the bad old days

So I was aware that X Rebirth was going off in a slightly different direction, mainly by making it friendlier and more accessible, but obviously it was going to be good, right? There was a small pre-order discount and access to the soundtrack (which I loved in the earlier games and spent hours listening to) so I succumbed to a rare impulse purchase. A few weeks later and I was the proud owner of a (literally) unplayable mess. Frequent soft-locks, glaring bugs and things just not working made progress through the game impossible.

The worst bit though wasn’t the bugs, but was leaving your ship to walk around a station. There were all of two different station interior layouts, the NPC character models were straight out of System Shock 2, every character was incredibly rude when speaking to you (even they ones you’d employed) and the gameplay involved walking around looking for crates full of junk to sell back to people stood three feet away from them. Some sage advice: “if you can’t do something well, cut it from your game”. The have been a huge load of updates since, but I can’t bring myself to go back and play it again.

xrebirth2

It’s a shame because the actual space bit can be very pretty

All is not lost is the space sim genre though. The most successful crowd-funded project of all time, Star Citizen, continues to attract cash at an alarming rate. I’ve not been following it too closely because I can’t see any way that it’ll ever be ready for release. I suspect it’s far too ambitious to ever lock down on a shippable feature set, but prove me wrong and release a decent game and I’ll buy it.

But! The real Elite is back and looking good! With a more sensible level of funding, Elite: Dangerous is already in beta for an expected release later this year. In a classic case of doing more with less it’s promising to be a worthy sequel, and I fully expect to while away many more hours in the dark depths of space. Finally this most venerable of genres is getting the attention it deserves, on the modern hardware that can do it justice.

elitedangerous

Elite Dangerous

Music

Anyway, to make up for Alt-Fest here’s a few more bands I’ve been listening to lately.

Bad Pollyanna

I was looking forward to Bad Pollyanna last week, but instead I’ll be seeing them play the Whitby Goth Weekend later in the year. It’s catchy guitar tunes paired with a slightly retro horror-goth theme. Also try Monstrous Child.

Leaves Eyes

I saw Leaves Eyes back in January, and my main memory is how genuinely happy and polite they all were! From Norway and Germany, they play some great Viking-themed symphonic metal. If you like the less heavy stuff, give singer Liv Kristine’s solo work a go.

Amaranthe

Amaranthe is one of those bands I keep going back to without getting bored. Their three vocalists – female singer, male singer and male growler – keep things varied, with a nice mixture of metal styles and pop influences. I saw them in Nottingham earlier in the year and while their complicated sound meant the mix wasn’t perfect, I’ll certainly be going to see them again. Check out Razorblade and Electroheart.

Miss FD

Time for something a bit different with Miss FD. A mix of upbeat American-electro with the more recent albums featuring a lot of moody quieter tracks. Also try Moment Of Fade and Enter The Void.

Aug 142014
 

It’s become a bit of a tradition now that when I host a LAN I show up with a new game prototype (although as it’s usually six months between them that’s not saying a lot). This time was my first attempt in Unity, and it got its first outing a couple of weeks back. Conveniently I had a second LAN the next week with a different group of friends, so I had time to make some tweaks and improvements. Here’s an eight-player team game:

If you know the Galaxy Trucker board game (which I raved about ages ago) then the ship building mechanics may look slightly familiar. It’s pretty simple – you start with a central tile and add more tiles which build outwards, making sure the connectors match up on all sides. Nothing can do directly in front of a weapon, or directly behind an engine, but that’s about it for building rules. Everyone has the same tiles available at any time, and once a tile is picked a new one spawns for everyone. After 60 seconds it’s all done and you get to use your creation.

shipbuild1

At this point you’re all dumped into a deathmatch arena, where you fly your ship around and destroy everyone not on your team. The combat is somewhat inspired by Mechwarrior, with large, slow ships that take a lot of punishment, and each part of the ship can be blown off individually. Firing weapons and boosting uses up energy, so there’s some management involved here as well. Destroy the central component to destroy the whole ship.

shipbuild2

Considering I hadn’t actually played it properly during development, it worked really well. After the first session I made the ships a lot less sluggish and added team games, which made the fighting a bit more tactical and less random. I had a few people saying it was the most fun game of the LAN, so there’s definitely potential. It still needs sound, and some non-programmer art, and I’ve got a bunch of things I want to add, but I’m really happy with it so far. I should really think of a name…

Aug 112014
 

It’s been a while since the last post, mainly because I’ve had two LAN parties in the last two weeks and getting my first Unity game prototype into a playable state has taken priority. But more about that one later. In the meantime, here is a prototype I made at the end of last year (complete with terrible programmer art).

Each player has an end zone area in their colour, and the idea is to place mirrors to direct as many of the beams into your zone as possible. You get points whenever the beams are going into your zone, and you can place bombs on other players’ mirrors to blow them up a few seconds later. First to 100 points wins. Here’s a three-player game:

Turns out that after playing it a few times, it’s not that fun. There is too much going on with mirrors popping up and disappearing all over the place, so beams change path unpredictably making it hard to plan anything. Originally there was limit to how often you could place mirrors or bombs, and the game became a manic click-fest. I then added a slight cooldown between clicks, but that was a bit frustrating.

The prototype was written completely from scratch in C++, apart from using ENet to make the networking side a bit easier. The reason for starting from scratch was purely that I wanted to have made some kind of playable game in this way, which I managed (but Unity is definitely the way forward from now on).

mirrorgame

For the networking side of things I went pure server-authoritative to ensure there were no sync issues, and as a result it’s been almost entirely bug free. The client didn’t even know which player it was until near the end of development – it simply sends mouse clicks to the server, and the server sends back all the tile state updates. This is even the case when playing single player – the client and server run in the same process, and all communication goes through the network. This is a model I’m sticking with for all prototyping, because it means that if it works in single player it’s almost guaranteed to work multiplayer, which is makes debugging and testing much easier.

Apr 182014
 

I recently dug up my university dissertation and related code, and was surprised that it still runs and isn’t as bad as I feared. It was pretty interesting at the time so I thought I’d share. It was a good call to choose a project in the games/puzzle area, as I’m pretty sure that helped me get my job in the games industry a few months later!

Full report, and running the code

RollingBlock.pdf – this is the full dissertation I submitted, in case you’re interested in reading about this in more depth.

RollingBlock.zip – this is the full source and compiled code, written in Java. I’ve not recompiled it since 2002 and some of the formatting seems a bit messed up, but it still runs (please don’t judge the code quality, this was my first reasonable sized coding project!). There is the full editor program, plus a variant on the player for puzzles with multiple moveable blocks.

To run the Editor program you need the Java JRE installed. If java.exe is in your path then editor.bat should launch the program, otherwise you’ll need to put the full path in.

Rolling Block Puzzles

The idea of the ‘rolling block’ puzzle is to roll a non-cube block (2×1 in the simplest case) through a grid-based maze so it ends up exactly covering the goal. Because the block isn’t square it takes up more room in some orientations that others, and the puzzle involves shuffling the block into the right orientation to get to where you want to go.

Here is an example puzzle, where you need to roll the blue block so that it stands upright on the yellow goal square. So the only possible first move is up-left, because there isn’t enough room to roll in the other directions:

Example of a rolling block puzzleThis is a type of multi-state, or concealed path, maze. Underneath you’re navigating a state graph of moves from the start point to the end point, but the shape of the block, and the moves it allows, means that the actual path to the solution can’t easily be seen. There are only 53 empty squares on the grid but there are 125 reachable maze states, and the shortest solution requires 32 moves (solution at the bottom).

Automatic maze generation

These types of puzzles are very hard to design unassisted, because each block added or removed impacts the state graph in many different places. Some clever people design these things by hand, but us mere mortals can use a computer.

The first thing we need is a solver. This does an exhaustive breadth-first search of the maze and builds a graph of all states and the transitions between them. In each state there are at most four legal moves so it checks if each destination state is a duplicate, add a new node if it isn’t, and add an edge between the two nodes. Here is a very small 5×5 maze:

rb5x5And this is the state graph a solver will come up with:

rb5x5graph

The numbers are how many moves are required to reach each state, so zero is the start position and 18 is the goal position (the colour coding is based on branches and dead ends). So you can see that even a tiny 5×5 maze with three obstacle blocks has quite a complex state graph.

Measuring puzzle quality

To generate good new puzzles, we have to be able to tell the difference between a good puzzle and a bad one. What makes a puzzle ‘good’ is a hard thing to pin down, but we can pull out a few ideas such as it having a long solution, many dead ends, looking deceptively simple etc. For our purposes though we need to come up with a single score for the quality of a given puzzle, such that a higher score means the layout is ‘better’ in some sense.

One approach is to analyse the graph that the solver produced, and score it using a weighted set of criteria. The criteria I used are:

  • Number of nodes – more states means a more complex puzzle
  • Solution length – longer puzzles tend to be harder
  • Number of branches – choices and dead ends are what make the puzzle interesting
  • Number of blocks – give this a negative weight to prefer simpler looking puzzles with less obstacles
  • Number of turns – requiring more direction changes can be a more interesting solution
  • Average loop length – large loops in the graph make it less obvious when you’re on the right path

Different weights can be assigned here depending on what characteristics you want in your generated puzzle.

rb_8x8C

A more interesting block – 60 move solution

Genetic algorithms

So now we can give a score to a specific puzzle, but we need to use this to come up with the best puzzle possible. For this we can use a type of genetic algorithm.

Genetic algorithms are based on the same principles as evolution in the real world: using randomness to slowly evolve towards an optimal solution. The idea is to start with a solution (any solution), and then randomly modify it a bit. If the new solution is better than the old one, keep it, otherwise throw it away. Repeat this process many times, each time starting with the best solution you’ve found so far. To tell if a solution is better than the previous one we apply a fitness function to see if it survives to pass on its ‘genes’ (or instead gets eaten by bears). After a while, you can stop the process and take the best solution found so far as your result. Despite what creationists may tell you, order can result from randomness (plus a fitness function).

In the case of a rolling block puzzle we start with either an empty board, or one with a few random blocks, and a mutation rate (maybe 5%). Each iteration we check every grid square to see if it ‘mutates’ (toggles between obstacle and empty). The fitness function is the puzzle score described earlier. If the score is higher or equal we keep it. Then just keep going as long as you want.

And that’s pretty much all you need to generate new puzzles. The key is the fitness function – the better it fits our subjective opinion of “this is a good puzzle”, the better the generated results will be. I’m sure that there are much better fitness functions out there but this one works well enough.

Here’s a video of it in action.

References

Robert Abbott’s Logic Mazes page

My multi-level puzzle applet hosted on Logic Mazes (probably won’t run with today’s security settings)

Erich Friedman’s designs

A bunch of mobile games using a similar puzzle

 

Example solution (L is up-left): LURDRDRDDDLLLULDRRRRULDLLLUUULUU

Apr 012014
 

Time for an epic game roundup post.

LAN parties, for me, and the best way to play games. Getting a load of friends together in the same room for some quality gaming time is great. There is just one recurring problem: finding games that are enjoyable for everyone to play. Ideally we all play the same thing, and the preference is for something co-operative, or at least team-based, to smooth out skill differences. However I’ve found that multiplayer games fall into one of a few categories:

  1. AAA, easy to play, polished and enjoyable experiences. That generally cost £20-40, which is a lot of money for something that will likely only get played for a couple of hours.
  2. Free to play (in the sense of actually being a reasonably fun game to play without having to pay anything). Except they usually require 5-10 hours of playing/grinding to get going.
  3. Complex strategy games. Which have a massive learning curve and require tens of hours of play to get good at.
  4. Cheap, fun, indie games. Where tutorials were last on the ever growing list of features, making them inaccessible without substantial background reading.

I’ve tried a lot of games at LANs over the years, so here’s a summary of a few old favourites along with some recent attempts:

Dawn of War

Dawn of War is a Warhammer 40K RTS game, released in 2004. It’s the go-to game for one of my groups, who have been playing it (and the various expansions) since release. It’s a Category 3 (along with almost every RTS), but luckily we all had loads of free time back then are were fans of the licence, and it’s given us years of gaming in return.

Pros: Flexible player numbers, 2-4 co-op play versus AI (stretching to 5 vs 3 AI on the hardest difficulty). Runs on any system.

Cons: It’s showing its age. And frankly it’s getting a bit repetitive after nine years.

dow

Wolfenstein: Enemy Territory

I wrote about Enemy Territory a while back. It’s a team objective-based FPS from 2005, and is the other old favourite of the Dawn of War brigade. The game has always been available for free, and is great fun if you can get at least six players. I would put this in Category 4, as being an unfinished game there is no help for new players (each map requires learning by heart because there is no on-screen information about where to go and what to do).

Pros: Supports large numbers of players (6-20+). Free. Runs on any system.

Cons: Steep learning curve. And again, we’ve been playing it forever.

wolf_et

Left 4 Dead 1 & 2

I’m sure you all know this one, but the Left 4 Dead games are zombie survival shooters. They’re great co-op games if you have exactly four players and even better in versus mode if you have exactly eight players. This actually avoids all of the problem categories, so gets played most times (or at least is the backup game).

Pros: Frequently on sale for a couple of quid.

Cons: Best with exactly 4 or 8 players.

l4d2

Diablo 3

Diablo 3 is an isometric dungeon crawler where a bunch of you run around killing hordes of monsters and grabbing loot. This sounded like the perfect LAN game – highly polished, four-player co-op, easily accessible and a challenge requiring some interesting teamwork. It’s a Category 1 game, but four of use bought it at release and sat down one evening to play through. Unfortunately it wasn’t to be. The game was just too easy, unless you put in 50+ hours of repeated playthroughs to grind up through the difficulty levels. Even the bosses seemed to fall within seconds. I know it was meant to be accessible, and it certainly is, but some kind of configurable difficulty option could have saved this game.

I believe that the recently released Reaper of Souls expansion fixes most of these issues so it may be worth another look, but it’s not cheap.

Pros: Requires no thought or skill. Very accessible.

Cons: Requires no thought or skill. Far too easy when starting from scratch. Expensive.

diablo3

MechWarrior Online

Everyone loves giant hulking robots, and when we came across MechWarrior Online recently it sounded great: a team-based, slower paced, tactical game with lots of room for strategy and less reliance on twitch skills. Unfortunately everything about the game itself conspired to make this as difficult as possible. The frontend UI is possibly the worst in any game ever (may be a slight exaggeration, but it’s really terrible), it’s a definite Category 2 in that you need to put a few hours in before you can buy and customise your own Mech (which is when the game gets fun), and the community was pretty hostile to new players.

The worst part though was the team options – each match is a fixed 12v12, but the allowable team sizes are 2, 3, 4 and 12. We got around this with our group of seven by forming two groups and hitting Start at the same time, which mostly got us into the same game, but that may just be an indicator of the number of active players. I understand that the point of the team size restriction is to allow the matchmaker to make fairer games, but I’ll stick my neck out and say that actually being able to play with your friends is much more important than slightly fairer matches. Having said that I’ve played the game a fair bit solo, and I quite like it.

Pros: Free. Fun for small groups of experienced players.

Cons: Restrictive group sizes. Not at all friendly to completely new players.

mwo

Terraria

After failing with MechWarrior we found out that most of us had picked up Terraria in the Steam sales and never played it. Terraria is basically 2D Minecraft, where you dig, build things and fight monsters. It’s a Category 4 with no explanation of how to play, but luckily we had a couple of experienced players to show us. Exploring caves in a group is pretty fun for an hour or so, but it got samey quite quickly. It’s not a bad way to break up and evening though.

Pros: Freeform drop-in/drop-out gameplay. Cheap.

Cons: No real point to the game. Can quickly run out of things to do.

terraria

Various Call of Duty/Battlefield games

I’ll lump all the more recent Call of Duty and Battlefield games together, as they’re all the same from the point of view of a LAN. You can’t fault the technical quality of the multiplayer modes in any of these games – very polished, good fun, progression systems to keep you playing, definite Category 1 games. But it’s no secret that we’re getting older, and our 30+ year old reflexes just can’t keep up with the teenagers. Since the move to online-only multiplayer, these types of games have become more frustrating. The inclusion of the grinding aspects of free-to-play to unlock decent equipment further puts me off (I gave up on Battlefield 3 when it came out because I rarely got more than a couple of kills per match, although I hear the equipment is supposed to be more balanced in Battlefield 4).

Pros: High quality experiences. Flexible teams. They’re shooters so minimal learning required.

Cons: Frustrating if you don’t have pro-gamer skills. Even the old games still command high prices.

Battlefield 2

Taking a step backwards, Battlefield 2 was a great successes. It’s old, but still looks acceptable on modern PCs. The main bonus is that it’s from an era of local LAN play and bots, which caters perfectly to our preference for cooperative experiences for a range of skill levels. I think we settled on 8 humans vs 14 bots, tweaking the difficulty level until we got close matches. It’s got guns, tanks, comedy helicopters (“Who wants to be my gunner?” – “HELL NO I value my life”), and introduced Commander mode where wannabe-Eisenhowers can set objectives and airdrop vehicles and supplies.

Maybe I’m just not that into competitive gaming but local multiplayer against AI frequently gives the best experiences, where everyone succeeds or fails together. And when you fail you work out what went wrong and have another go. Very satisfying when you finally succeed.

Pros: Local multiplayer. Flexible numbers. Highly configurable difficulty level.

Cons: Starting to show its age.

battlefield2

Jan 062014
 
Sep 232013
 

I was pleased with the quality of my miniatures photos came out, so this is my cheap, cheerful and minimal effort method of photography.

What you’ll need

  • A camera –  any basic compact will do, as long as it has a manual settings mode.
  • Tripod – or at least some way of keeping the camera still.
  • A sheet of A1-sized thin white card – I found a sheet for £1.75 in Hobbycraft.
  • A desk lamp.
  • A daylight bulb – these shine white instead of the yellow of normal bulbs and cost about £10 at Hobbycraft (and if you’re painting using a standard yellow lamp, just buy one of these now, you won’t regret it!)
  • Some other form of light, either another lamp or a bright room.

The most important thing on this list (apart from the camera) is the daylight bulb. Balance the camera precariously, improvise a white sheet, whatever, but without a good bulb your photos will look horrible!

 

Room setup

Put the card on a flat surface and lean the back on something to make a nice curved surface. Put your miniatures on the card. Set up the lamp out front, shining more-or-less straight forwards. Put your camera on the tripod, maybe a foot or so from the miniature. Something like this (not ideal because some of my white card has been cut off and used for something…):

You want to minimise shadows, which is why you put the lamp in front and not off to the side. Multiple lamps from different angles help here, as does having a big window nearby and a bright day. But don’t use direct sunlight or it’ll cast shadows again. If you’re serious you can make a light box like this one which should give better results than I’ve managed to get (but requires some non-negligible amount of effort to make, plus storage space and more lamps than I have).

 

Camera setup

This style of photography is basically the ideal environment in every possible way – you have a completely static scene, full control of everything in it, controllable lighting and as long as you need.

First put your camera in macro mode (little flower icon) – this enables it to focus up close, and we’re very close here. Then put it in manual mode and use these setting:

  • F-Stop – this controls the aperture size. Set it as high as it will go. This makes the aperture as small as possible, which has the effect of making the in-focus depth range as large as possible (you may be able to see this from the diagram is my depth of field post). This will help keep both the front and the back of your miniature in focus in your photo.
  • ISO – this controls the sensitivity of the light sensor. Set this as small as possible. This means that a lot of light has to reach each pixel before it registers, which reduces the noise in your image (more light means that the relative random differences between neighbouring pixels are smaller).
  • Shutter speed/exposure – change this until your photos come out at the right brightness. With the tiny aperture and low ISO you’ll need a relatively long exposure, maybe 1/10th second.
  • Delay mode – you want to set a delay between pressing the shutter release button and it taking the photo. This is because you’ll move the camera slightly when pressing it which will blur your image. My camera has a two second delay option which is more convenient than the standard ten second delay.

Then just snap away, adjusting the shutter speed until you get the right exposure. I prefer to slightly over expose rather than have it too dark, to get a nice white background and bright colours. You can tell I’ve taken photos at different times without a light box because the background is whiter in some images than others, but I can live with that.

And this is a shot I just quickly took. The guy on the right is a little blurry because the aperture doesn’t go particularly small on my camera, at least in macro mode. That could be fixed by moving the camera backwards a bit to reduce the relative depths. There also isn’t much ambient light today so the background is quite blue, but again that would be fixed with a light box.

Sep 162013
 

I’ve got a reasonably well painted Warhammer 40K Chaos Marine army, so I thought I’d show off a few pictures (click through for larger images). I’ve not really found the time to do any painting for over a year now (too much blogging, programming, gaming etc) but some of the new Chaos Marine miniatures look really nice so I like to thing I’ll get round to painting some eventually.

Starting off with my first HQ unit, an old Daemon Prince with wings. The skin was the first larger painted area that I managed to get a fairly smooth finish on.

This is my other large HQ unit, a Chaos Lord on a Manticore (which I ran as a counts-as Daemon Prince because it didn’t feel right to have two Princes in the same army). It’s definitely my favourite and best painted model. I don’t really like the pose of the original model with both arms lunging forwards, but rotating the right arm down gave it a really dynamic feel of pushing its way through the ruins. Trim the rocks off the back foot to leave it free standing, swap out the Lord’s arms for 40k arms and job done.

The skin of the Manticore turned out really well, and it’s the first (and possibly only) time that I managed to get some really smooth layered blending working. I’d like to work on my smooth layering more in the future (although I suspect this is just a function of time spent – I remember it taking a whole afternoon to just do the skin).

I’d wanted a set of Lightning Claw Terminators since about 1995, and these guys all look suitably menacing.

And they need a Land Raider to ride around in. It’s amazing how much difference a bit of paint chipping makes to the apparent realism of the model. I think the mud effect works well – that just involves getting some really watered down brown paint and sploshing it all over the bottom section with a big brush, not technical at all (and it’s slightly worrying when you do it, potentially ruining your careful painting underneath…).

The Thousand Sons give some opportunity to get a bit of colour into the army. Blue seems to be a really forgiving colour for blending and highlighting, I don’t know why. I try to theme all of my Rhinos so you know what squad they’re carrying, so I added some warp-flame and lanterns (some spare Fantasy bits I had lying around).

The Berserkers were some of the first models I assembled and painted since coming back to the hobby as an adult, so some of the poses are a bit weird. Never underestimate the value of good posing – more important than the paint job for getting good looking models.

 Some normal marines. The Black Legion colour scheme is fairly quick to paint – the most time consuming bit is all the silver and gold edging (straight on top of a black spray undercoat).

I ‘borrowed’ this idea for the Vindicator from one I saw online a long time ago – the body pile from the Corpse Cart kit fits almost perfectly on the dozer blade, and then pack all the holes with rubble and sand.

 The Daemonettes were a vaguely successful attempt at painting skin and brighter colours, but they look fairly messy close up (I’d like to try another batch one day). The purple claws came out really well, which I think was mainly just through drybrushing.

A couple of Obliterators. It was all the rage to have loads of these guys but the metal models are such a pain to stick together than I couldn’t face doing any more after the first two (plus they’re really expensive).

I accidently ended up with a few too many Dreadnoughts (currently up to six I believe) so I thought I’d better paint one. Nothing special but it looks fine on the table.

I did a few Orks early on to make a change from painting black. I like to keep them nice and (overly) bright – I’ve seen darker green Orks on the tabletop and they become quite hard to distinguish any details.

More recently I felt like trying something a bit different, so I tried one of the old Inquisitor models (which are twice the size of the normal miniatures). I’m quite pleased by how it turned out, apart from the green on the back of the cloak which isn’t as smooth as I was intending (hence no pictures of the back!).

 

Aug 212013
 

Licenced board games tend to follow a similar pattern to licenced video games: most of them are a bit rubbish, but a few are great and really make the most of their source material. Here are two of those.

Spartacus: A Game of Blood & Treachery

The Spartacus board game is based on the TV series and sees up to four players take the roles of the heads of battling Roman houses and engaging in plots, backstabbing, market auctions and, of course, epic gladiator battles. I’ve not actually watched any of the TV series, but it’s one of the most thematic games I’ve played and I quickly fell into the role of a great Dominus fighting for supremacy.

First in each turn is the Intrigue phase, where you draw and play cards which represent the plots and schemes of you house. For example, slaves can be set to work to bring in money, opposing gladiators can be poisoned and guards can be posted to keep your own assets safe.

Then it’s on to the Market phase where there are blind auctions to buy more gladiators and slaves, or maybe some armour and weapons – everyone hides their gold, then holds however much they want to bid in their hand, before everyone reveals at once. The winner pays all the gold they bid, so how much do you want that shield? Bid low and hope for a bargain, or bid high to ensure you win and risk  massively overpaying? Finally everyone bids once more for the right to host the gladiator fight.

Collecting slaves seems to be the way to go. My treasury is overflowing from all the cash they bring in!

The Arena phase is the action-packed finale of each turn. The host of the games chooses two players to send gladiators into the arena, to battle for the glory of their house. Once combatants are declared, everyone gets involved again by placing bets on who’s going to win and whether the loser gets seriously injured or even decapitated. Then it’s on to the fight itself.

The combat mechanics are clever. Each gladiator starts with a number of attack, defence and speed dice. When attacking, both players roll their attack and defence dice respectively, and dice are compared highest to lowest (similar to Risk). For every undefended hit, the defender has to lose one of their dice for the rest of the combat, as they get injured and become weaker. Do lose your speed and attack, and go for the long game while you wear down your opponent? Or throw caution to the wind and sacrifice your defence to maintain a hopefully lethal flurry of attacks (if you’re me: yes)?

When an attack leaves you with only two dice your poor gladiator has been beaten into submission. Be left with just one and it’ll be a while before he’ll recover from those wounds. And if you lose your last one he loses his head with it. Bad news for you, but payday for anyone who saw it coming. And if your losing gladiator survives – well, lets hope you haven’t annoyed the host recently as he has to give the famous thumbs up or thumbs down.

So what are the best bits that make me recommend this game?

  1. Fairly simple rules. A few cards to play, easy market system and streamlined arena combat make it easy to teach new players.
  2. Auctions. These are great in any game, and makes it self-balancing. Does everyone think Crixus is overpowered? Then expect to pay a lot for him in your next game. Javelins are useless? Expect to pick up a bargain. And they give plenty of moments of tension and theatricality.
  3. Player interaction. Everyone is involved at all stages of the game, with joint plots in the Intrigue phase and simultaneous bidding on the market. Even in the Arena, cheering on the gladiator you’ve backed to win keeps it interesting for those not fighting.
  4. Controllable game length. By changing how many points you need to win you can start a game that’ll done in an hour or an epic that goes on for three.
  5. Power-tripping as you decide whether a defeated gladiator was worthy enough to fight another day.

Also intriguing is the fact that it’s a ‘Mature’-rated game. Not that being ‘mature’ makes it good (if I play GTA it’s in spite of the (im)mature swearing and violence, not because of it), but because I never really considered that board games could have age ratings…

Rob with the best card in any board game ever

It’s not a perfect game, and my main complaint is that because it’s a race to get to 12 Influence points it all goes a bit Munchkin at the end. If you’ve not played Munchkin, what happens when someone is about to win is that everyone brings out the cards they’ve been hoarding all game that knock points off them or otherwise screw with their plans. Similarly with Spartacus, it’s probably the third person who tries to win who’ll actually succeed, once all the plan-foiling cards have been drawn out.

But apart from that it’s still great fun, especially if everyone gets into character a bit and plays along with the theme.

 

A Game of Thrones

I’ll be honest. A Game of Thrones is not a game you’ll want to play every day. Or every week. Or even every month. We play it once per year, at New Year’s. It’s long, challenging, exhausting and possibly friendship-ending. It’s also fantastic.

The concept is simple enough – take control of House Stark, Lannister, Baratheon, Greyjoy or Tyrell (and Martell with the expansion) and muster and send forth your armies to conquer Westeros. Hold enough cities at any time and you win.

On my way to a Stark victory

The bulk of the game involves placing order tokens on your territories, commanding your units to march, defend, raid, support and consolidate power. You have a limited number of each type of order, so it’s often a tough call to decide where to attack or where you expect your enemies to push.

So I mentioned friendship-ending? That would mainly be the fault of the Support order. When an army marches into an enemy, the total force strength on each side is compared. Support allows you to add your army’s strength to a fight in a neighbouring territory, even one between other players. Cue much negotiating and deal-brokering as everyone looks for help in return for promises of future favours. The only problem is that order tokens are placed secretly, and I’ve seen genuine horror when it’s been revealed that a once-trusted ally has decided not, in fact, to support you, but to come to the aid of the enemy. Or in fact ignore both of you and march into your now-undefended homelands.

This is another game with auctions, and remember, Auctions Are Good. Every few turns (at random) it’s all change in the royal court, and everyone uses their power tokens to bid for their place on three tracks – the Iron Throne track determines turn order, the Valyrian Sword track gives combat advantages and the Messenger Raven track allows better orders to be used. Any of these can be of critical importance at different points in the game, usually leading to cries of joy and despair as bids are revealed.

This is another game where it’s hard to avoid falling into character, especially if you’re familiar with the story. I once tainted a Stark victory while playing as Greyjoy by landing a force into undefended Winterfell right at the end of the game. I didn’t know the story at this point so I wasn’t aware of why this was bad, but despite her winning the game, a certain friend continued a vendetta against me in the rematch a whole year later. Tip of the day: don’t play A Game of Thrones with people who hold grudges…

This current edition has a nicer looking board

If you’ve got the right group of people, this is definitely a game worth playing. It’s long (our first game took six hours), it’s pretty complicated (the rule book is 30-odd pages), and it heavily encourages betrayals. But it does justice to the source material, there’s a real sense of achievement with every minor victory and it’ll leave you with stories of epic battles, unstable alliances and backstabbing that’ll be heard for years.

(Yes I remember Winterfell, let it go already!)

May 142013
 

I’ve been playing Eve Online on and off since 2006. It’s a very complex game with 500000 active accounts, all playing on the same server. What this means is that it has the most interesting economy of any game out there due to the huge number of interacting players, complex supply and manufacturing chains and a complete lack of market regulation.

This makes it a great sandbox for observing economic behaviours and principles from the real world, manifesting in its virtual economy. Here I’ve picked a few interesting or important things that I’ve come across.

Opportunity Cost

This is probably the most basic and misunderstood concept in Eve, so it’s likely misunderstood in real life as well. The opportunity cost of doing something is the price of not being able to do something else instead. For example, you’ll frequently come across advice in game like “mine your own minerals to increase your profit margin on manufacturing.”

Sounds sensible, but it’s completely wrong. Mining minerals may be a worthwhile thing to do, but it doesn’t increase manufacturing profits. They are two independent activities, and should be treated as such. Profit calculations for manufacturing should use the market value of the input materials, and not how much it personally cost you to acquire them. This is because you could have sold your mining output instead of using it. The opportunity cost using your minerals is that you can’t sell them (although there are other reasons why you might want to produce your own inputs, e.g. avoiding transaction taxes, or saving time selling and transporting, or just for fun).

Here’s a real world example. Suppose you need to clean your house, but you also have the option to work some paid overtime. You may think you can save money by doing the cleaning yourself, but if the overtime pays more than the cost of a cleaner then you’re better off working and paying someone else. The opportunity cost of doing your own cleaning is that you can’t be working at the same time.

Emergent market hubs

The design of Eve includes no central trade areas. Anyone is free to sell or buy anything anywhere in the galaxy. What is interesting is that a series of market ‘hubs’ have spontaneously emerged, with one main super-hub in the solar system of Jita. Many years ago, when there were less players and no major markets, some systems with slightly better facilities and connections were more densely populated that others. This meant slightly more market activity in those systems which attracted new players looking for markets, which grew the market even more. The result is a positive feedback loop, with the end result being that if you now want to buy or sell something quickly you go to Jita (or one of the smaller ‘regional hubs’ that grew along the same principles, but to a lesser extent).

There are a few downsides of basing your Eve industrial business in or near a popular hub. One is the rental cost of corporation offices (required for efficiently managing your industrial activities), which are much higher in popular systems. Another is availability of factories – these are limited and you can wait many days for a slot around trade hubs.

There are analogous factors at work in the real world, affecting where people and businesses base themselves. There are bigger markets and trade opportunities for London-based companies, but the rents are huge. Smaller cities have reduced costs at the expense of available markets and potential workforce. Different companies weigh up these factors and choose an appropriate location.

I found some statistics about the populations of the most popular systems in Eve, so I thought I’d compare it to the sizes of the largest UK cities. The results are quite striking:

Normalised populations of the 30 most populous Eve systems and UK cities

Comparing the normalised populations of the top 30 systems and UK cities, you can see a large degree of similarity in the distribution. There is one super-system/city (Jita/London), followed by a few large ones (Amarr/Birmingham, Rens/Manchester, Dodixie/Liverpool), followed by lots of much smaller ones.

The relative proportions are very similar. This suggests that similar price/opportunity trade-offs may be being made in Eve as in the real world, leading to a similar distribution. Eve populations seems to favour the larger hubs while the UK population is spread slightly more evenly, which could be explained by there being stronger non-economic reasons for living in a certain place in the real world than in Eve.

Edit:

Here’s a more technical version of the above graph – log of population against log of rank. You can see they both follow a power law (very high R² value means the linear trend line is a good fit), even though the absolute population numbers in solar systems are very small so are prone to noise (or large passing fleets). The drop off in population is indeed faster in Eve as I mentioned above. Further analysis is left as an exercise to the reader 🙂

Log(population) against Log(rank), with least-squares trend line

Price vs Convenience, and Time Is Money

There are many ways of making money in Eve, and the one thing they have in common is that they take time. Time is the limiting resource of both Eve players and real-world workers. Travel in Eve is also slow, and flying around for fifteen minutes to save a few ISK (the in-game currency) is inefficient, as you’re paying the opportunity cost of not doing something more profitable.

Similarly, coffee shops in busy station charge a huge markup compared to a café you could find ten minutes walk away. It’s inefficient to use your time to save a pound if it takes a sizeable chunk out of your working day.

This inefficiency creates market opportunities. Ammo and other consumables are generally priced much higher outside of trade hubs, leading to higher profits, in the same way as station coffee shops. (Well, actually it’s the people renting the space to the coffee shop that make the profit, but as there is no shop rent in Eve the producer can keep it.)

Profit vs Volume

In an efficient free market it’s possible to either make a large profit per item sold, or to move large volumes of items, but not both. Where large volumes are shifted (trade hubs, busy shopping streets) you will find other businesses in competition and high prices will be undercut. In the ‘convenience’ market described above (backwater systems, small village shops) less people can be bothered to fight for the meagre sales so there is less competition and prices can be higher.

One example is manufacturers who sell their own goods. It is worth putting a few items on sale at the place of production, at inflated prices, to pick up passing trade, but manufacturing ability far outstrips these sales volumes. The bulk of the items will need to be sold at trade hubs where turnover can be huge – a smaller markup per item but higher overall profits.

You can see this with farmers markets and farm shops. Volume is small, but profits per item are much higher. The excess has to be sold to bulk buyers (e.g. supermarkets), but the additional profits from direct sales provide a nice additional income.

Fluid markets from professional traders

In the real world, if you want to buy or sell shares or a commodity then it is nearly always possible to conduct the trade immediately. It doesn’t require waiting for another person who wants to buy exactly the same amount of shares that you’re selling. This is good because it enables more trades to take place quicker, which means more benefits to those trading. The market is said to be fluid.

Fluid markets are enabled by professional traders – if you go to a foreign exchange they will buy currency at slightly below the average price, and sell it at slightly above. Therefore there is always a reasonably priced seller or buyer for your currency. The same principle applies to shares, commodities and other goods. The higher the potential profit (total traded volume multiplied by markup) the more competition will be attracted, and the buy and sell prices will converge.

Professional trading can be seen in action at trade hubs on almost all of the 6000-odd different items available in Eve. You will see buy and sell orders for huge volumes of items that could never be for personal use. High value items like ships attract a lot of competition and will have margins of 5-10% between the highest buy order and the lowest sell order. This means that whenever you want to buy or sell a ship, you can do so immediately with very little financial loss – you’re effectively paying the traders for convenience.

A weakness in the market can be seen by looking at some of the less popular items, where you’ll see 100% or more markup between the buy and sell prices. The volumes just aren’t there to support more competition – bringing the buy and sell prices closer together would mean it’s not worth the bother of trading, given that there are plenty of other things to do in game.

Barrier to entry, monopolies and cartels

An important principle in economics is the barrier to entry to a market. There are two reasons why the profit margin on an item may be high, but only one means you’re being ripped off:

  1. Sales volumes are low, so high margins are required to make it a worthwhile business.
  2. There are high barriers to entry, so it’s hard to compete with existing businesses.

To tell if you’re being taken advantage of, look at how hard it is to set up a competing business. If it’s easy then you’re probably not being ripped off and it’s just hard to make a profit. There are lots of examples of barriers to entry, from government restrictions (e.g. pre-privatisation utilities), to long professional training requirements (lawyers, doctors), to prohibitive startup costs (building a supermarket).

You can see these in operation in Eve. One interesting development was the creation of OTEC – the Organisation of Technetium Exporting Corporations – founded on the same principles as the more familiar OPEC. Technetium is a vital component in the manufacturing chain of many items in Eve, and is only found in one area the galaxy under the control of a small number of corporations. The barrier to entry here is nearly absolute – getting into the market would require overwhelming military force and months of warfare. Hence it was practical to set up a price fixing cartel and reap the resulting massive profits.

Another historical example was the breaking of the monopoly on Tech2 goods (these are better ships and weapons than the standard ones). Originally, the ability to manufacture these goods was distributed via lottery to a few lucky individuals. The one I’m most familiar with is the Damage Control II component, where I made most of my ISK.

With no competition, the first of these things were selling at 200+ million ISK each.  After a couple of years a game mechanic called Invention was introduced which allowed anyone to make them,  but less efficiently and with a significant up-front investment required for tools, skills and materials (in the order of 500 million ISK, and several weeks of in game training time). When I jumped in, prices had dropped to around 2 million ISK/unit, with about 60% of that as profit.

Over the next few months the initial investment price dropped and now it’s possible to enter the market with a few tens of millions. Profits are right down to something like 300,000 ISK/unit, and it’s approaching the “worth it” line where I need to decide whether it’s worth carrying on production.

Thus enabling competition has successfully brought the cost of a good right down to theoretical minimum of the cost of production plus the minimum profit required to make people bother. Economics in action!