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.
(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.
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.
Thatās right.
A good idea.
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)
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.
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.
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.
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
Thatās pretty decent
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
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)
if you do some lowpoly modeling and rotoscoped the art like my sample, it might make things easier.
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 ).
I will come up with a new demo version soon once I have finalized the changes.
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)
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);
Oh, playtone:-(