[Game]Pokitto Grand Prix

Here is the first work-in-progress version of the demo with the graphics by @Pharap. Looks quite nice already :wink: It runs at about 60 FPS. Use the 4-way-controller for steering and acceleration, and press the B button for an uncontrolled spin :wink:

PZero.bin (46.4 KB)

8 Likes

From the looks of it youā€™ve had to shrink the sky line for some reason?
What size did you have to rescale to?

I think Iā€™ll have to redo the road edging and come up with a better pattern for ā€˜out of boundsā€™ part.
It looks a bit gaudy at the moment.
(I had actually intended the purple things to be an alternate option to the green circles.)


Unfortunately thereā€™s definitely noticable tearing on the roads.
At higher speeds it looks like thereā€™s diagonal lines running through the road.

It is now 22x16 pixels. I think the proportion of the height of it to the screen height is now about the same as in F-Zero.

The circle shape is good for the road edges because it looks good also when the road make curves.
The surface part pattern could contain both small detail and big patterns. The former look good in slow speed and the latter gives a sense of speed when going fast.

I have to limit the max speed to some reasonable value :wink:

1 Like

Is the resolution for this display mode definitely 220x176?

I think I messed the calculations up slightly before, but now going by my calculations the height needed to match the FZero proportions would be ~34 for 220x176 or ~18 for 110x88.

using System;

namespace Lerp
{
    class Program
    {
        static double mapRange(double input, double inputMin, double inputMax, double outputMin, double outputMax)
        {
            return outputMin + (input - inputMin) * ((outputMax - outputMin) / (inputMax - inputMin));
        }

        const int FZeroImageHeight = 448;
        const int FZeroRoadHeight = 354;
        const int FZeroSkylineHeight = 94;
        const int PokittoHiresHeight = 176;
        const int PokittoLoresHeight = 88;

        static void Main(string[] args)
        {
            if (FZeroRoadHeight + FZeroSkylineHeight != FZeroImageHeight)
                throw new Exception("Assertion failed");

            Console.WriteLine("Hires:");
            Console.Write("Skyline: ");
            Console.WriteLine(mapRange(FZeroSkylineHeight, 0, FZeroImageHeight, 0, PokittoHiresHeight));
            Console.Write("Road: ");
            Console.WriteLine(mapRange(FZeroRoadHeight, 0, FZeroImageHeight, 0, PokittoHiresHeight));
            Console.WriteLine();

            Console.WriteLine("Lores:");
            Console.Write("Skyline: ");
            Console.WriteLine(mapRange(FZeroSkylineHeight, 0, FZeroImageHeight, 0, PokittoLoresHeight));
            Console.Write("Road: ");
            Console.WriteLine(mapRange(FZeroRoadHeight, 0, FZeroImageHeight, 0, PokittoLoresHeight));
            Console.WriteLine();

            Console.ReadKey();
        }
    }
}

Either way I might be able to redo the skyline graphic for a smaller size.

Edit:
If youā€™re sticking to 22x16 for the skyline, hereā€™s one I redid from scratch:

And hereā€™s it tiled 10 times:

Before I try to make another road border, it would be good to see some of the aternatives that I posted the other week:

Rather than the sort of abstract mess that FZero has, I could attempt to do something that looks like a circuit board, or perhaps just some grass or desert?
Trying to make something city-like would be difficult because the buildings would probably end up looking flat.

If you want both small and big details, the tiles might have to be bigger than 16x16.
If making them larger is a problem, another alternative would be to do a small pattern with tiles and then have some large objects that are drawn on top of the tiles and generated randomly.
E.g. a dessert could have some cacti, a grassy plain could have trees


Iā€™m currently reshading the ships.
Is this style of shading better, and do you think the lighter or darker looks better?

Mode 13 is 110x88x8bit

Thanks!

Those all sound fine to me.

I am actually using 8x8 pixel tiles in the engine. Road border circles are made of 2x2 tiles. My engine currently uses 3-level abstraction:

  • Tiles: 8x8 pixels
  • Blocks: Contains 8x8 tiles
  • Block map: The game field. Contains any number of blocks vertically and horizontally

There is not much difference but I actually like the original ā€œPokittoā€ best, because there is a bigger contrast and clear line between light and shade areas. That gives it more depth in my opinion.

Ok, I must have got mixed up for some reason.
Possibly got mixed up with Mode 15.

Iā€™m not quite sure what the difference is between the three.

Ok, Iā€™ll see what I can do.

Iā€™m trying to make sure thereā€™s a pattern to the colours being used so itā€™s easy to make them lighter/darker.

The block map is an array of tile maps. So that you donā€™t need a huge array to store a huge level map.

2 Likes

Oh right, that sort of thing. Normally Iā€™d call that chunking (since thatā€™s what Minecraft calls it).
(We used chunking when making Dark & Under.)

For colouring Iā€™ve got a system of ā€˜shadesā€™ where 1 ā€˜shadeā€™ is 0b0001000 (or 0x08) in RGB888 terms (which is the ā€˜epsilonā€™ of R and B in RGB565).
This allows me to lighten or darken images by adjusting the ā€˜shadeā€™ of every colour used and to increase contrast by changing the step between ā€˜shadesā€™.

The two ships I had before were 2 ā€˜shadesā€™ apart for each colour.
This new one here is 4 ā€˜shadesā€™ apart for each colour:

Anybody knows any neat algorithms for NPC ships that the user is racing against? Like:

  • Predefined path: there are predefined control points in the track and the NPC ship path is interpolated to follow those.
  • the NPC ship detects the track left and right edges and randomly wanders between them. It can also try to block the player ship.
1 Like

I have a book on Game AI. Iā€™ll pop upstairs and see if it has anything on the subject.

1 Like

Is the road perpetually straight or will there twists and turns.
And will the road be randomly generated or will there be a map?
(Has an impact on what options are available.)

I found this:
https://www.gamasutra.com/view/feature/3920/the_pure_advantage_advanced_.php?print=1

You can skip most of it and head straight to the ā€˜Implementationā€™ section.
Upon reading it I feel kind of cheated because I suspect racing games that Iā€™ve played are doing something similar, but itā€™s an interesting approach.

1 Like

Nothing really on this subject in the book (Programming Game AI by Example / Mat Buckland)

Of the top of my memory car games use a combination of waypoints & ā€œlook-aheadā€ envelope and collision avoidance.

This means:

  • optimal path through the course is mapped as waypoints. Waypoints include optimal velocity
  • computer vehicles steer towards waypoints
  • computer behaviour is limited to n waypoints ahead (ie. behave in a more ā€œnaturalā€ way)
  • in the close proximity, computer vehicles are governed by proximity / collision detection
  • eventual path becomes a compromise between proximity behaviour and trend towards optimal set waypoints
2 Likes

There will be turns and there is a map also.

Yeah, looks like we can win only if the computer kindly lets us, poor humans, to do so :wink:

1 Like

I think for MarioKart, the track are split into rectangle regions, each having a destination point within the next region. So an npc is always driving towards the ā€˜nextā€™ region. Something like thisā€¦

[edit] Like Jonne said :slight_smile:

Iā€™ve got to dash off for the day, but hereā€™s a half-scribbled mess of ideas that Iā€™ll attempt to explain tomorrow:

(Probably the scruffiest thing Iā€™ve drawn in a while.)

Basically it should be possible to calculate:

  • A way for a car to overtake the player
  • A way for a car to avoid colliding with the player
  • A way for a car to correct its path after having to dodge the player

Most of which use velocity vectors.
The ā€˜path correctionā€™ requires a node map (a list of points would suffice, perhaps with weights or vectors for creating curves/interpolating).

I havenā€™t actually figured out and of the maths involved, these are just ideas off the top of my head, but Iā€™m reasonably convinced that theyā€™re possible.


And obviously the AI is going to need to be a sort of state machine, perhaps built with a sort of ā€˜strategy patternā€™ to make it easier to change the behaviour.

A lot of good ideas! A picture always makes it clearer to me.

I think that the first step would be just placing waypoints/control points/destination points throughout the course. Each waypoint contains the position (obviously), speed, and rotation vectors. Then I just interpolate each vector between the current state and the waypoint. The problem would be that the ships are going one after another throught the same route, but that can be helped by having some randomness on how fast they interpolate.

After that more AI can be added.

Also I was thinking to try to add some (simple) audio early in the development, to see how much it affects to the performance.

Btw. I have now done a very fast scaling and blitting implementation of an arbitrary bitmap, which can be used to scale npc ships and other objects in the horisont. Maybe also mipmapping is of better use there.

1 Like

Let me add a few sound features to make it a bit easier. Been meaning to do it now that the tracker is mostly functional

2 Likes

What are you planning to do?