Page 30 of 30 FirstFirst ... 20282930
Results 291 to 300 of 300

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

  1. #291

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

    There is a TPHXCanvas, which is a little inefficient, but is very canvas-like.

  2. #292

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

    i meant like a component that you can put on a form. like the TDXDraw, wich can be placed on a form and scaled and whatnot.

  3. #293

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

    Yeah there's one of thoose, but it's in the editor source bundle that i havn't released yet. I'll upload a zip with em (however they are in the state of working, and that's it)

    http://phoenixlib.net/files/Util.zip
    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

  4. #294

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

    thx! now i just have to find out how to use it...

    EDIT: wich i just did...

  5. #295

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

    Hi ..
    I just wanted to say thanks for this library.

    Its simple, powerfull and chock-full of usefull and easy to use functionality that takes the grind out of delphi 2D games developing but leaves the fun bits in.
    When I discovered how easy to use everything was and saw how professional the resource management tools were, I just decided I had to express my support and admiration.

    I can't tell you how happy I am that I found this and really hope sincerely that you will keep up the great work.

    I will soon be moving my IK+ online project over to phoenix from Delphix
    Check out my Delphi programs, music and writing.
    <br />http://digitalfunnybone.com/Programming.html

  6. #296

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

    Hmm... does the TAnimatedSprite's Z property do anything?

    In my game, a character is a set of different sprites put together. to get this working in UndelphiX, all i had to do, was to adjust the sprites Z-property so that a character standing behind another actually WAS behind it. this does somehow not work in Phoenix2D.

    Mind explaining how Z-Buffering works here?

    Example:
    Body1:= TBody.Create(...);
    Body2:= TBody.Create(...);
    Body1.Z:= 0;
    Body2.Z:= 1;
    Body 2 is in front
    then i tried
    Body1.Z:= 1;
    Body2.Z:= 0;
    Body2 is still in front.

    What is more is that i have to have different parts of a character on different layers, because one layer only takes one image (one layer for bodies, one for suits, one for hair, etc). this also ****s stuff up when to characters walk through eachother, and hair is ALLWAYS printed on top of bodies, unrelative to anything.

    This on top of the Z-Buffering problem is giving me a headache.

    Why not let EACH sprite have the ability to have its own image? I tried implementing that myself, but couldnt figure out how rendering and such works with openGL, so i gave up...

    Pls Help?

    Besides this, the engine is brilliant

  7. #297

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

    Well the z-buffering should work by default (unless it's disabled somewhere else) try calling

    Code:
    glEnable  &#40;GL_DEAPTH_TEST&#41;;
    before rendering the sprites and test if it helps. One thing to note thought, the blending might cause problems if you enable deapth testing, a sprite that is rendered before another sprite cant blend with the following one (this is a limitation of OpenGL and DirectX and has nothing to do with Phoenix). If you only has one color transparency you can avoid this by calling

    Code:
    glAphaFunct&#40;GL_GREATER, 0.1&#41;;
    glEnable&#40;GL_ALPHA_TEST&#41;;
    and this will skip all transparent pixels further up in the opengl pipeline.

    The reason behind the sprite layers (wich was a new adition to the 1.0 release, the betas had one texture per sprite) is simply a speed matter, you can render 10x times the sprites by batching sprites into a larger spriteset instead of needing to rebind the texture for each sprite.

    And for a hint on how to render one image per sprite:

    Code:
    //------------------------------------------------------------------------------
    procedure TMyAnimatedSprite.Render;
    var Image&#58; TPHXImage; // Move to private decleration
    begin
      Image&#58;= ImageList.Find&#40;'MyImage'&#41;; // move to constructor
    
      glPushAtrib&#40;GL_TEXTURE_BIT&#41;; // Save the binded texture
      Image.Bind;
    
      glPushMatrix&#40;&#41;;
        glTranslatef&#40;WorldPosition.X, WorldPosition.Y, WorldPosition.Z&#41;;
    
        glCallList&#40;Image.DisplayList + PatternIndex + 1&#41;;
      glPopMatrix&#40;&#41;;
     
      glPopAttrib&#40;&#41;;
    end;
    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. #298

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

    found this "bug":
    [pascal]
    procedure TPHXAnimation.Update(State: PPHXAnimationState; FrameTime: Single);
    var Frame: TPHXAnimationFrame;
    begin
    // Only update if active
    if( State^.Active) then begin
    // Add the time to the state
    State^.Time := State^.Time + FrameTime;

    // Get the current frame
    Frame:=FFrames[State^.Index];

    // test if we shall change to the next frame
    if( State^.Time > Frame.Time ) then begin
    Inc(State^.Index);

    // Test if we reached the end of the animation
    if( State^.Index = Count) then begin //What if state is larger than count?
    [/pascal]

    I found the problem when my sprites suddenly stopped worked when changing animation length from 4 to 1. wich would effectively make "State^.Index" larger than "Count".

    the solution is obvious...

    (and i have just spent an hour and a half trying to figure out what made my sprites disappear when i stopped moving)

  9. #299

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

    Hehe, yeah that was quite dumb tbh, in normal circumstances it would never occur (ie calling reset after editing the animation) but well.
    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. #300

    Whats up

    Hi

    Have any information from next version?

    Thx
    BigJoe

Page 30 of 30 FirstFirst ... 20282930

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
  •