Skip to content

miniSphere 5.2.0

Compare
Choose a tag to compare
@fatcerberus fatcerberus released this 27 Apr 16:01

miniSphere 5.2.0 is the third minor release in the miniSphere 5.x series. This version brings a ton of new API functions, lots of under-the-hood performance optimizations, profiling support in SpheRun, a zlib-based data compression API, PNG image manipulation in Cell, support for targeting a specific minimum API level, and much more--plus a ton of smaller enhancements and bug fixes.

Important Considerations

  • SpheRun now supports profiling! Call SSj.profile() and pass it an object along with the name of a method and all subsequent calls to that method will be profiled. Then simply run your game with spherun --profile and When the engine shuts down, a table showing the profiling results will be printed to the terminal!

  • Using the new Dispatch.onExit() API, or Thread#on_shutDown(), your game can set up cleanup code which will run before the engine closes. This makes it easier to implement autosave systems, for example, and can be used in both Sphere v1 and Sphere v2 codebases.

  • Data compression is now supported as a first-class citizen of Sphere v2: Z.deflate and Z.inflate use the zlib DEFLATE compression algorithm, the same one historically used for Sphere v1's DeflateByteArray. These APIs are also available for use in Cellscripts!

  • You can now read and write PNG images in a Cellscript, and even work directly at the pixel level, using the new Image API. Images are loaded as 32-bit RGBA to keep manipulation of individual pixels simple.

  • Surface is now a proper subclass of Texture, allowing a surface to be used anywhere a texture is expected. This opens the door for awesome render-to-texture effects and avoids the cost of making a copy incurred by calling .toTexture.

  • Textures can now be manipulated directly at the pixel level using the new Texture#download and Texture#upload methods. Keep in mind that these are both incredibly expensive so you probably don't want to call them every frame.

  • Shape.drawImmediate has been added: this gives games the ability to draw vectorized primitives on-the-fly without the overhead of creating VertexList and Shape objects each time.

  • The image module has been removed from the Sphere Runtime. Games currently depending on the Image class should switch to using Prim.blit instead.

Changes in This Version

  • Adds support for passing command-line arguments to a game's main().
  • Adds profiling support to SpheRun; call SSj.profile() and pass an object and method name to have all subsequent calls to that function timed and included in a detailed Performance Report on shutdown.
  • Adds Image to the Cellscript API for manipulating PNG images at build time.
  • Adds an apiLevel field to the JSON manifest format which allows you to specify the minimum Sphere v2 API level supported by your game.
  • Adds a command-line option, --retro, used to emulate older API levels.
  • Adds new APIs for data compression, accessible through the Z namespace and available to both Sphere games and Cellscripts.
  • Adds Shape.drawImmediate() function which avoids the overhead of creating VertexList and Shape objects for immediate-mode drawing.
  • Adds an experimental Surface#blendOp property for setting the blending mode for objects drawn to a surface, à la Sphere v1 surfaces.
  • Adds Dispatch.onExit(), which lets you run code after the event loop exits.
  • Adds Texture#upload() and Texture#download() to allow direct manipulation of a texture's RGBA bitmap.
  • Adds Thread#on_shutDown() for running code when a thread terminates.
  • Adds Pact#toPromise() for cases where you don't want to allow outside code to prematurely resolve a pact.
  • Adds print() as an alias for SSj.log().
  • Adds SSj.now() for getting microsecond-accurate timestamps under SpheRun.
  • Adds the ability to use Surface objects as textures, without the need to call .toTexture() first.
  • Adds long-overdue support for all Sphere 1.x Surface blend modes.
  • Adds [Symbol.toStringTag] and .constructor for Sphere v2 objects.
  • Improves font handling so that the default font can be loaded from an SPK package, avoiding the need to distribute the physical system/ directory.
  • Improves the overall performance of all API functions and constructors.
  • Improves performance for all Prim drawing functions.
  • Renames the --performance command-line option to --profile to reflect its new purpose.
  • Removes the pointless --no-sleep command-line option.
  • Removes the Sphere Runtime Image class from the API.
  • Fixes an internal memory leak mostly affecting Dispatch job execution.
  • Fixes a bug in which calling FlipScreen(), DoEvents(), or MapEngine() after entering the event loop leads to a segmentation fault.
  • Fixes a bug in which calling DoEvents() doesn't run promise reaction jobs.
  • Fixes a bug where Sphere v1 Font#drawTextBox output isn't properly clipped.
  • Fixes a bug where calling Sphere v1 exit functions or closing the game window can prevent promise reactions from running.
  • Fixes a bug where the Sphere v1 Font#setCharacterImage() API fails to recalculate the font metrics after changing the image, causing text to be rendered incorrectly afterwards.
  • Fixes a bug where repeating a list command in SSj could show some of the same lines again.