Thursday, September 25, 2014

Voronoi mock-up

Richard made this mock-up for the Voronoi scheme. I think it's looking great. Perhaps this is the moment it makes sense to finally buy Unity pro to get the bloom effects going.

Monday, June 2, 2014

Rationing rare occurrences in Chalo Chalo

I like when unexpected things happen in games. Better still is when the unexpected thing happens just when you feel that you've gotten to know the how the game world works. Its impact is maximised at that moment.

We have some unexpected things that happen now and then in Chalo Chalo, we call them rarities. They're designed to foster a sense that the game world has hidden depth and mystery, and to keep players on their toes.

The simplest way to implement these rarities would be to assign each rarity a likelihood. A random number would be generated and compared to the likelihood of the rare thing happening, if the likelihood was lower than the random number, the rare thing would happen. But given that the aim is to have the unusual things happening just as players feel familiar with the game, a better way to set this up is to arrange things so that the longer you've played without seeing anything out of the ordinary, the more likely you are to see something out of the ordinary in the next race (which would not be the case with the simplest set up).

Chalo Chalo is built to include a concept of 'rarity pressure'. You can think of it as 'something in the air' that influences how likely strange things are to happen. The higher the pressure, the more likely that a rarity will manifest itself. When nothing out of the ordinary is happening, the rarity pressure is incremented after each race. We want rare things to be more likely if you didn't see any for a while, and less likely if you did. so to complete the scheme, each rarity has a 'rarity_pressure_release' value. The rarity pressure drops by this amount after the rarity manifests itself.

We use a JSON file to describe all our rarities. In this file we assign likelihoods, we can also set up relationships between rarities so that they can be nested, and add directives to have rarities exclude or require one another. We have a class that's responsible for modifying/reporting rarity pressure, and another that's in charge of parsing the JSON file and selecting rarities for the next race. Because we want rarity pressure to persist between play sessions, we're currently storing it in playerprefs.

Tuesday, March 25, 2014

Chalo Chalo nominated for A MAZE award

We're excited to share that Chalo Chalo is one of the five games nominated for the 2014 A MAZE local multiplayer ('Human Human Machine') award. This also means the game will be playable as part of the festival.

Richard and I will muster in Berlin for jovial festivity participation and stony-faced note-taking. We need to figure out whether the temporarily game-breaking round of changes we want to make to the game are feasible before then. Anyway, it looks like it will be a lot of fun. Perhaps see you there!

Monday, February 17, 2014

Post-its versus Voronoi cells

In the builds of Chalo Chalo that exist so far, the race maps look something like this.

The landscape is punctuated by differently coloured squares that function as contrasting terrain types. Populating the map with squares (well, flattened cubes really) has been a great way to get something interesting up and running quickly; They're easy to create at run time, and this approach allows us to use Richard's cunning routines to nudge their randomly chosen position to make for more interesting races.

What bothers me about the squares isn't their simple geometry, I like that, it's the way they overlap. The terrain patches resemble post-it notes stuck over one another. This suggestion of layers isn't a good fit with the idea of a unified racing plane we've had in mind.

Not knowing whether it will all work out yet or not, here's the plan for how I want to change things. We'll generate and position squares as before. But then we'll do a couple of extra things. We'll generate a Voronoi diagram over the top of the squares. For each cell in the diagram we'll do a raycast downwards from its center and see what squares we hit. The cell will take on the terrain type found most often in the squares directly beneath it. So in a sense the Voronoi diagram will quantize the terrain data from the underlying squares, but it will be mapping it to irregular polygons.

I'm keen on this approach because it will let us keep using stark geometry, while introducing a more organic element, and the tesselation will visually flatten the playing field--consistent with the idea of a single racing plane.

This is a mock-up showing the cell structure

You can find me on twitter here. And Richard here.

Thursday, February 6, 2014

Naive-ish physics

No Wheelcolliders here. Unlike in the early builds I am using Unity's built-in physics here. As before the terrain types are detected with raycasts. The player is locked to a single plane using position and rotation constraints. The damping of the player's rigidbody, and an input force modifier, are adjusted in response to the terrain type. Here the dot is struggling on ice.

Saturday, January 25, 2014

Steering, skidding and avoiding spin-out

Richard and I talked about the possibility of having the handling of the dots feel more 'car' like, and wondered whether that would make things more fun. More skidding and steering.

I've been fiddling with Unity's wheel colliders to see how feasible this would be. In case you didn't come across these before, they're a special kind of physics-enabled object that have independent friction curves for forward (rolling) and lateral (skidding) movement. Wheel colliders also have steeringAngle and motorTorque properties to quickly get them behaving as you'd want when building some kind of vehicle.

I've based my 'dot' controller here on a stripped-down version of the futuristic sports car controller in Unity's new Sample Assets package.

The first problem I noticed is that it was very easy to get into an uncontrolled spin, which wasn't much fun. There ought to be plenty of skidding round corners, but very little spinning.

While googling spin-out I found this wikipedia article

in a car with a short wheelbase, the short lever arm from the CM to the rear wheel will result in a greater lateral force on the rear tire which means greater acceleration and less time for the driver to adjust and prevent a spin out or worse.

Sure enough lengthening the wheelbase helped a great deal.