DS-Scene www.ds-scene.net
  Welcome Guest ( Log In | Register )
 
 
 »  
DS-Scene » Forum Index » DS-Scene Arcade » Roadfighter Remake - Remake of Roadfighter from NES
Get Adobe Flash player
 
         
 
 
 » DS-Scene Arcade
 
     
  Roadfighter Remake - Remake of Roadfighter from NES
Posted by vickyrare on Thu, December 16th, 2010 at 13:12 - 6 Comments
 
multi
options
vickyrare Australia

 
Roadfighter Remake:

I finally managed to finish coding Roadfighter for PC. I have been working on this project for last 2.5 years, not regularly as I have got a full time job working as Geotechnical Developer in Melbourne. I barely spent few hours a week on this project, that's why it took so long to finish. I got the idea after writing Tetris on Java. I was improving my Java skills at the time so thought that best way of learning Java is to actually write a full fledged project on it. I chosen Tetris as Tetris is my all time favorite. At the time I wrote Tetris I was still at university completing my Masters in Distributed Computing. I spent a month on it as I was having spare time after exams. Once Tetris was done I thought I should polish my skills with C++, and based on my previous thought decided to write a full fledged project in C++. After spending sometime on what project to do, I came up with the idea of writing Roadfighter. Nearly everyone have seen Roadfighter on (NES).

Roadfighter was a big jump for me after writing Tetris as Roadfighter is much more complicated, on top of that I have to learn about DirectX. So at the start I spent some time learning about DirectX. Once I learned enough about DirectX I then I started to write classes for the game.

To design the classes I played Roadfighter again on again on NES emulator to get the feel of the game. I wanted to mirror everything from the original Roadfighter. I didn't have access to the sprites and images for the original Roadfighter so in order to get those I played Roadfighter on NES emulator, paused game and took snap shots of the game.

Once I have ripped images from the NES rom I got a clear picture on how to design the game. Initially the design was very bad, but once I have got the player car on the screen, it all was becoming clearer. Remember that I started from scratch with nothing but an idea to write the game. I realized that I need some kind of 2D rendering engine to display the sprites on the screen so I concentrated on writing the 2D rendering engine. The next problem was how to scroll the background relative to player car. I spent quite a lot of time in figuring out how to scroll the background. I used the 2D tiled array where each entry represent a block of tile. Initially this worked but was very time consuming as I have to hand code the 2D tiled array. Then I searched the internet to find a tiling library which gives an visual editor to create the tiles and later recall them inside my C++ code. I came across with Mappy Tiling which was just the right tool for my game.

Initially I only created the first stage of the game, with just the background and player car wondering without any purpose. I also added controlling of player car. Remember that in the original game the player car is destroyed once it hits the road barriers. I spend some time mimicing the first stage from the original Roadfighter. The next challenge was how to detect the collision of player car with the road barriers. Initially the both background and road barriers were inside the same class. This was very bad design so I decided to split them up. Also remember that the road itself in the original Roadfighter have few turns so I have to make my design flexible enough to handle this.

Now was time to add the rival cars in the game. This was pretty straight forward, just play the original game and observe their behavior and push this into appropriate classes. I later added how to handle the collision of player car with rival cars.

Once I have got the first stage running, I then decided to support all four stages from the original roadfighter. The second stage was even easier to code as it just a straight run on the highway with no turns at all. Once I moved to create the third stage, my design exploded again as third stage is a bit complicated with left and right road barriers does not actually even. Anyways I resign my classes to handle this. Then I added the support for stage 4, which was very similar to the first stage.

After that I spent most of my time in figuring how to run the game with smooth frame rate. I considered this to be very hard as there is very little information about this topic on the internet, I tried few approaches but all suffer from poor frame rate. Anyway I did manage to get decent frame rate out of the game.

Then I decided to add the sound to the game. For sound I also did the same, I downloaded a software which can extract sound from any NES rom. Converted into wav format so sound can played during the game. For this to work I have created a very simple sound engine which can work windows wave format. Although I can be made to play mp3 format but I found easier to play wave file.

By the way I just forgot to mention that Roadfighter used the cmake which a cross platform build technology which generates native makefiles for all platforms. Initially I started version controlling using CVS but then thought this way I would not be able to share my source code with others as my CVS server was on my internal apple Mac server. Then one of my colleague at work told me about google project so I decided to host my project on google project. Google project provide versioning control with SVN and Mecurial. I started with CVS which is not supported by google, although I can convert from CVS to SVN but then at the same time I have started to use Mercurial at my work. Mercurial is better than both CVS and SVN. So I then ending up converting my CVS repository to Mercurial. So currently the source code for Roadfighter is hosted as a Mercurial respository.

At the end the game needs a installer so it can be installed on users machine. I learned how to create an installer using the cpack NSIS installer which is part of the cmake tools.

Right at the end I was fixing some bugs which discovered during latest testing. I also added the credits screen at the end. There might be still some bugs in the game. If you find some then email me, I will fix them ASAP.

I also added support for playing OGG format files as I need to play two lengthy songs at the title and at the ending screen, and if I use them as wave format then the size of each file was around 60 MB which was not desirable. So now Roadfighter uses wave format for short length sounds and OGG format for long length sounds.

By the way Roadfighter is open source so you are free to create you own clone or modify the existing game. But make sure you do acknowledge my work.

If any body needs help in compiling the code then send me an email. If you willing to contribute then email me, I will give you access to commit to the main repository.

Don't tell me that my game is rip off of the original Roadfighter on NES, I already know this, The whole point of the project was to clone the original Roadfighter. And then later allow to create new clones by changing the background and gameplay.

Things you can learn from this project.

How to build your project using cmake.
How to write good OO program.
How to write a simple 2D engine.
How to write a simple sound engine.
How to write a simple 2D game.
How to create an installer using cpack and NSIS installer.
How to version control your project using Mercurial.
How to utilize OGG vorbis file in your project.

Roadfighter remake can be downloaded from following link.
http://roadfighter.googlecode.com/files/Roadfighter-1.0.1-win32.exe

Roadfighter is hosted on Google Projects.
http://code.google.com/p/roadfighter/

If anyone is having trouble running the game, then try to install distributable of Visual C++ and DirectX.
http://roadfighter.googlecode.com/hg/resources/redist/directx_9c_redist.exe
http://roadfighter.googlecode.com/hg/resources/redist/vcredist_x86.exe

How to build Roadfighter:

The project source can be checked out using the following url.
http://code.google.com/p/roadfighter/source/checkout

You need to install Visual Studio 2008 to compile the game.

You need to install cmake 2.6.
http://www.cmake.org/files/v2.6/cmake-2.6.4-win32-x86.exe

You need to install mercurial HgTortoise on your machine.
http://bitbucket.org/tortoisehg/stable/downloads/tortoisehg-1.1.5-hg-1.7-x86.msi

You need to install DirectX SDK on your machine.
http://download.microsoft.com/download/7/e/9/7e9f48c6-f28a-469b-9b8e-cc84032efbd4/dxsdk_sum2004.exe

Procedure to build game on your machine:

First checkout the code using mercurial.

On the command prompt
Go to root of C:

hg clone https://roadfighter.googlecode.com/hg roadfighter

this command will get the source for Roadfighter.

Open the file cmakelists.txt with a text editor

set path to these variables

DIRECTX9
SET ( DIRECTX9 "D:/apps/DirectX_Mar09" )

ROOT_DIR // if your source code is in C:roadfighter then ROOT_DIR will be
SET ( ROOT_DIR "C:/roadfighter" )

Go to C:Roadfighter

Run C:appscmake 2.6 bincmake-gui.exe

this will generate all the necessary make files.

Set these two location

Where is the source code?
Where to build the binaries?

Then hit configure, and then hit configure.

This will generate the Visual Studio Project files.

Go to C:Roadfighterbuild directory

To build Roadfighter in Debug mode run
devenv ALL_BUILD.vcproj /build

To build Roadfighter in Release mode run
devenv ALL_BUILD.vcproj /build ‚Äúrelease‚ÄĚ

This will start the build on your machine. Once its done copy folders images, maps and sounds from resources to

C:Roadfighterbuildbin directory

In order to run the game in debug mode go to directory

C:RoadfighterbuildbinDebug and run roadfighter.exe

In order to run the game in release mode go to directory

C:RoadfighterbuildbinRelease and run roadfighter.exe

T create the installer, open c:RoadfighterCPackConfig.cmake. Set the value for ROOT_DIR variable

SET ( ROOT_DIR "C:Roadfighter" )
Run C:appscmake 2.6 bincpack.exe

This will generate the installer for you in the C:Roadfighter directory, make sure you run cpack after creating the Release build of Roadfighter.


 
 Signature
 
 » Comment on: Roadfighter Remake
#1
 
vickyrare Australia

  Thu, December 16th, 2010 at 13:14
top
multi
options
 
Pics from my remake.




 
 Signature
 
 » Comment on: Roadfighter Remake
#2
 
Nathan Slovenia

  Thu, December 16th, 2010 at 13:28
top
multi
options
 
Woah.

Woah.



WOAH.

Man, all I can really say is: congrats! I hope you'll continue developing remakes or even make your own games! :)

One thing I was wondering about though: why exactly did you decide to clone Roadfighter and not some other game?
 
 Signature
 
 » Comment on: Roadfighter Remake
#3
 
Kon-Tiki Belgium

  Fri, December 17th, 2010 at 19:22
top
multi
options
 
Damn, I regret having chosen "Credits". How long's that thing take? 10 minutes? And you can't skip anything! "Artwork by: some guy" and I got to watch that for an entire minute before it goes on to "Programming by: some guy", which I got to watch for an entire minute as well, before it goes on to "Sound engine by: some guy". AAAAARGH! MAKE IT SKIPPABLE! I couldn't even kill the game with Task Manager! cry Now I'm frustrated and I've yet to try the game itself...
 
 Signature
 
 » Comment on: Roadfighter Remake
#4
 
vickyrare Australia

  Sat, December 25th, 2010 at 00:59
top
multi
options
 
Hi Kontiki,

Sorry for the trouble with the credits. I do realise that this is real pain to watch the credits go through. Once i have spare time, i will make credits skippable.
 
 Signature
 
 » Comment on: Roadfighter Remake
#5
 
vickyrare Australia

  Sat, December 25th, 2010 at 01:01
top
multi
options
 
The reason i made the remake of both Tetris and Roadfighter is that i love those both games. I was trying to learn C++ at the time so thought i should start with some real projects.
 
 Signature
 
 » Comment on: Roadfighter Remake
#6
 
Nathan Slovenia

  Sat, December 25th, 2010 at 12:13
top
multi
options
 
I see.

Again, congrats, and I hope you'll make more of these! :)
 
 Signature
         
 


 
 » Users reading this topic.
 
 
1 user(s) are viewing this topic (1 Guests)
 

0 Members:
refresh



Home    Download    Forum    Release List    Reviews    RSS Feed    Search    Weblinks
Powered by FunkySkunk Forums v2 © 2007 retrohead - Exclusive to DS-Scene.net - irc.efnet.net #ds-scene 
 
Performed 11 Queries in 0.00447 Seconds. 
The page rendered in 0.70845 Seconds. 
www.ds-scene.net