Results 1 to 10 of 12

Thread: Asphyre Sphinx access pattern

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Asphyre Sphinx access pattern

    Hello Everyone,

    Got here Apshyre Sphinx (1.0) . My problem is , I created a relatively large number of images for the first level. And it takes a long time to load at first. So I decided
    I do a SpriteSheet. Or Pattern as they are called in Ashpyre.

    Till now I was drawing my images likes this :

    BackGround[z,x,y].ImageName:= Images.Items[map.Layer[z].Lines[y+MapOffset,x].ImageIndex].Name;

    What I cannot seem to figure out (google found a few resolutions posted by DracuLIN but unforunately MyCanvas.Texmap does not have the same stuff by me as by him...)
    how do I access Images.Items[0].Pattern[2] for example ? (it would be to easy if I could access it like that.

    Thank you.

  2. #2
    Mind first telling me why are you using Aspyhre Sphinx 1.0? That is pretty old.

  3. #3
    Quote Originally Posted by SilverWarior View Post
    Mind first telling me why are you using Aspyhre Sphinx 1.0? That is pretty old.
    Hi,

    It's compatible with Lazarus FPC ... and I have found a functional Sprite Engine for it. This time I got eveything right... Scrolling works perfectly...Collision works...I have levels I have menu...I have everything ...

    BUT

    It takes a long time to start when I start the game... because I've added the images seperatly... I need to use a SpriteSheet. Which I created...but I don't know how to access image[0].pattern[20] ...

    Thank you.

  4. #4
    Hi,

    Think I found it ...

    // something animated
    BackGround[z,x,y].Image := mySpriteSheet;
    BackGround[z,x,y].AnimStart:=2;
    BackGround[z,x,y].AnimCount:=2;

    or
    // single sprite
    BackGround[z,x,y].Image := mySpriteSheet;
    BackGround[z,x,y].AnimStart:=44;
    BackGround[z,x,y].AnimCount:=1;


    Since I have in sprite sheet animated and non animated parts... I predefine which position has animation how much etc..I think it could work. Will try it.

  5. #5
    Quote Originally Posted by robert83 View Post
    It's compatible with Lazarus FPC ... and I have found a functional Sprite Engine for it. This time I got eveything right... Scrolling works perfectly...Collision works...I have levels I have menu...I have everything ...
    Asphyre Sphinx 3 also supports FreePascal/Lazarus:
    http://www.afterwarp.net/products/asphyresphinx3
    So does Asphyre Sphinx 4 which is now maintanied by PGD user MarcoCestari
    http://www.pascalgamedevelopment.com...ficial-release)

    Now I only don't know if there is a Sprite Engine available for them.

    Quote Originally Posted by robert83 View Post
    It takes a long time to start when I start the game... because I've added the images seperatly... I need to use a SpriteSheet. Which I created...but I don't know how to access image[0].pattern[20] ...
    Have you considered using of ASDb archives for storing your images. If my memory serves me correctly using them can greatly improve loading times without the need for you to put all images into sprite sheets. I belive all versions of Asphyre Sphinx came with an example of using these archives.

  6. #6
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    Sprite sheets in the context of hardware accelerated graphics are essentially a form of texture atlas. As Silverwarrior suggested, packing your images into atlases (as I assume packing into an ASDb does) will greatly improve loading and rendering times as multiple sprites/frames can be loaded in a single image (meaning that you animate texture co-ordinates across an image for each frame rather than selecting a new image)

    Also depending on the game you're writing you may be able to implement a caching system that leaves some images to be loaded in the background as the game is running. For example a level in a shootem up doesn't need the graphics for the end boss loaded immediately meaning that the level can be started more quickly. The end boss graphics can be slowly streamed in across multiple frames so as not to cause the engine to slow down (such streaming is how games such as grand theft auto manage giant worlds)

    Can you tell us about the capabilities of this sprite engine you're using? what is it letting you do that you need? perhaps we can suggest more modern and maintained engines you can use - They'll give you less headaches in the long run.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

  7. #7
    Quote Originally Posted by phibermon View Post
    Sprite sheets in the context of hardware accelerated graphics are essentially a form of texture atlas. As Silverwarrior suggested, packing your images into atlases (as I assume packing into an ASDb does) will greatly improve loading and rendering times as multiple sprites/frames can be loaded in a single image (meaning that you animate texture co-ordinates across an image for each frame rather than selecting a new image)
    As far as I know Asphyre Sphix texture manager already stores its textures in one or multiple atlasses. And that is basically what is causing major slowdowns when loading individual textures as the texture manger recreates the internal atlass every time.
    Now when you are loading images from ASDb archive texture manager waits for all mages to be loaded into memory before it recreates its internal atlass. This is why loading them from ASDb archive is much faster.

    Now if my memory serves me correctly Lifepower (the original author of Asphyre Sphix library) was planning to extend ASDb archive with ability to store already generated atlases in it and not only individual images but I'm not sure if he ever managed to implement this.

    As far as ASDb archive goes. they are not intended to only store Images but also other resources like Sounds or even cusom files. So basically you could store all your game resources in them. In Asphyre Sphinx 1 ASDb files were comressed with LZ77 compression and could be enycripted with XTEA 128-bit cipher. In Asphyre Sphinx 2 and newer ZIP-like compression was used instead.

    Quote Originally Posted by phibermon View Post
    Also depending on the game you're writing you may be able to implement a caching system that leaves some images to be loaded in the background as the game is running.
    As far as I know the Asphyre Sphinx texture manager does not support dynamic texture loading out of the box but I think this might be achived by using miltiple instances of texture manger at once but I have never tried it.
    Last edited by SilverWarior; 26-02-2015 at 07:08 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •