[WIP] Road Star

After Zombie Jumpig I wanted to make a racing game for the Pokitto. Road Fighter is one of my all time favourites, so I started to create a clone (or remake of sorts) of this game.

The original arcade is vertical, so it’s not really suited for the Pokitto (at least without something like the Joystick n’ Rumble Hat) so I looked at the domestic versions. I’ve played a lot the Famicom/NES one in my childhood, but it’s not a really good port, because it lacks two of the six original levels. The MSX port is really nice: it has all the tracks (albeit simplified) and the play area really fits the Pokitto screen (176x192).

Road%20Fighter%20(Konami%2C%201985)%20002

So I decided to make a fast mockup to see how the Pokitto version could be, using the MSX version as a reference for the track, sprites from the arcade and a PICO-8 palette:

screenpok

I liked the result so I started to code something. First, I hacked an MSX emulator I developed some years ago in Java and I extracted the tiles and all the track data from the levels in a big array. I used that data to make a simple Pokitto program (this time in C++) to see if scrolling was fast and smooth enough (using Pokitto::Display::drawBitmap). The result was decent but somewhat slow. I’m going to scroll the screen tile by tile just as the MSX version, so I just created a hacky function to draw 8x8 tiles with no transparency and no checks (bonus: also saving two bytes in every tile):

void fastTile8x8(int x, int y, uint8_t* tile) {
    uint8_t* scrptr = Pokitto::Display::screenbuffer + ((y << 3) * 110) + (x << 2);
    for (int i = 0; i < 8; i++) {
        *(scrptr++) = *(tile++);
        *(scrptr++) = *(tile++);
        *(scrptr++) = *(tile++);
        *(scrptr) = *(tile++);
        scrptr += 107;
    }
}

You can see the result in this video. The default scroll is done with drawBitmap and when I press A I use my function to redraw the tiles :sunglasses:

My next step is developing a tool to recreate the stages (they will be similar but not 100% equal), and also improving the tiles now that I don’t have MSX limitations to create the art (two colors per line).

This is the scroll test if you want to “play” with it (there is some garbage at the end before looping).

scrollTest.bin (158.3 KB)

Update: A beta with no sound, all data for normal levels and some data for hard and mania.

RoadStarBeta.bin (210.2 KB)

12 Likes

That performance boost is quite amazing. Is it tied to a specific screen mode?

Yes, it’s tied to mode 15 as it is. I’ve implemented an FPS counter and it boosts from 30FPS to about 70FPS.

I wonder if the code could be made to support the other modes and incorporated into the PokittoLib?

Yes, it can easily be adapted. But as it is, it’s not a really good idea to add it to PokkitoLib, because you can easily write to RAM that it’s outside the screenbuffer.

Lol! People do that here daily

1 Like

This project looks very promising!

1 Like

The performance increase is very good!

Btw. there is already a tilemap class in PokittoLib which also uses a fast optimized tile blitter: https://github.com/pokitto/PokittoLib/tree/master/Pokitto/POKITTO_LIBS/Tilemap

The code limits using the optimized blitter (SDL_RenderCopySolid()) to mode MODE_FAST_16COLOR for some reason (@fmanga ?), but I think it will work in any 16 color mode if you remove that limitation. I have used it in MODE15.

1 Like

I think it was because micropython had either mode2 or mode1, so it checked for that specifically.

1 Like

Thanks, I’ll take a look. But I have a mixed screen (game screen is tiled and right side is bitmapped), so I think I need a custom implementation.

The Tilemap class support arbitrary size of tilemap screens. I have used it e.g. to create several scrolling layers, each with own tilemap.

https://talk.pokitto.com/t/on-line-python-editor/1603/166

That is for MicroPython but is uses the Tilemap class in PokittoLib under covers.

1 Like

and, making a custom implementation is half the fun!

2 Likes

Blockquote https://talk.pokitto.com/t/on-line-python-editor/1603/166

It shows “Sorry, you don’t have access to that topic!” :sweat_smile:

1 Like

Really?

Here is the video:

2 Likes

Wow, that’s fast! :sunglasses:

2 Likes

Little advances. I now have a tool in Java to aid me to design the levels. The data (metatiles, track segments,…) is stored in a JSON file and is parsed to show a preview. I also use the tool to export the images and data to the game. Enemy cars, obstacles and other details are yet to be implemented.

The engine now allows to accelerate and decelerate and checks collisions between the car and the road limits. It’s still pretty basic but I can (sort of) play the game :slight_smile:

7 Likes

Absolutely love it. Have you ever played Spyhunter?

1 Like

Thanks!

Yes, sure Spy Hunter is quite a classic. I like even more the sequel on the Famicom/NES. It was quite a feat for the console (if you forgive the ocassional slowdowns).

Would you like some music to this game?

Something like this:

The music is cool, but the sound is the latest thing I’m implementing. My original idea was to include the SCC versions of the MSX music (stage intro, stage complete, game over), and only sound effects during play but maybe I change my mind later. Thanks!

For instance, this is the stage intro music:

3 Likes