Select your entertainment

> Make your own comic

Strip Editor | GTA online | 3D Pinball | 3D Printer | Carputer | Software | Films | Features

GTA clone

What is it?
The original Grand Theft Auto multiplayer experience re-created in Flash.

Whilst enjoying an August bank holiday at my girlfriends relatives lovely country Dorset home I suddenly had the idea of creating a city simulation. I could create a city then populate it with people, cars, trains and traffic control systems!

Fast forward to October 2007 - I went on a Transmedia training course for Flash ActionScript 3.0 and I suddenly had the urge to create my city simulation again! By using the power of classes in ActionScript 3 I am creating a multiplayer version of the original GTA!

7th Feburary 2008: Coming back

The game engine showing a user controlled car along with two AI cars

I've had this project on hold ever since I ran into a problem with graphic caching in the tiling system. After hitting that snag I've had other things going on like Zombie Report and wedding related thoughts.

Since my last post I've been experimenting with custom tiles to enable maps to be created with different layouts. The approach I took with this hasn't worked out as well as I'd hoped. Thankfully Tony from Transmedia pointed me towards a piece at 8 bit rocket which shows the use of a single tile sheet which then had tiles cropped out of it by grabbing the data at a certain area.

More cars
The more interesting development I've made is extending the Car class to create new vehicles. The taxi and police car you can see in the screenshot are new classes based off the underlying Car class with a few of the properties tweaked (Like max speed, acceration etc...)

I've also created a very basic AI for these two cars so that they drive around at the screen time I can drive the red car. Although all the do is drive round in circles at this point :)

Once I've created the mapping system that will assign each map tile a property I'll then be able to use this to provide the car AI with map data so that it knows where it can drive. Once the car knows where it can drive, then it just needs basic logic to stop it driving into other cars and to slow down on corners and other such routines.

9th November 2007: Adding scaling to the tiling engine

Prototype 4: The zoom level is changed depending on the car speed

Although my goal was to implement a scaling function into the tiling engine, it ended up with me re-writing the engine again! This was purely because the tiling engine wasn't simple enough, so I wanted to reduce the maths involved. One change I made was to only calcuate the position of the top left tile, then to align the tile to the right of this next to the first tile and so on. The idea being that less calculations are done.

After I'd done this I was able to introduce a scaling calculation to simluation the zooming in and out of the camera.

The way it works is by calculating the amount to scale the tiles and the camera down after the car speed goes over a certain point. It then uses the speed of the car to work out how far out to zoom the camera.

The gotcha introduced with this calculation is that if you simply scale the size of each background tile you end up with gaps in between them. So the next step is to calculate the offset introduced by the scaling calcuation and move each tile by that amount.

It appears to work pretty well, however a white crack is visible at the edges of the tiles. I tried to prevent this by rounding off some of the calculations (on a whim!) but it didn't make any difference.

My other concern is the load these extra calculation put on the processor. I guess in the finished system I can enable/disable the zoom feature depending on the performance of the client computer.

7th November 2007: Here's where the story starts

The root
I've been working on this project for a few days, so I figured it would be useful to put together a record of my work for my own use and so others can learn from this project.

I plan to release all the source code for this project, so everyone can tweak it and learn from it. Share the wealth! :)

So far I've created a class called Car which is the underlying car simulation, as shown below. The code below is what simluates the car you can play about with in the two Flash movies to the right. I'm now thinking about changing the way it works, so instead of having an acceration property I want to put in a weight and engine power properties. These two properties will allow the acceration to be calcuated.

In addition the weight will be useful for collisions in order to work out who comes off worst :)

I've got the basic tiling system working quickly and efficiently - which was a task in itself! The last time I wrote a tiling engine it turned into a pile of crap, but this time it works great!

At the moment it just uses the same tile for the ground, I need to make it load different tiles from a map file in order to simluate a city.

However my next move is to write a camera class, so that it'll be easy to tell it what to look at. Also I want the camera to zoom out when the car is moving fast, then to zoom back in when it slows down. I think this might be a little tricky, but it'll give me a really powerful game engine that I can use on other projects when I pull it off.

Prototype 2: A tiling engine moves the ground under the car, rather than moving the car itself.

Prototype 1: A car simulation. Up = accelerate, down = brake, left & right steer.