View Full Version : Delphi XE3 , Asphyre Sphinx 3

31-08-2013, 06:44 PM
Hi everyone, I've done some basic programing in Asphyre 3.1 on Delphi 7, now I'm trying to get up to date with the latest one, but since this uses no components at all, the help file is like non-existent. I'm overwhelmed by it. Can anyone give me a few samples of how to startup a simple program in fullscreen for example, load stuff from the asdb archive ? The examples that come with it seem overwhelming, I need all that stuff JUST to initialize a simple full screen app? Sorry for some reason I can't do a [ENTER] inside this dang window (today nothing works). Greetings Robert

31-08-2013, 07:23 PM
Hi robert. Wecome back :)

Yes Asphyre Sphinx does require more code to initialize. The reason for this is the fact that it now supports DirectX (ranging from DX9 to DX11) and OpenGL providers.
And of course Asphyre Sphinx 3 also has support for full 3D graphics.

I suggest that you take a look at provided Examples again to get better idea of how it works.
Documentation is now saved in several different html files. I suggest opening index.html in Helf folder which is starting page for Asphyre Sphinx 3 documentation.

You will realize that rendering 2D content on Asphyre Sphinx is quite similar to the one from Asphyre eXtreme. The only drawbac is that there is no premade Sprite Engine for Asphyre Sphinx. So to learn how to render 2D content you might even wanna check the base souce code from Aspyre eXtreme Sprite engine.

Anywhay after the 3rd PGD challenge is over I might be able to lend you a hand again.
But until then I'm trying to devote that litle of free time I have to finishing my entry which unfortunately doesn't go prety well.

01-09-2013, 04:24 PM
Hi , thank you!

Well after the timer issue with my previous project and some other stuff I was off for a while. But I feel like trying this again, I will eventually succeed in finishing at least a simple game once.

Anyway I've started experimenting with Asphyre Sphinx 3 , hate this feeling, I feel overwhelmed, don't know where to start etc... pfffff. Anyway I've decided that I'll update this post regularly with my findings, I'm planning to redo my previous (unfinished :( ) editor in this engine perhaps with more success.

The examples are a bit to much for my taste...but one can't expect the creator of the engine to make a step-by-step example for people, you are supposed to learn it or find another hobby. So what I did is, I've created my first test which is the first in a series of step-by-step tutorials for more complex stuff.

Right now what it does is, initialize the engine in full screen with 640x480, uses Sprite Engine (by Gutya, thank you!!!) , it loads one image from the archive file, creates one sprite that can be moved around with the mouse on the screen. Using ESCAPE you can exit the program. Not much, but for the very first very basic step it's something.


22-02-2014, 08:35 AM
Hello, finally after some long time, I've got some free time again on my hands to start experimenting. I'm playing with Ashpyre 3 , my problem is can I use for map editor something like this :


I've tried looking for It but can't seem to find it.


22-02-2014, 11:21 AM
Hi Robert! Welcome back :)

To change to which component will Asphyre Sphinx 3 render you need to use code similar like this:

I quickly modified code of the Basic example which comes with Asphyre Sphinx 3 so that it renders to Panel1 instead of directly rendering to the MainForm. I have left original code lines as comens so you can easily see what was changed and how.

procedure TMainForm.OnDeviceInit(Sender: TObject; Param: Pointer;
var Handled: Boolean);
//DisplaySize:= Point2px(ClientWidth, ClientHeight);
DisplaySize:= Point2px(Panel1.ClientWidth, Panel1.ClientHeight);
//GameDevice.SwapChains.Add(Self.Handle, DisplaySize);
GameDevice.SwapChains.Add(Panel1.Handle, DisplaySize);

24-02-2014, 07:24 AM
Hello, thank you :)

Hopefully I will get somewhere now. Right now I'm having a heck of a time again with loading AsphyreImages from asvf into TBitmap :


It does not work obviously because ImageTemp expects TBitMap , but gets TAsphyreImage ... is there a simple solution for this ?


update :

think I will just cheat,since I'm planning to use fixed tiles, they won't change ... I'll just use ImageList 's to store tiles for the editor , and will use It like this :

procedure TForm1.DisplayAvailableTiles( TileSet : string );
var i,j : integer;
MyType : string;
// fill up listview with images
for i:=0 to GameImages.ItemCount-1 do

if MyType = TileSet then
if TileSet = 'Land' then ListView1.SmallImages:=TileDesert;
if TileSet = 'Ocea' then ListView1.SmallImages:=TileOcean;


// set index to 0

it might not be the best solution but works nicely... now using a combobox , I can display tiles per category :

-DesertTiles , OceanTils , DebrisTiles etc...

02-03-2014, 11:16 AM

[ Did not have much time to work on this editor thing,because I had to finish a database program that showcases (sorta) my knowledge , so that I may finally get a IT related job here in Germany ...]

Anyway some update, I've been banging my head against the wall , because with my new editor layers 0 and 1 did not work properly , example, I've put a transparent shore tile on Layer1, then I've put an Ocean tile on Layer0 , the Ocean tile would be on top of the shore one, I've looked at the damn code for hours what could be wrong, even created a stringgrid for all arrays to display raw tile names.

And then I found this :) in AsphyreSprite.pas

constructor TSprite.Create(const AParent: TSprite);
inherited Create;
FParent := AParent;
if FParent <> nil then
if FParent is TSpriteEngine then
FEngine := TSpriteEngine(FParent)
FEngine := FParent.Engine;
FX := 200;
FY := 200;
FZ := 0;
if Z = 0 then
Z := 1;
FWidth := 64;
FHeight := 64;
FName := '';
FZ := 0;
FPatternIndex := 0;
FDoCollision := False;
FMoved := True;
FEffect := beNormal;
FVisible := True;
FTag := 0;

see ? if Z = 0 then Z := 1; god dammit ...anyway back on track now, once the editor progresses as far as the other one with older Asphyre I will post it here along with source and all...


02-03-2014, 01:21 PM
Since I don't have source code for this newer version of Asphyre Sprite Engine I'm asuming that Z is z order property of TSprite which determines which sprites are rendered on top. Also I'm asuming that FZ is internal vriable for storing Z property value.
Now the
if Z = 0 then Z := 1; seems realy strange since accessing class property from within a class methods could lead to big problems (infinite loops) and should be therefore avoided if posible or used only for reading the property value.
But what caught my eye even more is that in the code variable FZ (probably internal variable for storin Z property value) is set to 0 twice. Once right before that "if Z = 0" code and again a few lines below. This completly nullifies the efects of "if Z = 0" part of code and FZ is always 0.

What happens if you change the Z property after the Sprite has already been created (set Z of Shore sprite to 1 and ocean sprite to 0 or maybe oposite)?

09-03-2014, 08:28 AM
Hello, so I did a bit further into this re-creatin...and I've hit the same problem with scrolling, I don't know what I'm doing wrong, but this MUST be me, since both Asphyre Extreem and this Asphyre 3 have demos with Smooth Scrolling and there it's all fine...
What I did now, is I have a fullscreen app that loads all the tiles at once , and then on processevent (which is supposed to be running at constant speed executes it...)
Well I still feel it is no smooth (guess this is what seperates the men from boys) .

Attached is the source code, with all resouces ,and compiled exe , that automatically loads masodik.map file and scrolls trough it. (yeah, I've draw all my tiles.... )

Please enlighten me what am I doing wrong, this is driving me crazy.


09-03-2014, 08:38 AM
Fast reply...WOW!

I switched to OpenGL... It is scrolling smoothly now, why? I checked multiple speeds it is fine , I have only one problem, OpenGL 640x480 does not stretch to full screen , why?
If need be I'll go use OpenGL instead.... don't plan to use any special directx effects...just trying to learn somthng...and pass some time till I get some job in Germany (which is harder then I thougt , cause I don't have any IT degree, and even though I've created a quiet nice database program for vehicle management as a demonstration of my skils, and I do know a thing or two about Linux ... I feel they don't care...sh*t... :( , my life NOOOO.... sorry drifted a bit of)

Edit : DirectX9 is also smooth, it just hit me, DirectX7 is some kind of weird software rendering thing.... anyway please take a look at my source doing the scrolling like that in processing is correct?

Plan : map scrolls down.... enemies appear later based on Layer 4 or Layer 5 , a few enemy types.... follow player...random movement shoot down etc...

Nothing fancy...just make something very very basic...

UPDATE 2 : still happens not as often though...I hate my life :)

10-03-2014, 09:28 PM
DirectX9 is also smooth, it just hit me, DirectX7 is some kind of weird software rendering thing.... anyway please take a look at my source doing the scrolling like that in processing is correct?

I think that using DirectX 7 provider on Windows Vista and newer would result running in software mode which is there for backward compatibility while using DirectX 7 provider on Windows XP should still result in mostly hardware acelerated mode depending on your graphics card capabilities.

Anywhay I quickly checked your code and I don't think there are any major botlenecks in it. Athleast none of them caught my eye.

just trying to learn somthng...and pass some time till I get some job in Germany (which is harder then I thougt , cause I don't have any IT degree, and even though I've created a quiet nice database program for vehicle management as a demonstration of my skils, and I do know a thing or two about Linux ... I feel they don't care...sh*t... :( , my life NOOOO.... sorry drifted a bit of)

Unfortunately there aren't many jobs available for Delphi/Objective Pascal programmers due to language not being so popular.
And due to the fact that creating a database driven application is not so hard these days I don't think that is best way to show your programming skils.
A guy I know managed to make rudimentary inventory managment program (database driven) in just about three days. And later he spend about two months discusing and finetuning the visual interface to fully suit the customer needs.

And while we are talking about databases check your PM I got a question for you for a change :D

11-03-2014, 06:27 PM
Sorry , but what you wrote about database written application kinda bothers me , what I did in 6 months
approx. In my freetime (I'm working for a Leihfirma, meening sometimes I had to travel, and a work day was 9-10 or 12 hours lon) is :
planB which can do this :
- Mileage log, Service, Registratio , Mandatory Insurance.
- Global, Driver, Company , Mileage log, Fuel, City etc stats.
- Driver, Vehicle, Vehicle Expenses, Avarage fuel consumption diagram.
- Reminders for oil , tacho , fire extinguisher, leasing, health check, driving skills check.
- Unlimited number of Vehicle Groups and Vehicles ( Private, Company,Warehouse, VIP,etc)
- One window user interface with multiple panels for simple usage
- Different regional settings with different date time formats fully supported.
- 100% Unicode, can handle special charactrs from various languages.
- Multi user
- Simple user rights :
- Administrator , highest level , can do everything
- User , he does the work, cannot deactivate items, cannot add new users, cannot view program stats
- Guest , can only view reports.
- Program can export almost all tables to EXCEL , all tables can be auto adjusted to fit text size, all tables support fast search.
- Every report can be printed or directly exported to PDF , by mileage log to EXCEL as well.
- Uses MS SQL 2008 r2 ( free edition ) , written with Delphi XE3.
- Automatic backups
- Program has usage stats ( how much time users spend inside, active inactive time, machine name...)
- Multi lingual (self translated to languages I know) : English, German, Hungarian, Serbian... Everything is translated .

Run's well under : WinXP,Vista,7,8,8.1

I don't know, if this is not a good way to showoff a bit of my knowledge... attached some images...of program,
anyway maybe I'm doing something wrong here only 8 months in Germany...I'll go to school...here everything needs to be on paper, will do this Fachinformatiker ausbildun :) ....

The program is currently used in Serbia by one "medium" sized Company ... has approx. 50~ vehicles...

I'll reply to your other question private....anyway drifted really off now :) ... back to game making dingie....


18-04-2014, 07:51 PM
This is a very interesting thread, I have exactly the same starting point. I worked with Delphi 7 and Asphyre 3.1 and moved to Lazarus and Asphyre Sphinx 3 now. I try to find my way around with the examples, I want to write a small 2d tile based game aswell. Looking forward to help each other!