PDA

View Full Version : Asphyre Sphinx access pattern



robert83
19-02-2015, 09:10 PM
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.

SilverWarior
20-02-2015, 12:16 PM
Mind first telling me why are you using Aspyhre Sphinx 1.0? That is pretty old.

robert83
20-02-2015, 03:21 PM
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 :D

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.

robert83
20-02-2015, 06:19 PM
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.

SilverWarior
20-02-2015, 08:41 PM
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/showthread.php?21840-Asphyre-Sphinx-Framework-v4-0-0-(Unofficial-release)

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


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.

phibermon
26-02-2015, 12:15 AM
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.

SilverWarior
26-02-2015, 07:06 AM
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.


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.

SilverWarior
26-02-2015, 07:10 AM
@Robert83
If you need someone to test your game or help finding any bugs don't be afraid to ask. I would realy like to see how much have you advanced since the last time.

robert83
09-08-2015, 04:35 PM
Hello Everyone, SilverWarrior,

Well life was busy for me. I've actually managed to move from Car Washing into Warehous work , then to Systemadministrator and then to Management IT :) in 2 years in Germany. Doing lots of Logistic programming, which is immense fun. And in my free time when I have some power left, I try to continue my game. Which I think progressed nicely. Right now there is no download available because it's not done. But I've already uploaded a video of the menu and the first level.

It's a simple vertical shoot-em up game. The AI is very-very basic. The graphics is all done by me (I am not the best painter...) , the music was found on the internet along with the sound effects. For the speech I've used Free Online Speech Synthetisators , from where I've recorded the voice. The game is using Apshyre Sphinx, with DracuLIN s awesome Sprite Enigne. For the music and sound effect I am using bass.dll .

The Editor is now actually storing the level data along with the enemies ( boss included ) . We have 4 layers for background and 1 layer for Enemies. Each level can have different effects. First level which is available has Stars coming down fast in the background, second level which is not yet completed has clouds...

The menu is working .
New Game
Instructions

The game can have multiple levels each level ends with a boss fight , boss has own unique music . Each level has a end level debriefing.
HUD is not yet drawn, but the points are calculated.
Also the player cannot die yet... I need to do some testing , alter enemi placement etc...

Enemies have different hp's , different bullets, explosions sound etc....
And a lot of stuff I probably forget . It was and still is a lot of fun to be finally able to do something that finally works on my laptop as well without any lagging.
I know it's not much , but still it is a great pleasure to work in this. Once I am done with all the levels and my crazy story :) I will upload the game to my website
as free download. ( Donations accepted :) , should it prove worthy .

The video : https://www.youtube.com/watch?v=RkQ7zey1-j8&feature=youtu.be

Thank you

SilverWarior
10-08-2015, 05:34 PM
WOW! I'm impressed.

I like some of the small details that you put into this game like different gun and explosion sounds. Especially I like the independence animation between same typed aliens.

I also like the cartoonish graphic style you used. Now the only thing I would recommend is making background (space much darker). Blue color doesn't really fit for space background.

Few of my quick suggestions for game improvement at this point would be:
- player ship upgrades either through ingame powerups or by ability to buy bigger and better weapons between the missions
- weapon projectiles that can also fly in diagonal directions which would make game a bit more interesting
- you could improve (debriefing) narration by showing its pictures in sequence (show first, then add second, etc.) like you can see in many electronic comic books.

paul_nicholls
24-08-2015, 11:50 PM
Hello Everyone, SilverWarrior,

Well life was busy for me. I've actually managed to move from Car Washing into Warehous work , then to Systemadministrator and then to Management IT :) in 2 years in Germany. Doing lots of Logistic programming, which is immense fun. And in my free time when I have some power left, I try to continue my game. Which I think progressed nicely. Right now there is no download available because it's not done. But I've already uploaded a video of the menu and the first level.

It's a simple vertical shoot-em up game. The AI is very-very basic. The graphics is all done by me (I am not the best painter...) , the music was found on the internet along with the sound effects. For the speech I've used Free Online Speech Synthetisators , from where I've recorded the voice. The game is using Apshyre Sphinx, with DracuLIN s awesome Sprite Enigne. For the music and sound effect I am using bass.dll .

The Editor is now actually storing the level data along with the enemies ( boss included ) . We have 4 layers for background and 1 layer for Enemies. Each level can have different effects. First level which is available has Stars coming down fast in the background, second level which is not yet completed has clouds...

The menu is working .
New Game
Instructions

The game can have multiple levels each level ends with a boss fight , boss has own unique music . Each level has a end level debriefing.
HUD is not yet drawn, but the points are calculated.
Also the player cannot die yet... I need to do some testing , alter enemi placement etc...

Enemies have different hp's , different bullets, explosions sound etc....
And a lot of stuff I probably forget . It was and still is a lot of fun to be finally able to do something that finally works on my laptop as well without any lagging.
I know it's not much , but still it is a great pleasure to work in this. Once I am done with all the levels and my crazy story :) I will upload the game to my website
as free download. ( Donations accepted :) , should it prove worthy .

The video : https://www.youtube.com/watch?v=RkQ7zey1-j8&feature=youtu.be

Thank you

Very cool looking game mate :)
Keep up the great work, nice one!!

cheers,
Paul

robert83
27-08-2015, 06:40 PM
Thank you very much!!!!

I cant explain how much your word mean to me :)

Thank you, thank you, thank you!!!

It is imense fun , and I really hope, that I will be able to show something till years end.

Thank you!

ps. : computer is my life , right now I have a meaning to be :)