Tuesday, December 24, 2013

CannonBall 0.21 - New Views & Attract Mode

This is a minor update I've been working on for just a couple of days, but it contains some fun features. Get it here.

Viewpoints

The first is the ability to change the camera viewpoint. There are a choice of three views: original, in-car and overhead. You can use the shift key to toggle between them, although this can be redefined. You can toggle the view at any point during gameplay. 

Original View

Overhead View

In-Car View

The in-car view is rather experimental. As OutRun doesn't use a true 3D engine, it's not really possible to implement such a view correctly from a camera perspective. However, it's kind of fun to play with.  The overhead view probably makes the game easier, as you can see more of the upcoming road. 

Attract Mode

I then decided to recode the attract mode to show off the viewpoints.  Doing so also reminded me how awful the attract mode AI is. The existing AI works fine for the first stage, but after that tends to crash continually. Combined with the Best OutRunners overlay showing every 20 seconds or so, attract mode never really showed the game's full potential. So I recoded the attract mode AI too. 

Some of the improvements to the AI are as follows:
  • Better at driving tracks without crashing into scenery.
  • No weird car shaking/juddering when turning corners.
  • Reduced brake light flickering
  • Can drive any stage in the game competently.
  • Selects a true random route, rather than a pre-defined route (as a result of the above)
  • Can handle split tracks correctly.
  • Handles the road split better. 
The AI code I've written is a lot simpler than the original code. It works differently, by looking at a distant position of the road and then adjusting the steering to drive towards it. If it gets too close to the road edge, it brakes. 

It still crashes into scenery occasionally, but I think that's ok. The AI is ultimately a compromise between driving safe and racing aggressively. And you want to see a crash sequence sometimes, just not at every bend.

Some of the original code still makes no sense to me, and I'm pretty sure it became a case of saying "this sort of works, let's ship it" towards the end of the project. One example of this is that the original code actually brakes when passing traffic, even when that traffic is right on the other side of a 6-lane road. You can spot this during the first two curves. The new code takes into account the x and z position of the traffic before braking. 

My AI still has difficulty passing trucks, as these drive slower than other traffic. Actually fixing this would probably take a fair chunk of code and I wanted to keep things simple. Plus the original AI suffers from this problem too, although arguably worse. 

You can toggle between the original attract mode and my new version in the game engine options located within the settings menu. The original mode uses the old AI and the new mode uses my rewrite. The code is here, if this sort of thing interests you.  



Other New Options

I finally implemented the ability to preview the audio track during the music select screen. You can enable this setting in the sound menu. Thanks to James Pearce who also submitted a fix for this.

Finally, there's a FPS counter that can be enabled in config.xml too if desired.

Following on from this I need to decide what to work on next. Most of the easy pickings are now done. Stuff like ghost-racing, multiplayer and so forth would be great but also a lot of coding work. :)

Tuesday, December 10, 2013

LayOut Open Pandora Port

Sebastian is working on a port of LayOut to the Pandora handheld. I didn't expect to see the editor ported to a handheld before anything else! Imagine, you'll be able to design and play OutRun levels whilst on the train to work. Here are some screenshots:



Grab it from here.

The forums were recently reset, so sadly a few posts were lost. They're back up and running now though. Be sure to checkout this cool CannonBall cabinet project from Mart, using an old Monaco GP cabinet he's salvaged from inevitable scrap!