Beta [beta] VDrift


ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
9,306
Age
51
Location
France, near Lyon
Here is a slow version of VDrift.
I put it here, even if a bit too slow, to give a taste of what the Pyra will probably be able to run a good framerate.
vdrift4.png

The Game is playable on minium detail, and alone. You will get <8fps once you had 1 A.I.
 
Also, some Car and some Tracks make the game slow down a lot. 
 
Most graphical effect (shadow, bloom, etc) need GL2 and GLSL, so they are not available.
 
When it run at decent framerate, the game is very nice!
 
*2015-01-27*: Initial build. GL renderer updated to use lightning. Drawing distance a bit dynamic depending on the framerate (from 15-10fps).
*2015-01-24*: Some more  little optims (tremor, etc), compiled with GCC 5.0 (and lto),more tracks.

*2015-01-31*: Some more compil optims, removed M3 car that was not working correctly.

*2015-02-16*: Some more optims and compil optims. Added many many tracks. Added particles effects. Published on the repo now.
 
The PND is here.     The game is now on the repo.
 
Last edited by a moderator:
Hi :)

Thanks ptitSeb for porting VDrift to the Pandora ! It's a bit slow but playable and fun on my Rebirth @ 850 MHz, with all the eye candy turned off. I tried with an higher CPU clock (1 GHz) but couldn't see much difference... Is CPU the limiting factor there, or is it the GPU ?

And do you know what's giving the Pandora a hard time ?

Cheers, Magic Sam
 
Hi :)

Thanks ptitSeb for porting VDrift to the Pandora ! It's a bit slow but playable and fun on my Rebirth @ 850 MHz, with all the eye candy turned off. I tried with an higher CPU clock (1 GHz) but couldn't see much difference... Is CPU the limiting factor there, or is it the GPU ?

And do you know what's giving the Pandora a hard time ?

Cheers, Magic Sam
On my gigahertz, it's the CPU mainly (but it can be different on Rebirth/CC), and it's mainly Physics engine (which is Bullet here).
 
I've just found this link on the Tremor webpage: an "highly optimized" fork of Tremor from the RockBox project :)

Cheers, Magic Sam
 
I've just found this link on the Tremor webpage: an "highly optimized" fork of Tremor from the RockBox project :)

Cheers, Magic Sam
My problem is not Tremor, I have it already.

The problem is (mostly everyting) is using libvorbis (vorbisfile), and this doesn't use tremor.

I you find (or code) a vorbisfile that use Tremor: that I can use :)

But, mmm, Tremor is supposed to be a simple "just swap it" replacement for vorbisfile, so I will try at least to just replace...
 
Last edited by a moderator:
Here are the main differences between Vorbisfile and Tremor APIs. I hope this will be useful in your swapping effort ;)  

Cheers, Magic Sam
 
Here are the main differences between Vorbisfile and Tremor APIs. I hope this will be useful in your swapping effort ;)

Cheers, Magic Sam
Thanks. But also, not mentionned, is OV_CALLBACKS_DEFAULT and other callbacks that are not defined in the ".h". I hope a simple copy/paste from vorbisfile work (it should, it seems self-contained).

Code:
#ifndef OV_EXCLUDE_STATIC_CALLBACKS
 
/* a few sets of convenient callbacks, especially for use under
 * Windows where ov_open_callbacks() should always be used instead of
 * ov_open() to avoid problems with incompatible crt.o version linking
 * issues. */
 
static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
  if(f==NULL)return(-1);
 
#ifdef __MINGW32__
  return fseeko64(f,off,whence);
#elif defined (_WIN32)
  return _fseeki64(f,off,whence);
#else
  return fseek(f,off,whence);
#endif
}
 
/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
 * static data. That means that every file which includes this header
 * will get its own copy of these structs whether it uses them or
 * not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
 * These static symbols are essential on platforms such as Windows on
 * which several different versions of stdio support may be linked to
 * by different DLLs, and we need to be certain we know which one
 * we're using (the same one as the main application).
 */
 
static ov_callbacks OV_CALLBACKS_DEFAULT = {
  (size_t (*)(void *, size_t, size_t, void *))  fread,
  (int (*)(void *, ogg_int64_t, int))           _ov_header_fseek_wrap,
  (int (*)(void *))                             fclose,
  (long (*)(void *))                            ftell
};
 
static ov_callbacks OV_CALLBACKS_NOCLOSE = {
  (size_t (*)(void *, size_t, size_t, void *))  fread,
  (int (*)(void *, ogg_int64_t, int))           _ov_header_fseek_wrap,
  (int (*)(void *))                             NULL,
  (long (*)(void *))                            ftell
};
 
static ov_callbacks OV_CALLBACKS_STREAMONLY = {
  (size_t (*)(void *, size_t, size_t, void *))  fread,
  (int (*)(void *, ogg_int64_t, int))           NULL,
  (int (*)(void *))                             fclose,
  (long (*)(void *))                            NULL
};
 
static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
  (size_t (*)(void *, size_t, size_t, void *))  fread,
  (int (*)(void *, ogg_int64_t, int))           NULL,
  (int (*)(void *))                             NULL,
  (long (*)(void *))                            NULL
};
 
#endif
 

Anyway, compilation is done. Linking now, I guess I will see soon enough if it works or not.
 
Last edited by a moderator:
hmm, I see...

Regarding callbacks, you could have a look here.

Cheers, Magic Sam
I have made the switch. But in fact, there is only 1 sound in ogg format, and it's loaded and decoded at start of the game only. So useless here (but I'll try to reuse it elsewhere).
 
Last edited by a moderator:
Hi ptitSeb :)

I have two little questions for you:

1) Could you render the game at a lower resolution (say 640x480 or even less) and then scale it up with Notaz' SDL ? Would it improve the performance ?

2) According to VDrift wiki, only 3 bullet ibraries are required: BulletCollision, BulletDynamics and LinearMath. Do you know which one is the most CPU intensive, and why ?

Thanks and cheers, Magic Sam
 
Hi ptitSeb :)


I have two little questions for you:


1) Could you render the game at a lower resolution (say 640x480 or even less) and then scale it up with Notaz' SDL ? Would it improve the performance ?
That would require to render in a smaller framebuffer and then render the FBO to the screen. It's doable, but I don't think it could help the fps. Again, once details and texture to low, it" CPU limited, not GPU

2) According to VDrift wiki, only 3 bullet ibraries are required: BulletCollision, BulletDynamics and LinearMath. Do you know which one is the most CPU intensive, and why ?


Thanks and cheers, Magic Sam
LinearMath is used by both other libs.


CPU is spend in physics of the CAR, and it's a mix of Bullet and Custom code. I cannot answer your question here.


But before you start searchng alternate libs, know that Bullet is very good. Much much better (fps-wise) than ODE for example (and I will not switch libs anyway, that wold require a total rewrite as most are object that inherits from bullet objects).
 
Last edited by a moderator:
Hi ptitSeb,

Thanks for your explanations, and do not worry, I won't ask you to replace any lib ;)

Cheers, Magic Sam
 
Hi ptitSeb,

Thanks for your explanations, and do not worry, I won't ask you to replace any lib ;)

Cheers, Magic Sam
Oh, some time, it can be easy or not too tightly integrated (like for vorbisfile -> tremor), but here, the physics engine is deeply mixed in the code. A switch is not a a couple of hour task!
 
@ptitSeb you do so much porting this is probably all stuff you already know, but I try to help if I can, when I look at our in-house code base, the changes we have when using tremor are in two places:
 
1. Some extra parameters to ov_read (you can see the values we pass below):
 


long result = ov_read( &m_PiOggVorbisFile.OggVorbiFile, pByteBufferPtr + amountReadInBytes, numberOfBytesToRead - amountReadInBytes,
#if !defined(_OGG_VORBIS_TREMOR)
0, 2, 1,
#endif
&section
);

 
2. Time in milliseconds vs seconds
 


bool OggAudioReader::GetLength( OggVorbis_File * file, PiTimeUnit & timeUnit, int desiredLogicalBitstream /* = -1 */ )
{
#if defined(_OGG_VORBIS_TREMOR)
ogg_int64_t timeInMilliseconds = ov_time_total( file, -1 );
if ( timeInMilliseconds == OV_EINVAL )
return false;
else
timeUnit = PiTimeUnit::FromMilliSeconds( timeInMilliseconds );
#else
float timeInSeconds = ( float )ov_time_total( file, -1 );
if ( timeInSeconds == OV_EINVAL )
return false;
else
timeUnit = PiTimeUnit::FromSeconds( timeInSeconds );
#endif

return true;
}
Of the two things, the first was obvious (compile error) but the second compiled fine, but results in a problem (maybe no audio) and took longer to track down.
 
@ptitSeb also; I don't know how the Makefile is set up (we use a custom build system), but if you haven't already enabled it, check out what the _ARM_ASSEM_ define does.
 
Back
Top