[Game]Pokitto Grand Prix

Hrm, perhaps. I’d have to see it (the grass tiles) in action to know whether it’s noticeable.

In modern games they have bothered to add pseudo depth to the floor.

The first two look reasonable.
They most certainly fit the ‘abstract patterns’ that I mentioned:

Beh, reusing existing stuff takes some of the fun out of it. :P

The best bit is they’re cheap because they’re just scaled 2D sprites pasted onto the screen.

1 Like

I agree. At this time I probably will concentrate on other features.

Yes, certainly. Along with the other ships on the track. I actually started to code it earlier, but had problems with the 3d object model, which was unaligned with the road 3d model (or 2.5d if you like). I am coming back to it after a while. However I already made a fast scaler for the billboard bitmaps and ships.

This is a very good idea too!

A 5x5 grid of all colour/ship combinations, with the ‘canonical’ 5 going diagonally from top left to bottom right:

AllShips

And all the new terrain tiles:

Grass Sand Sea SciFi

Grass, sand, sea and sangria sci-fi.

Made using the same colours as the ships, as I said I would. Can’t wait to see them in action.


Don’t forget you can always use mipmaps if you need more speed.

If you figure out a suitable size, I can come up with some billboards (cacti, grass blades, trees, buoys, metal trees?).

Maybe these would give some ideas.

image
image
image
image
image

I like the last one most.

If you want we can go with the current one. I will make a new demo in few days so you can try yourself.

The common theme here seems to be ‘abstract patterns’.
I might be able to do a circuit board or something pixely.

1 Like

Thanks! I have the “texture-to-cpp” tool chain ready now so adding those should not take too long.

Yes, please! Thought, it might take some time until I have the system ready for them.

edit:

Sea is my favorite at first look :slight_smile:

1 Like

Good to hear, it was the hardest to figure out.
I had 2-3 failed attempts.


Here’s a circuit board. It’s not got much depth but the pattern makes up for it.
I couldn’t decide between gold or silver, so here’s both:

CircuitGold CircuitSilver

2 Likes

Checkerboard
Checkerboard

Diamond
Diamond

I’m not sure about the colour combination of the diamond pattern.


I threw together my own palette extractor while I was at it, and it generated this:

palette

I had to do some trickery to get the colours in the order I wanted though.
(I’ll have to think of a clever way to group/sort them so that they group together in a logical order by default.)


Since you mentioned the sea, here’s a peek at my failed attempts next to the final version of the sea tile:

SeaWip

2 Likes

How does it work? Generating the palette for 256 color image which contains all the graphics is one of the manual phases I have to do with Gimp. NetPmb needs the palette as a 256x1 pixel image, so I have to do it manually as well.

Applying the new palette to all old textures and making a C code of them is done by a script.

In a word: C#.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace PaletteSpitter
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Color> set = new List<Color>();

            foreach (var file in args)
                using (var bitmap = new Bitmap(file))
                    for (int y = 0; y < bitmap.Height; ++y)
                        for (int x = 0; x < bitmap.Width; ++x)
                        {
                            var colour = bitmap.GetPixel(x, y);
                            if (!set.Contains(colour) && colour.A == byte.MaxValue)
                                set.Add(colour);
                        }

            if (set.Count > 0)
                using (var result = new Bitmap(set.Count * 8, 8))
                {
                    using (var graphics = Graphics.FromImage(result))
                        foreach (var pair in set.Zip(Enumerable.Range(0, set.Count), Tuple.Create))
                            using (var brush = new SolidBrush(pair.Item1))
                                graphics.FillRectangle(brush, new Rectangle(pair.Item2 * 8, 0, 8, 8));

                    result.Save("palette.png");
                }            
        }
    }
}

It’s not very sophisticated, I threw it together in 5 minutes and spent 25 playing around with it to try to get it to sort the colours in a sensible way (and then gave up on that).
I could rewrite it to generate a 256x1 image easily enough.

Given time I could write something more sophisticated.

Perfect! I think I can use it almost as such. The only changes needed are that the resulting image size is set.Count x 1 pixels, and that the first color is pink (255,9,255), which I use as a transparent color.

With an image that’s only 1 pixel tall, the ‘graphics’ and ‘brush’ stuff can be skipped and SetPixel can be used instead:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace PaletteSpitter
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Color> set = new List<Color>();

            foreach (var file in args)
                using (var bitmap = new Bitmap(file))
                    for (int y = 0; y < bitmap.Height; ++y)
                        for (int x = 0; x < bitmap.Width; ++x)
                        {
                            var colour = bitmap.GetPixel(x, y);
                            if (!set.Contains(colour) && colour.A == byte.MaxValue)
                                set.Add(colour);
                        }

            if (set.Count > 0)
                using (var result = new Bitmap(set.Count, 1))
                {
                    foreach (var pair in set.Zip(Enumerable.Range(0, set.Count), Tuple.Create))
                        result.SetPixel(pair.Item2, 0, pair.Item1);

                    result.Save("palette.png");
                }            
        }
    }
}

(Maybe worth mentioning: powershell can use .net stuff, so this can be turned into a powershell script as well.)

Need to include something?

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc /t:exe /out:genpalette.exe genpalette.cs
Microsoft ® Visual C# Compiler version 4.7.2556.0
for C# 5
Copyright © Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft ® .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

genpalette.cs(1,1): error CS0116: A namespace cannot directly contain members such as fields or methods
genpalette.cs(28,1): error CS1022: Type or namespace definition, or end-of-file expected

Could be that System.Drawing requires a reference.
Are you using Visual Studio, Roslyn or some other tool to compile the code?

If you’re using the bare compiler then maybe:

csc /r:System.Drawing.dll /out:genpalette.exe genpalette.cs

just used from the command line

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe

I have visual studio installed also. I will try it.

From Visual Studio you just open the Solution Explorer, right click References, .NET tab and find System.Drawing.
(Assuming they haven’t changed it.)

Otherwise, you can try what I posted above.

Thanks! Added that reference in VS and added using System.Drawing;

Now it compiles :slight_smile:

1 Like

By the way, I was originally using a SortedSet which is why the list is called set.
I should really change it to colours or palette, but like I say, I threw it together in a few minutes.

C# is one of my favourite languages for writing ‘throwaway’ programs because it’s easy to write useful things quickly.

1 Like

Yes, it is a beautiful language.

1 Like

Works now in my toolchain. It helped a lot. I no more need to make one big image where I collect all the textures to make a common palette :slight_smile:

1 Like