[Game]Pokitto Grand Prix

P-Zero update:

  • Made a settings menu where you can switch the terrains, edge, or car textures. Now all the contributed graphics are in use :slight_smile: (from @Pharap and @adekto ).
  • The button layout has been changed:
  • Steering: left and right
  • Thrust: A button
  • Reverse: B button
  • The setup menu open/close: C button

The binary: PZero.bin (71.6 KB)

Edit: I probably have to retry mip-mapping…

3 Likes

I think the gold solder on the circuit boards looks better than the silver, but that could just be because it matches the boarder better.

I think the ‘2D ships’ suit the style better than the ‘3D ships’ (but obviously I’m biased :P).

I think the tiles might need to be mipmapped because we proably can’t afford anisotropic filtering.

1 Like

I do not have any kind of filtering yet. I am using just the nearest-neighbor interpolation (i.e. dropping/duplicating pixels).

Hanski: the answer to the moire problem is very simple.

You need textures with lower contrast colors. The illusion of speed can be communicated and there will be less annoying artifacts

1 Like

Thanks for the tip. Maybe @Pharap has time to make one? In addition I will try mip-mapping.

1 Like

Having to be overly cautious about the colours used in the tiles seems like a bit of a nuisance.

Also I think reducing contrast would loose some of the depth.

I think mipmapping would be better.

You could probably fill in the gaps between mipmap levels by interpolating between the two mipmaps,
which should give a better result than just scaling down the larger mipmap and might not be too costly assuming fixed points are used.


For when you have a mimmap system in place, here’s some hand scaled mipmaps for testing:

CircuitGoldMip0 CircuitGoldMip1 CircuitGoldMip2 GrassMip0 GrassMip1 GrassMip2 CheckerboardMip0 CheckerboardMip1 CheckerboardMip2

If they don’t work out well, they can be tweaked until they work.

1 Like

Imho, mipmapping is not likely to work because you will run out of resolution anyhow

are you guys now using 256 colors? maybe the textures could be ‘decontrasted’ towards the distance

If you mean trilinear filtering, that would require an rgb color mode instead of 256-color paletted mode, which I am using.

Thanks for the mipmaps! I will next clean up the code a bit and put it to GitHub. Then I will start experimenting with mipmaps.

2 Likes

I think it’s worth a try at least.

The advantage of mipmapping over bare scaling is that instead of being restricted by the quality of the scaling algorithm, you can take advantage of the human eye to create something that at least looks like a decent scaling.

For example, comparing the ones I made by hand:

CircuitGoldMip0 CircuitGoldMip1 CircuitGoldMip2

With paint’s default ‘scale down’ algorithm:

CircuitGold CircuitGoldMip1Paint CircuitGoldMip2Paint

If you zoom in, you’ll see mine bears a better resemblance to the orgiinal pattern.

Not necessarily mixing the colours, but determining which colour to use by looking at the corresponding pixel on both mipmaps.

Basically, imagine the top left corner of each mipmap stage is (0, 0) and the bottom right is (1, 1) and everything between that is a fractional number between 0 and 1 (i.e. UV coordinates).

That allows you to figure out which pixel of a large image corresponds to which pixel of a smaller image by treating coordinates like percentages.

So then if you want to figure out which colour to use in a scaled tile you figure out its UV coordinate (i.e. it’s position as a percentage of the image) and then look at the corresponding pixels in the mipmap that’s larger than that scaled tile and the mipmap that’s smaller than that scaled tile.

Hopefully this image gets the idea across:

Green is the scaled tile, dark blue is the larger mipmap, light blue is the smaller mipmap.
You determine the colour by looking at both images and picking the colour somehow.

Though if we’re using the full 256 colour palette, then you could always set aside part of the palette for storing mixed colours and then just pick the colour by lerping between the mipmaps.
So far I don’t think I’ve use more than about 32-64 colours because I reused the ones from the ships for making the tiles.

1 Like

sorry for the random question but could you add some raycasted pilars for like start/finish or stuff like that? would that be to much calculations ?

Two words: billboards sprites

Which incidentally are what raycasted games use for enemies.

This is what makes it difficult and it would require a lot of in-between colors in the palette.it would be better to use direct drawing and the rgb mode, but buffered mode has other advantages.

A good idea. Yes, we are using 256 color palette. The smaller, i.e. more distant, mipmaps could be slightly more blurred and colors could go slightly more towards white.

Blue would technically be more realistic. :stuck_out_tongue:

1 Like

The point of mipmapping is preventing aliasing, which is the moire effect. Any time you’re downsampling a high-frequency signal – e.g. scaling down a high-res texture – aliasing can happen (1D example, fun example). There’s a theorem that says you can prevent this by getting rid of frequencies higher than half of the sampling frequency (rendering resolution), which in practice means blurring the sampled image – which is what mipmaps do – they’re (a pyramid of) blurred images scaled down to a half. When you’re drawing a texture and know you’re downsampling (rendering it in smaller than native size), you have to sample the mipmap, otherwise sample the original.

I think you could interpolate between the mipmaps even in low color with dithering. Don’t know how it would look though. You probably couldn’t even notice. Bilinear filtering should be enough I think.

2 Likes

It that so? So only upscaling should be actually done? I could imagine the other way round, always downscaling the textures. That is what I did with the first mipmap experiment in this game. The reasoning is that e.g. downscaling a texture of 64x64 to 48x48 is of better quality than upscaling the 32x32 texture the 48x48 size.

Edit: Now talking about the nearest neighbor scaling, but the same should be true for bilinear scaling too.

Edit: Proof using @Pharap’s texture and mipmap (the whole image zoomed up for clarity):
image

Texture 1: 16x16 original
Texture 2: 12x12. Downscaled from T1
Texture 3: 12x12. Upscaled from T4
Texture 4 : 8x8 mipmap.

It’s hard to demonstrate on such small image with such small palette, because you (or at least I) can’t even tell which of the two middle pictures is supposed to be the desired result.

Mipmaps are basically supposed to do this:

https://images.duckduckgo.com/iu/?u=http%3A%2F%2F3dgep.com%2Fwp-content%2Fuploads%2F2014%2F04%2Fmipmapping-egz.png&f=1

The left picture is obviously looking bad – it corresponds to the middle left picture in your example. It’s hard to see on the single tile, but in the video you posted above the Moirre effect is clearly visible – it’s the same thing, just better visible because it’s on larger scale. That should be prevented by using the mipmaps.

I don’t think I’ve seen games on such small consoles use mipmaps though. Looking at the original F-Zero, they don’t use it either.

EDIT:

You could also suppress the aliasing by stretching the texture – the road borders seem okay, just the texture that’s outside the road – try to make it a bit bigger. The texture will look more pixelated near the camera (whic I think is acceptable), but the aliasing effect (which at least to me seems more annoying than pixelation) will be shifted to further distance. Actually I think this is how the gameboy games generally dealt with this, e.g. look at the pixelated textures here:

Reading through the thread I thought that was everyone’s assumption. That way the scaling shouldn’t loose any visual data.

Or perhaps a colour that matches the background.
Not all the backgrounds will be blue.

Too mathsy for me to understand, I’m going to have to look for a simpler explanation.
(But the images in the “Application to multivariable signals and images” look promising.)

I started watching this video about it, but they lost me afer “fourier transform” when it fell apart with words like “convolution”, “frequency domain” and “pulse train”.

I found another video that discussed it that was alright.
From what I gather, this means to adequately scale a 12x12 image you’d need to downscale a 24x24 image?

They probably weren’t restricted to using a paletted mode.

That said, I think if we did absolutely have to do antialiasing then it would be easy enough to reserve 1/4 (64 colours) of the colour palette for colour mixing purposes.

If the UV thing I mentioned earlier isn’t practical, then I was thinking look at which image is closer in size.
E.g. for a 14x14 tile, downscale the 16x16 and for a 10x10 tile, upscale the 8x8.

I think upscaling T4 looks better than downscaling T1.
T2 retains more of the features, but T3 retains the overall shape better.

Ideally there should be a way to mix the two to arrive at something better, but we might not have the processing power for that.

Downsampling does loose data, but it generally creates a better image than upsampling because figuring out how much data to lose is easier than trying to extrapolate data that wasn’t even there to begin with.

But isn’t the display routine working that way? If you’re only representing visible on-screen pixels, is it not the case that any zoom level > 1.0 would be creating extra pixels rather than removing them?