Skip to content
SyGem Software's Blog
Site Search
game

Implementing GPS navigation in a driving game – Part…

  • June 23, 2017
  • by Simon Jewell

Development of Island Overdrive is continuing nicely, with new features being added all the time. This week I have mostly been working on adding some GPS-style navigation. The idea has been used in most racing games over the last 10 years, so it seemed like something I should add!

As always, the internet is our friend here. I found this cracking article, complete with source code, that explains in a little detail how to implement Dijkstra’s algorithm – a way of finding the shortest path between two nodes in a graph. The important step here is actually creating the graph. Fortunately I am still using my heavily modified version of CiDy, a Unity asset for creating roads that is based around a similar node graph. It didn’t take long before I was able to extract the CiDy road data into the new Dijkstra-style graph.

A few modification were necessary to the graph code, mostly so I could store some extra data like the position of a node and the CiDy road that corresponds to a Connection in the graph. To test the code, a little test like this can be used:

var nodeA = GetNode(0);
var nodeB = GetNode(80); // there are quite a few roads on this island...
nodeB.SetAsStartNode();
ShowRoute(nodeA);

I have modified the ShowRoute method to do something useful rather than just output some log – namely enable some of the meshes that show the GPS direction.

Visualising the GPS navigation is a slightly different subject and very much depends on how you want to present the navigation to the player. At the moment I’m aiming for both displaying on the minimap and on the actual road surface. I may also choose to add visual cues like “Turn Left” or “Turn Right” as the player approaches a junction (something done to good effect in Burnout Paradise, one of my favourite driving games and a real inspiration behind Island Overdrive).

To get the centre marking I am duplicating the road mesh, moving the vertices in to match the width specified. This is done via a custom editor script rather than at runtime. At the moment the same mesh is used on the road and on the mini-map, but I will separate those out soon.

There are two materials, one with an arrow pointed up, one pointing down (forgive the quality of the arrow, it took all of 2 seconds to make :). At the point at which a route change is detected we iterate through the nodes in the graph. From a pair of nodes we get a Connection object, and from that obtain the actual CiDy road. If the first end of the road matches the current node then set one material, otherwise the other material is used.

So there it is – the starting point of a very useful feature. Lots to do though! The most obvious missing feature is that the GPS markers are missing from the intersections. I’d also like to change the materials to be transparent, more colourful and animated too. Separate the road and mini-map meshes so I can use a wider solid colour line for the mini-map. And there is no interface for actually selecting a destination point, so it’s pretty useless as it always takes you to the same point!

game

Sometimes Game Development is Boring…

  • May 2, 2017May 2, 2017
  • by Simon Jewell

Maybe there are some artist types who love staring at textures all day. Me? I’m a programmer, and I like staring at code all day.

So today I have mostly been staring at textures all day, and it’s boring. Worse than that, I am trying to get textures into the correct format for my new favourite terrain shader – MegaSplat. It’s an amazing shader, capable of handling up to 256 textures. That sounds amazing, but getting the textures into the correct format can be a chore. So I also bought Channel Packer from the Unity store – a simple little plugin that will pack 5 textures into 2, ready for use with MegaSplat. Then I need to create texture arrays with these converted textures. I’m also converting them to 4k where possible, which may become an option in-game.

I’m going for reasonably full PBR support, so that means diffuse, height, AO, normal and smoothness. I’ve got most of the textures I want, apart from some plain grass textures which I will probably get from GameTextures.com – their textures look really good. The idea then is to feed these into a texture graph from MegaSplat that will procedurally texture my terrain. Nothing fancy initially – a lower layer of sand blending into grass, with rocky bits where the terrain is steeper.  Here is an example of a rocky ground texture.

Hopefully in a few days I will have the textures converted and a texture graph up and running. It’s really a very cool system that should allow for quite realistic texturing to be done automatically. I don’t really enjoy texturing terrains, and I’m not very good at it either, so anything I can do automatically is very welcome!

And talking of automation, I’ve got another new Unity plugin on my radar. This one is called CScape and only came to the Unity store yesterday. It looks very powerful and will be a great way for me to create the MegaCity island I have planned. At the moment the cities are completely flat, which is not ideal, but I’m hoping the plugin will evolve to create some amazing looking cities.

game

A name, finally!

  • April 1, 2017April 4, 2017
  • by Simon Jewell

Eventually I got bored calling my new game “That car game” – I realised I needed a proper name for the game.

But choosing a name isn’t easy! I wanted something quite functional – big studios with huge budgets might be able to get away with abstract sounding names like Forza, but I need something that says exactly what my game is about. Without being too long. Or short. Or hard to say.

So we started a brainstorming exercise, writing out some key features of the game on my whiteboard. The island-based gameplay was always going to be a key part of the game, so I really wanted that in there. The other part started as just “Drive”, but the result “Island Drive” sounded like a Lighthouse Family song! Then I remembered my old 1974 MGB Roadster – 4-speed manual gearbox with Overdrive, and that sounded just right. So Island Overdrive it is then!

And here is a little preview showing a bit of progress. We have a new dynamic dashboard, terrain texturing courtesy of MegaSplat and thousands of trees thanks to the Critias Tree System. I’ll write more about these in later blog posts.

game

A status update, some plugin choices and some screenshots…

  • September 23, 2016April 4, 2017
  • by Simon Jewell

I can’t believe it’s been over a month since my last blog post – originally my plan was to write something once a week! Still, at least I have made some progress in that month.

My last post talked about the need to identify which Unity3D plugins I would like to use. So that’s where I have spent the majority of the last month, and I have managed to narrow down some of the choices.

Car Physics

I picked up Realistic Car Controller on sale last month, and I have found it easy to integrate into the game. Once the cars have been rigged (I use a separate project for this) I can export them as prefabs into the main project. I’m not 100% happy with the camera, as it tends to slide below the terrain when going down steeper parts, so I am writing an alternative camera script. It’s almost there, but seems to be a bit jerky at the moment, so I won’t go into any details yet. I’ll write another post about this when it is finished.

Water

There are some amazing looking water assets on the asset store. Reading the GAIA forum is an excellent place to start making decisions about this sort of thing – there are lots of people posting images, saying what they used to create them. Based on several of these I chose AQUAS, and I am glad I did! It’s very simple and easy to use, but hugely effective. Just check out the screenshots below!

Sky

Again, you are spoilt for choice when it comes to sky plugins. Many of them also handle time of day and weather effects too. But there was one aspect I was unhappy about with many of them, and that is how they draw their clouds. Most seems to draw to a cloud sphere that moves with the player, but I was struggling to get those to show on the car reflections. To optimise the reflections I wanted to keep the draw distance of the reflection probe low, but that didn’t cover the cloud sphere leaving me with three choices. I could either increase the draw distance and suffer the performance penalty, don’t have clouds in the reflections, or look for an alternative approach. I chose the latter, and found that Azure[sky] draws its clouds to the skybox. That’s ideal for the reflection probe, which clears to the skybox anyway. So I can have great looking clouds in the reflections without increasing the draw distance.

As an added bonus, the fog in Azure[sky] looks really great, as do the sunset/sunrise effects. I spent ages just watching the sun come up and go down again – very relaxing! It also handles time of day and has a good looking night mode. There are no weather effects yet, but the author says that they are coming.

offroadisland_1
BEAUTIFUL sky and amazing water too! All thanks to Azure[sky] and AQUAS

Terrain

I really want to use GAIA – it produces lovely terrain with minimum effort. But there is still no sign of support for tiled terrains, which I am going to need eventually. The game currently exists on a single 8k x 8k terrain with a 4k heightmap resolution. It looks great, but I want a bigger map area, more like 32k x 32k. Of course, having a bigger map comes with its own set of problems, but i want a real open-world feel. I can’t create a single terrain of that size, so I experimented with Terrain Composer 2 which has built-in support for tiled terrains.

Unfortunately creating 16×16 terrains at 2k resolution brought my PC to its knees – although it performs most operation on the GPU I was running out of memory (12GB just isn’t enough these days!). I managed to get it textured (although I prefer the texturing from GAIA), but the map felt very bumpy. I think the stamps that come with Terrain Composer have so much detail and I couldn’t find an easy way to smooth the whole terrain. Then I tried placing trees. 2 hours later (no really) my PC finally blue-screened and I gave up. The 32k  map will have to wait until I can afford a better PC! Hopefully by then GAIA will have been updated to support tiled terrains too…

Terrain Shader

Initially I chose Distingo, which has been shown off to good effect on the GAIA forum page. It certainly made the terrain look a lot better than the default shader (it’s also great value). But something was niggling away at the back of my mind. I had seen screenshots of something called Relief Terrain Pack, and it looked amazing. “Try it”, the voices kept saying. Eventually I relented and shoved RTP into my project.

First thoughts – OMG it’s complicated! So many options! But Youtube came to the rescue! I found this tutorial on how to add RTP to a GAIA terrain, and in half an hour I had an AMAZING looking terrain. With snow! Even more amazing was the performance – I can now run the game at 1080p on my PC, where before it would only run at 720p. RTP will combine the terrain textures into a single atlas (or two if you are using 8 textures), which I think is the reason for the improvements. I haven’t even touched the surface yet (no pun intended), and will play around with the water features at some point.

offroadisland_2
Snowy mountain from RTP
A close-up of the RTP snow
A close-up of the RTP snow

Level Design

So yes, most of my time has been spent designing an 8k x 8k world that probably won’t make it in to final game. But I am still learning Unity, and have at least identified most of the plugins I want to use. Once I came to terms with my inability to create the 32k world I was able to concentrate on making a demo game. I have six different levels types so I want to get a few of each around this island, mainly for the purposes of creating demo videos for a future Kickstarter campaign I am planning. I now have the beginnings of a level editor and have started on the GUI elements around that. The basic idea is that you drive around, find the level start points (which may be on roads, in the middle of nowhere, up a mountain etc.) then activate the level when you are at the start point. I may add a “quick launch” for levels that you have discovered, so you don’t have to drive across the whole map to attempt a level.

That was a rather long post – I guess that’s what happens when you write nothing for a month! Until next time…

game

Creating a Game in Unity – Workflow issues…

  • August 19, 2016April 4, 2017
  • by Simon Jewell

One of the hardest things about creating a new game is figuring out how you are actually going to make it. I don’t mean the programming or the graphics, or even the level design – these things can be changed much later in the project without too much hassle. I’m talking about which pieces of software you will use to create the levels and how they will interact.

For example, my latest game is an offroad car racing game based on a series of islands. That was the basic idea at least. There will be different types of level – things like “get from point A to point B in a time limit”. And I am going to use Unity3D, because it is amazing. But once you have a basic idea and fire up the IDE of your choice, where do you go from there? I have spent the last 3 weeks designing different islands, laying things out and trying a number of Unity packages trying to establish how these islands will be created. Once I have that I can start working on actual game mechanics.

I have worked out that I need to use several packages from the excellent Unity Asset store. Number one on my list is GAIA – an amazing terrain generator that I really like. I have tried a few, but they all seem really complex. GAIA allows me to create a random terrain very quickly, then tweak it as I see fit. So that is step one of the island workflow sorted. But then I ran into performance issues – my PC has a Core i7 920 processor with 12GB RAM and a Radeon HD 7770 graphics card. But even with a blank terrain I was struggling to get 30fps. That is where most of the last 3 weeks has been spent – trying to get a decent frame rate! Finally I uninstalled / reinstalled the latest graphics card drivers – and instantly jumped to 60fps. So that’s 3 weeks wasted 🙁

Unity Plugins

Here is a breakdown of the sort of packages I need:

  • Water (AQUAS looking like the current favourite)
  • Mini-map
  • Terrain shader (the default Unity shader looks a bit rubbish at distances)
  • Car physics (a straight choice between Edy’s and Realistic Car Controller)
  • Loads of pre-built objects (because I am rubbish at graphics)
  • Dynamic time-of-day system (or just a plain skybox?)
  • Something to speed up Unity’s trees & grass
    • I have already bought TreesManagerSystem, hoping that the next version (uNature) will help with this

 

Hopefully I will be integrating these soon. Things like water and time-of-day systems won’t have too much of an effect on the workflow. I will probably build them as prefab object to be loaded at runtime anyway. Same goes for the terrain shader – just apply it to the terrain. The main impact I will need to be wary of is performance. The trees and grass are a bit more important though, as they form the basis of the island design. I have spent lots of time experimenting with Unity trees vs SpeedTrees – the SpeedTrees certainly look great, but I think they run slower (bit of a rubbish name then!). They also require a separate editor if you want to tweak them. So I’ll probably stick with Unity trees for now. With some more careful level design and tree placement I will try to minimize areas where the car can drive through dense trees as that really seems to slow things down.

In summary then – I’ve spent 3 weeks faffing about. Time to concentrate on some more important things, like level design and the UI.

 

game

Introducing… a game, probably…

  • July 28, 2016April 4, 2017
  • by Simon Jewell

Wow, it’s been a long time since I wrote a blog post. And I lost my last blog, so this is me starting again. Welcome!

And firstly some background – I’ve been writing stuff for mobile platforms for about the last 6 years or so. In that time the market has definitely changed. It’s so much harder to get your app noticed. I believe that without advertising you don’t really stand a chance. Unfortunately I am rubbish at social media stuff and can’t afford advertising, so pretty much every game I have written in the last 2 years has bombed. So instead of making no money out of mobile games, I am turning my hand to making no money out of desktop games 🙂

So, in steps Unity. I first downloaded Unity about 18 months ago. Loaded it up and just sat there not knowing what to do. I just didn’t get it. So I uninstalled it and carried on with Monkey-X programming. Then I decided it was time to make a Match-3 game (I’d had some ideas for a while, and it just seemed like the right time). I found an amazing template which looked great, but was written using Unity. Well, I bit the bullet and went for it. It was a great learning experience and now I have decided to run with Unity for a while.

The match-3 game (Baby Boomz, available from an App Store near you) was a 2D game, but I have decided to go 3D for the next game. And my favourite type of game has always been driving games, so that seems a natural choice. Yes, driving games rock. Fortunately the Unity asset store is chock full of great assets to help with this, and I will be introducing and reviewing these as I use them. When I told Austin (my 12 year old son) I was making a driving game the first thing he asked was “can you go off-road?”. And the answer (after a quick rethink) was a resounding YES! In fact, that’s the point of the game – it’s all off-road, and set on some random Islands. Mostly. Probably. Ah, this is all work in progress and will probably change soon anyway 🙂

And that’s about it for this blog post. I’ll leave you with a quick screenshot of where I’ve got to so far…

blog_header1

Recent Posts

  • Implementing GPS navigation in a driving game – Part 1
  • Sometimes Game Development is Boring…
  • A name, finally!
  • A status update, some plugin choices and some screenshots…
  • Creating a Game in Unity – Workflow issues…

Recent Comments

    Archives

    • June 2017
    • May 2017
    • April 2017
    • September 2016
    • August 2016
    • July 2016

    Categories

    • game
    • unity

    Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
    Theme by Colorlib Powered by WordPress