Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 49

Thread: Phoenix 2D Game Engine V1.0

  1. #21

    Phoenix 2D Game Engine V1.0

    Found the movement bug in the collision engine;

    Code:
    //------------------------------------------------------------------------------
    procedure TPHXCollisionObject.SetPosition(const Value: TVector2f);
    begin
      if &#40;FPosition.X <> Value.X&#41; and &#40;FPosition.Y <> Value.Y&#41; then begin
        FPosition &#58;= Value;
    
        Moved&#58;= True;
      end;
    end;
    wich should be
    Code:
    //------------------------------------------------------------------------------
    procedure TPHXCollisionObject.SetPosition&#40;const Value&#58; TVector2f&#41;;
    begin
      if &#40;FPosition.X <> Value.X&#41; or &#40;FPosition.Y <> Value.Y&#41; then begin
        FPosition &#58;= Value;
    
        Moved&#58;= True;
      end;
    end;
    And Joshas error is a thing i've overlooked in the collision handling for circles, i have to test the distance between each vertex and the circle aswell as the seperating axis for the polygon. This will be fixed in the next (soon to come) release.

    jdarling: That would be really awesome, looking forward to it, the gui is a good starting point (hiding and showing controls, setting postions ect)

    I will include a messagesystem to communicate from the scripts to the different components when we start the scripting integration aswell.

    wagenheimer: No there's no path editor in the current version, will try to get one together before the next version.

    Today i've written a QuadTree class that i will add to the sprite engine asweell, will speed things up considerably (in the demo i have 100k objects that's getting rendered and collision detected at 700fps). Ok just rectangles for the objects but still
    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. #22

    Phoenix 2D Game Engine V1.0

    Err... I got a bunch of "eleif" errors in phxLogger. Starting at line 315 it should read:[pascal] {$IFDEF FPC}
    {$IFDEF VER1}
    WriteLn(FLogFile, ' <compiler>Free Pascal 1.x.x</compiler>');
    {$ELSIF VER1_0}
    WriteLn(FLogFile, ' <compiler>Free Pascal 1.x.x</compiler>');
    {$ELSE}
    WriteLn(FLogFile, ' <compiler>Free Pascal</compiler>');
    {$ENDIF}
    {$ELSE}
    {$IFDEF VER180}
    WriteLn(FLogFile, ' <compiler>Delphi 2006</compiler>');
    {$ELSEIF VER170}
    WriteLn(FLogFile, ' <compiler>Delphi 2006</compiler>');
    {$ELSEIF VER160}
    WriteLn(FLogFile, ' <compiler>Delphi 8</compiler>');
    {$ELSEIF VER150}
    WriteLn(FLogFile, ' <compiler>Delphi 7</compiler>');
    {$ELSEIF VER140}
    WriteLn(FLogFile, ' <compiler>Delphi 6</compiler>');
    {$ELSEIF VER130}
    WriteLn(FLogFile, ' <compiler>Delphi 5</compiler>');
    {$ELSE}
    WriteLn(FLogFile, ' <compiler>Delphi</compiler>');
    {$IFEND}
    {$ENDIF}[/pascal]I hate the IFEND/ENDIF differences too. :roll:

    Wow, lots of progress I see! Now we need to start documenting everything and getting things stable so no one is lost! I'm also very surprised to see Lua in there, would you tell me a little about how to use it in its native form?

    Can I request package abstraction? I have been working on a packager that is efficient and game-specific that even beats a Zip in compression time and size with encryption enabled. I'd kind of like to be able to tie that in with a handler unit.

  3. #23

    Phoenix 2D Game Engine V1.0

    Great to hear that version 1.0 is finally here
    however I'm missing the tile engine Have you dropped it or is it comming in an upcoming release?
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  4. #24

    Phoenix 2D Game Engine V1.0

    Not sure if it's really a bug, but until I haven't added font loading to my project (before image list loading procedure), sprites showed up as white rectangles.

  5. #25

    Phoenix 2D Game Engine V1.0

    Quote Originally Posted by Joshas
    Not sure if it's really a bug, but until I haven't added font loading to my project (before image list loading procedure), sprites showed up as white rectangles.
    You'd have to paste your code to see what's going on there.

    The tile engine is in the pipe, was some design issues that made it not in the 1.0 release.
    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. #26

    Phoenix 2D Game Engine V1.0

    My own code is too messy to paste it here, it would be faster to take Sprites demo and comment out every line using fonts (from loading to showing). At the end you get only white boxes instead of sprites.

  7. #27

    Phoenix 2D Game Engine V1.0

    Works for me;

    Code:
    //------------------------------------------------------------------------------
    procedure MainLoop;
      var Screen&#58; TPHXScreen;
      var Timer &#58; TPHXTimer;
      var Images&#58; TPHXImageList;
    
      var Input &#58; TPHXInput;
      var SpriteEngine&#58; TPHXSpriteEngine;
    
      var Font  &#58; TPHXFont;
    
      NumSprites   &#58; Integer;
      NumCollisions&#58; Integer;
    begin
      // Create the window
      Screen&#58;=TPHXScreen.getInstance&#40;&#41;;
    
      // Open the window
      Screen.Open&#40;'Phoenix Sprite Demo', -1, -1, 800, 600&#41;;
    
      Screen.Color&#58;= clrBlack;
    
    
      //Font&#58;=TPHXFont.Create;
      //Font.LoadFont&#40;'Arial16.phxfnt'&#41;;
    
      Images&#58;= TPHXImageList.Create;
      Images.LoadImage&#40;'1945.phximg'&#41;;
    
    
      SpriteEngine&#58;= TPHXSpriteEngine.Create;
      SpriteEngine.ImageList&#58;= Images;
    
      // Create a new layer with our spriteset
      SpriteEngine.Layers.Add&#40; TPHXSpriteLayer.Create&#40; SpriteEngine, '1945.png' &#41; &#41;;
    
      // Create some sprites, see DemoSprites.pas
      CreateSprites&#40;SpriteEngine, Images&#41;;
    
      Input&#58;= TPHXInput.Create;
      Input.Keyboard.KeyBinding&#91;isButton1&#93;&#58;= KeyBinding&#40;VK_SPACE&#41;;
      Input.Keyboard.KeyBinding&#91;isButton2&#93;&#58;= KeyBinding&#40; Ord&#40;'B'&#41;, Ord&#40;'2'&#41;&#41;;
      Input.Keyboard.KeyBinding&#91;isButton3&#93;&#58;= KeyBinding&#40; Ord&#40;'C'&#41;, Ord&#40;'3'&#41;&#41;;
      Input.Keyboard.KeyBinding&#91;isButton4&#93;&#58;= KeyBinding&#40; VK_DELETE&#41;;
    
      Screen.Color&#58;= Color4f&#40;0, 67 / 255, 171 / 255, 0&#41;;
    
      Timer&#58;= TPHXTimer.Create;
      repeat
        Input.Update;
        Timer.Update;
    
        Player.Input&#40;Input, Timer.FrameTime&#41;;
    
        SpriteEngine.Move&#40;Timer.FrameTime&#41;;
    
        // The collision detection is quite expensive, there will be improvements to this later on
        // It can be helped alot with the collisiongroups through
        NumCollisions&#58;=SpriteEngine.CollisionTest;
    
        // Clear the window
        Screen.Clear&#40;&#41;;
    
        if Player.Lives > 0 then begin
    
          NumSprites&#58;=SpriteEngine.Render&#40;Screen.Width, Screen.Height&#41;;
    
          SpriteEngine.WorldY&#58;= SpriteEngine.WorldY - Timer.FrameTime * 100;
    
          Player.Y&#58;= Player.Y  - Timer.FrameTime * 100;
    
        end else begin
    
          NumSprites&#58;= 0;
    
          if Trunc&#40;Timer.ElapsedTime * 2&#41; mod 2 = 0 then
           // Font.TextOut&#40;&#40;Screen.Width - Font.TextWidth&#40;GameOverText&#41;&#41; div 2, &#40;Screen.Height - Font.TextHeight&#40;GameOverText&#41;&#41; div 2, GameOverText, clrYellow&#41;
          else
          //  Font.TextOut&#40;&#40;Screen.Width - Font.TextWidth&#40;GameOverText&#41;&#41; div 2, &#40;Screen.Height - Font.TextHeight&#40;GameOverText&#41;&#41; div 2, GameOverText, clrRed&#41;;
    
        end;
    
    
      //  Font.TextOut&#40;400, 4 + Font.LineHeight * 0, Format&#40;'Lives&#58; %d', &#91;Player.Lives&#93;&#41;&#41;;
     //   Font.TextOut&#40;400, 4 + Font.LineHeight * 1, Format&#40;'Score&#58; %d', &#91;Player.Score&#93;&#41;&#41;;
    
       // Font.TextOut&#40;5, 5 + Font.LineHeight * 0, Format&#40;'FPS&#58; %d', &#91;Timer.FrameRate&#93;&#41; &#41;;
       // Font.TextOut&#40;5, 5 + Font.LineHeight * 1, Format&#40;'Sprites&#58; %d / %d', &#91;NumSprites, SpriteEngine.Sprites.Count&#93;&#41;&#41;;
      //  Font.TextOut&#40;5, 5 + Font.LineHeight * 2, Format&#40;'Collisions&#58; %d', &#91;NumCollisions&#93;&#41;&#41;;
    
    
        // Flip the buffers
        Screen.Flip&#40;&#41;;
    
      until &#40;Screen.Visible = False&#41;;
      
      Images.Free;
      
      Font.Free;
    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. #28

    Phoenix 2D Game Engine V1.0

    Here's what I get:


    [size=7px]Compiled with Delphi 7 PE. ATI Radeon 9250 video card.[/size]
    Maybe hardware problems? But everything works correctly when using with fonts.

  9. #29

    Phoenix 2D Game Engine V1.0

    Still doesnt make any real sense to me, cant really figure out if it's a hw problem or a bug in phx or what. The code would still be really helpfull to figure it out
    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. #30

    Phoenix 2D Game Engine V1.0

    Are the sprites that are using "Power of two" Textures?

    Some video cards have problems in handling textures not power of two!

Page 3 of 5 FirstFirst 12345 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
  •