Page 2 of 30 FirstFirst 123412 ... LastLast
Results 11 to 20 of 300

Thread: Writing a better 2D engine. (Phoenix 2D Game Engine)

  1. #11

    Small update

    I have started writing some code on the project now.

    After some testing I found that it wasn't that easy to get rendering in panels working in lazarus so i decided to use GLFW (http://glfw.sourceforge.net/) for the window management instead.

    Thiss will mean that it should be able to use the engine on any freepascal compiler and delphi as well as almost any platform, but we can't use any gui components (exept the planned opengl ones that is). Fair trade if you ask me, there's some speed gain this way aswell.

    What needs to be done now is finishing the wrapper for the window management and then the image loading functions (GLFW has a built in tga loader so that can be used if you don't want to use freeimage)

    After that i'll guess i'll release a alpha version to let you look at

    Edit: And GLFW has quite nice support for input handling aswell, so this could end up quite nice
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  2. #12

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    Can't wait to see an Alpha release. As I said before, when you get to the scripting interface (and if you want help) let me know. I'm more then interested, as my current pet project (JumpStart) has been quite the learning experience on Lua (and other languages) integration.

    On that note, the sooner that you can get it to a point that you feel comfortable with others aiding the better off . I know that there is a really good thread on GameDev about a new isometric engine that is being worked on. Can't get to GameDev right now, but soon as I can I'll post some of the things I thought were good ideas .

  3. #13
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    Will you make the new 2D library VCL/LCL based or just classes?

    I'd prefer just having classes - and then to make it easier to learn, wrap those classes as LCL and VCL components.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  4. #14

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    Quote Originally Posted by cairnswm
    Will you make the new 2D library VCL/LCL based or just classes?

    I'd prefer just having classes - and then to make it easier to learn, wrap those classes as LCL and VCL components.
    I vote for simple classes as well, the LCL and VCL have way too much bloat for standard game applications. Here are the controls I've been working on for my DirectX projects:

    A panel
    An Image Panel - Uses an image instead of the default panel look
    A label
    A button
    An Edit Box
    A List Box
    A memo type thing

    Those are what I came up with for all of the UI's that I would need/use. I have code in place for most, just missing the List Box and Memo. Though the way I'm handeling them is mostly due to the limits of UnDelphiX, so I don't know that it would be of any use.

  5. #15

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    Quote Originally Posted by cairnswm
    Will you make the new 2D library VCL/LCL based or just classes?

    I'd prefer just having classes - and then to make it easier to learn, wrap those classes as LCL and VCL components.
    Well, as GLFW creates and handles all the windowmanagement its not possible to make that many VCL/LCL components, maybe based around DataModules if anything.

    As a progress update, the window funktions is all but done, need some polishing and documentation. Texture loading is more or less completed aswell, some work left on imagelists and such.

    After that the base is done and then its timer + font that is the next project.
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  6. #16
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    Can we start playing with what you have done so far? Where can we download a small delphi demo to compile and try out?

    I would love to give feedback right from the start.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  7. #17

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    Shure thing Note that its quite jittered with openGL calls atm as not all thats needed is supported yet (perspective calculations and such).

    However the window management class is quite complete, the doc isn't 100% yet (and not compiled for that matter ). And the image loading is there, the image rendering functions is not completed however.

    You can download the current version at:

    http://www.glxtreem.net/Phoenix2006-06-20.rar

    There's a small demo in the demo folder.
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  8. #18
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    Nice so far

    Why not another phxWindow constructor that includes left, top, width, height
    and another for full screen and dimensions - makes it easier than having to set them afterwards.


    phxImage
    One thing I found useful in the past is a Draw that draws the complete image.

    My S2DL libraries (Basically what you are trying to do but using SDL and OpenGL instead) includes an image class as follows (private declarations removed):
    [pascal]
    TS2DLImage = Class
    public
    Name : String;
    ImageSurface: PSDL_Surface;
    Texture : TTexture;
    SrcRect, DestRect: TSDL_Rect;
    PatternWidthFrac, PatternHeightFrac : Single;
    Transparent : Boolean;
    Property Width : Integer read GetWidth;
    Property Height : Integer read GetHeight;
    Property PatternWidth : Integer read FPatternWidth write SetPatternWidth;
    Property PatternHeight : Integer read FPatternHeight write SetPatternHeight;
    Constructor Create;
    Constructor CreateSizedSurface(Width,Height,ColorDepth : Integer);
    Destructor Destroy; Override;
    Procedure LoadFromFile(FileName : PChar); Overload;
    Procedure LoadFromFile(FileName : String); Overload;
    Procedure LoadFromFile(FileName : String; IsTransparent : Boolean); Overload;
    Procedure DrawStretch(X,Y,W,H : Integer); Overload;
    Procedure DrawStretch(X,Y,W,H, Pattern : Integer); Overload;
    Procedure DrawStretchRotate(X,Y,W,H, Pattern,Degrees : Integer); Overload;
    Procedure DrawStretchAlpha(X,Y,W,H, Pattern : Integer; Alpha : Single); Overload;
    Procedure Draw(X,Y : Integer); Overload;
    Procedure Draw(X,Y : Integer; Pattern : Integer); Overload;
    Procedure DrawRotate(X,Y : Integer; Angle : Single); Overload;
    Procedure DrawRotate(X,Y : Integer; Pattern : Integer; Angle : Single); Overload;
    Procedure DrawAlpha(X,Y : Integer; Alpha : Single); Overload;
    Procedure DrawAlpha(X,Y : Integer; Pattern : Integer; Alpha : Single); Overload;
    Procedure DrawTiled(X,Y,W,H : Integer); Overload;
    Procedure DrawTiled(X,Y,W,H,Pattern : Integer); Overload;
    Procedure DrawArea(X,Y : Integer; IX, IY, IW, IH : Integer);
    Procedure SetPixel(X,Y : Integer; Color : UInt32);
    Procedure BindImage;
    End;[/pascal]

    Just as an idea.[/pascal]
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  9. #19

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    Quote Originally Posted by cairnswm
    Nice so far

    Why not another phxWindow constructor that includes left, top, width, height
    and another for full screen and dimensions - makes it easier than having to set them afterwards.
    Good idea, consider it done

    Quote Originally Posted by cairnswm
    phxImage
    One thing I found useful in the past is a Draw that draws the complete image.

    My S2DL libraries (Basically what you are trying to do but using SDL and OpenGL instead) includes an image class as follows (private declarations removed):
    [pascal]
    TS2DLImage = Class
    public
    Name : String;
    ImageSurface: PSDL_Surface;
    Texture : TTexture;
    SrcRect, DestRect: TSDL_Rect;
    PatternWidthFrac, PatternHeightFrac : Single;
    Transparent : Boolean;
    Property Width : Integer read GetWidth;
    Property Height : Integer read GetHeight;
    Property PatternWidth : Integer read FPatternWidth write SetPatternWidth;
    Property PatternHeight : Integer read FPatternHeight write SetPatternHeight;
    Constructor Create;
    Constructor CreateSizedSurface(Width,Height,ColorDepth : Integer);
    Destructor Destroy; Override;
    Procedure LoadFromFile(FileName : PChar); Overload;
    Procedure LoadFromFile(FileName : String); Overload;
    Procedure LoadFromFile(FileName : String; IsTransparent : Boolean); Overload;
    Procedure DrawStretch(X,Y,W,H : Integer); Overload;
    Procedure DrawStretch(X,Y,W,H, Pattern : Integer); Overload;
    Procedure DrawStretchRotate(X,Y,W,H, Pattern,Degrees : Integer); Overload;
    Procedure DrawStretchAlpha(X,Y,W,H, Pattern : Integer; Alpha : Single); Overload;
    Procedure Draw(X,Y : Integer); Overload;
    Procedure Draw(X,Y : Integer; Pattern : Integer); Overload;
    Procedure DrawRotate(X,Y : Integer; Angle : Single); Overload;
    Procedure DrawRotate(X,Y : Integer; Pattern : Integer; Angle : Single); Overload;
    Procedure DrawAlpha(X,Y : Integer; Alpha : Single); Overload;
    Procedure DrawAlpha(X,Y : Integer; Pattern : Integer; Alpha : Single); Overload;
    Procedure DrawTiled(X,Y,W,H : Integer); Overload;
    Procedure DrawTiled(X,Y,W,H,Pattern : Integer); Overload;
    Procedure DrawArea(X,Y : Integer; IX, IY, IW, IH : Integer);
    Procedure SetPixel(X,Y : Integer; Color : UInt32);
    Procedure BindImage;
    End;[/pascal]

    Just as an idea
    You mean, basicly what the current TPHXImage.Draw does ?( havn't started on the pattern stuff yet )

    Any yes, will add a bunch of draw methods, probably using displaylists for the pattern management.

    Will add support for the special functions thats in the texture loading class aswell, such as color key transparency and such. Btw what do you think of the approach for the texture loading, should be quite moddable imo.
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  10. #20
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Writing a better 2D engine. (Phoenix 2D Game Engine)

    You mean, basicly what the current TPHXImage.Draw does ?

    Correct - except you already have a Pattern Index as a paramenter

    Btw what do you think of the approach for the texture loading, should be quite moddable imo.
    Ummm, well , aahhh, you see ummm.....

    Actually this is the level of coding I use other peoples stuff - Its sort of too level for me to understand properly - lol

    Which is also why I'm so willing to help you get this working

    If you are interested in stealing some of the image code from my S2DL library (And improving it I hope) - it is all available here: http://www.cairnsgames.co.za/files/S2DLv1-10.zip
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

Page 2 of 30 FirstFirst 123412 ... LastLast

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
  •