Streaming sound tracks, FMOD linking improved

Posted on

Castle Game Engine logo with title
  1. Our sound engine now supports streaming sounds.

    “Streaming” means that we decompress the sound (like OggVorbis) during playback, in parts (as needed). This technique allows much faster sound loading (loading sound as “streamed” is almost instant). It adds a small run-time overhead to playing given sound, although in practice it is not noticeable at all, even on mobile devices (where the benefits — much faster loading — will be very noticeable 🙂 ).

    In general case, I advise to use it for longer sounds (like music tracks).

    The default remains to load sounds “complete”, just like before.

    To use this feature, call LoadBuffer method with slStreaming or use <sound ... stream="true" /> in sounds XML file. See the manual about sound for general information how to play sounds, including LoadBuffer and sounds XML files. An example is in our play_sounds example, just uncomment proper lines in gamestatemain.pas and CastleEngineManifest.xml (search for “streaming”).

    This feature works with both OpenAL and FMOD sound backends.

    Thousand thanks for implementing this feature go to Andrzej Kilijański!

  2. FMOD dynamic loading is now improved, which is particularly useful for Linux users.

    • The FMOD library no longed needs to be present at compile-time on Linux, it only needs to be present at run-time. You no longer need to pass -k-L... to FPC to link with FMOD.

    • If the FMOD library is not present at run-time, we make a warning (in log) and continue using existing backend. In effect, you can have the application use FMOD if possible, but fallback on OpenAL. This applies to all platforms using dynamic loading of FMOD, like Windows and Linux.

    • It fixes problems with linking with FMOD using GNU binutils 2.32 (like in Debian
      Testing). The linker was previously reporting errors bad value.

Comment on this post ➤

ASTC texture compression, progress of engine Delphi compatibility

Posted on

Car exported from Blender 2.8 as Wavefront OBJ
  1. Castle Game Engine now supports ASTC, which is a great GPU compresion method available on most modern mobile devices (Android and iOS). You can easily compress your textures, and then use them at runtime, using the appropriate declaration in material_properties.xml file.

    The usage is described in details in ASTC compression support added to Castle Game Engine (also available in Polish) article by Andrzej Kilijański, who implemented this feature. Thousand thanks!

  2. I pushed Delphi compatibility further. Many more units are supported, in particular our file reading/writing/searching system using URLs, including our XML support (used throughout the engine). To have uniform XML support, I introduced Delphi units DOM, XMLRead, XMLWrite that wrap Delphi XML implementation (using MSXML and COM interfaces) in an API compatible with analogous FPC units.

    It all can be tested by compiling Delphi example in CGE sources. I hope to make more progress very soon 🙂

P.S. More cool stuff from Andrzej is coming — streaming music 🙂

P.P.S. Blender 2.8 was released! Note that CGE supports various 3D model formats supported by Blender 2.8 out-of-the-box (Wavefront OBJ, glTF 2.0, X3D, Collada, STL). (Unfortunately, exporting to the best formats — glTF and X3D — is far from perfect now in Blender 2.8. E.g. glTF exporter doesn’t apply modifiers, materials remain gray, transformation hierarchy has duplicated nodes. And X3D exporter can crash. As a workaround, OBJ exporter always works 🙂 )

Comment on this post ➤