[Game]Pokitto Grand Prix



Here is the video. I think there is now much less moire/flickering than before.


Looks great, @Hanski!
Not sure if someone has brought it up: do you intend to scroll the sky when the player turns?


Sure. I am just currently trying to keep fps as high as possible, but probably will eventually scroll the sky.


What technique are you using to draw the floor? Are you casting some rays too? Or is it some kind of warping?

EDIT: I can see how this could be done if the camera didn’t rotate in the curves – you’d simply shrink rows as they get further from the camera. But with this rotation I don’t know… you’d have to rotate the texture… which could be done by traversing the texture along a rotated line, e.g. by the DDA algorithm. Is this how you’re doing it?


Exactly that. Plus optimized inner (x-direction) loop.

Edit: the codes are in github


Added gfx to the github using CC0-license (Public Domain)


I’ve made a PR to add a full copy of the CC0 licence.


Finally, some real progress with billboard objects.


The hard part was to make the 3d world to move in sync with the Mode7-scaling.


Has the road tilted downwrds?
What’s the blue line beneath the cityscape?

I do intend to provide some more terrains at some point, but if you’ve been reading the forums you’ll know what most of my time has been spend on the laste few weeks.

Maybe I should make some trees while I’m at it.

Who made the Pokitto sprite by the way?


This still somewhat a test version, so it might look a bit odd. I will revert the old parameters back.

Trees would be great to have! I will take mipmapping into use also for billboard objects.

The Pokitto bitmap is from Jonne’s Bitmap example.

Edit: maybe some small rocks also? Just to keep the terrain more interesting.


I’m not complaining, I’m just wondering why it looks different.

If you’ve lowered the road, I think it gives a better sense of depth.
But if it’s going to stay like that then I think the skyline should be lengthened to meet the road.

I’d need to know the size.

That explains why it looks familiar :P

Sure, but again, I’d need a rough idea of dimensions.
E.g. how big that Pokitto image is.


That is 36x40.


If you keep the bitmaps square, the sampling indices in U and V direction will be the same (e.g 0, 2, 4, … for half size etc.) – you can then precompute these into an array. You can either have a LUT of sampling indices precomputed globally for different scale sizes, or you can compute the indices before you start drawing the bitmap. During drawing you then just look up the indices instead of computing them UxV times.


Yes, indeed! So for a 40x40 texture the lut would be 1600/2 items, right? Supposing the 32-bit array is faster than 8-bit, that is 3.2 kb. Certainly doable!

I have to try how it works. Thanks for the tip!

So @pharap, you can use the 40x40 size for the bitmaps.

Edit: I forgot I am scaling up too. So the lut size would increase a lot. Or I just use different function for upscaling. Mostly, it is downscaling anyway.


Yes, or if you want to save memory, you can do the other option, which is what I do because I need to upscale to very big sizes and a global LUT would take a lot of space.

Another tip I learned with my project: instead of mipmaps I simply use (precomputed) average color of the texture in the distance – it’s sooo much faster and also looks better in my demo (no aliasing) – but with your flat plane floor you might need to apply some smart transition or else it could be too noticable.


Yes, the second option would be suitable for upscaling.


Here’s a bunch of roughly done rocks and a cactus:

Cactus Rock RockSpire1 RockSpire2 RockSpireDuet RockSpireTrio

I was going to do a tree, but I’ll have to pick out a nice brown to add to the palette so I’ll save that for another day.


Thanks, I will try those.


@pharap Few requests: Could you make 2 mipmap images for each object in a layout as in my example below? The mipmap textures should have less contrast and be a bit more blurred than bigger versions. Also could you use the equal width and heigh for the base texture, so I can use optimized blitting?



I’ll work on it some time in the next few days.
(I’m juggling several projects at the moment.)

If you can post the mipmaps you’ve already been using that follow this technique then I can add the blended colours to my colour palette and make use of them for creating other images.