[Game]Pokitto Grand Prix

Basically you can do SFX already with setOSC but its not exactly super easy. I will add an easier way to load and control a sound effect.

2 Likes

(Sorry for the text wall. This one really will be my last post for today.)

Do you mean a normalised direction vector?

See in my top right diagram Iā€™ve got the AI factoring in both the current target node and the next target node and itā€™s encorporating the positions of both into its vector calculations.

The idea is that you want the cars to naturally try to avoid each other by looking at each otherā€™s velocities (i.e. direction) and calculating how to move away from each other (letā€™s call that the ā€˜avoidā€™ state).
That in itself should make them deviate slightly from the path.

Once theyā€™re sufficiently far away from any other cars, they switch back to gradually manoeuvring themselves back towards the path (letā€™s call that the ā€˜targetā€™ or ā€˜pathā€™ state).
But rather than just looking at the next node and travelling straight towards that, they look at both the next node and the one after that and mix the two (e.g. lerp/slerp the vectors).
The mixing should make the movement slower and slightly more angled/curved.
(Should being the key word - this is all just theory.)

But anyway, you get the idea - the collision avoidance system should cause them to deviate from the path because the decision to avoid each other necessitates being less strict about following the path.

If thatā€™s not good enough though, you could give each car a slightly different path, either hand made or by interpolating nodes between the edges of the road somehowā€¦


One last thing.
All this talking about how they should be behaving reminded me of a technique for building flexible but complex AIs.
You may or may not have heard of them before.

Decision trees.

If you canā€™t be bothered to read the text, skimming the images should give you an idea of how they work:

Might be a bit overkill, depends how well the state machine approach goes and how complex the driving behaviour needs to be.

1 Like

Thatā€™s right.

A good idea.

1 Like

Hi,
here is the latest demo.

Changes:

  • Better steering
  • Limited acceleration to a sane value
  • More gfx by @Pharap
  • Change the ship: A + UP
  • Change the edge tile: A + RIGHT

Still no collisions!

pzero.bin (39.8 KB)

6 Likes

I was considering asking how this was going earlier in the week.
I havenā€™t been working on it because I assumed you were either still on holiday or getting settled back in at work after being away on holiday.

Excellent work. Itā€™s looking very good.
Glad to see that the track has corners now.
(Still a bit of noticable tearing, but itā€™s bearable.)

If youā€™re getting back to working on this then I can get back to working on the graphics as well.
Iā€™ll be able to do more next week than I can this week because Iā€™ve got another project that Iā€™m currently working on.

1 Like

Yes, I am now back in business.

I do not know how to get rid of it. Traditionally, tearing happens when the internal screen refresh is not in the sync with the application updating the content to the front buffer. As a result you see the combination of two frames on screen. To fix it the buffer update should be made during the vertical blank time. As far as I know, in the Pokitto LCD, there is no vblank or internal screen refresh, but I might be wrong.

Great! Maybe the background (off-road) texture update?
I will work on sound effects next, and maybe on some rudimentary collision detection.

1 Like

Honestly I donā€™t know either.

I assumed there wasnā€™t because nobody else had complained about tearing yet,
but maybe nobody else has attempted something where it would be noticable?

I suppose one way to tell would be to uncap the frame limiter and continually render differently coloured frames and see if thereā€™s any noticable tearing.

More backgrounds? Sure.

Iā€™ll have to finish what I was doing with the ships first though:

I donā€™t know if Iā€™ll have chance to work on it today, but hopefully I will.

To be more precise, I meant the ā€œoff-roadā€ texture, not the scenery texture.
(btw. I do not have your latest scenery texture yet in use)

I was also thinking that should we take into use some fixed ā€œfull colorā€ 8-bit palette? It is a tedious work to transfer bmps to C++ headers (with img2pok which is an excellent tool btw), and if the palette indexes change, that should be redone for all textures (!). Using a fixed palette would solve this.

Ah right. That can be done too.
Grass and dessert would probably look good.
The pink stuff was actually supposed to be for the road border originally.

Iā€™ve been intending to build up the palette over time based on which colours I need for the images.
Iā€™m worried that if I pick the colours first that the palette wonā€™t be flexible enough to respond to things like ā€œadd more depth to the ship spritesā€.

If I knew what image data format was needed then I could write a new tool that generates a header with both image data and palette data.

Iā€™ve already got a command line tool for Arduboy that I could adapt to Pokitto,
I expect about 75% of the code would be the same.

There is already @jonne 's BMP2POK command line tool, but unfortunately it does not support 256 color palette.

edit: https://github.com/pokitto/bmp2pok

edit: looks like it does support 8-bit palette ! I will give it a try.

1 Like

I tested a simple audio with the demo. Here are the performance results:

  • Without sound: 57 fps
  • 8 kHz: 52 fps
  • 22 kHz: 47 fps
  • 44 kHz: 38 fps
3 Likes

Thatā€™s pretty decent

2 Likes

Iā€™ll try to either finish changing the ship graphics or come up with a new graphic for the roadside some time tonight.

Iā€™m currently close to being able to tick another project off my list so Iā€™ll have time this week to focus on doing some art for this.
(Art should be a nice break from code for a while.)

Iā€™d like to try to trick convince @Vampirics to donate some art for this because heā€™s a good artist and has done art for some of the other games Iā€™ve been involved in.
(Heā€™s a better artist than I am, but thatā€™s not saying much :P)


If anyoneā€™s interested in what my other project is, Iā€™ll post a link after its done.
If anyoneā€™s still interested after that, Iā€™ll contemplate a Pokitto port :P

1 Like

Nice try, as much i would love to contribute, i canā€™t commit to this for this week because i wonā€™t have much time. but i will sure try next week if i can.

P.S. : I also have to check whatā€™s needed exactly and what are the limitations. (even though i am used to limitations)

2 Likes

if you do some lowpoly modeling and rotoscoped the art like my sample, it might make things easier.

1 Like

As a progress info I have now implemented:

  • (very) simple sound effects,
  • a simple collision detection,
  • the ship shadow, and
  • made more turns to the track (even one U-turn :slight_smile: ).

I will come up with a new demo version soon once I have finalized the changes.

3 Likes

The new demo:

  • (Very) simple sound effects,
  • A simple collision detection. Do not go off-road because it is bumby and you lose speed!
  • The ship shadow, and
  • Made much more turns to the track!

Binary: PZero.bin (61.0 KB)

5 Likes

Cool, howā€™d you do it? PROJ_SOUND_BUFFERED ?

I used Jonneā€™s SynthTest InPokittoLib as a reference. It is really simple:

In My_Settings.h:

#define PROJ_ENABLE_SOUND 1     // 0 = all sound functions disabled
#define PROJ_ENABLE_SYNTH 1
#define PROJ_AUD_FREQ 8000

In the code:

Pokitto::Sound snd;
snd.ampEnable(1);
snd.playTone(1,tonefreq,amplitude,wavetype,arpmode);
2 Likes

Oh, playtone:-(