Page 3 of 30 FirstFirst 1234513 ... LastLast
Results 21 to 30 of 300

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

  1. #21

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

    Quote Originally Posted by cairnswm
    Correct - except you already have a Pattern Index as a paramenter
    Hehe, very true. Havn't really started on thoose functions so

    Quote Originally Posted by cairnswm
    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
    Haha, hopefully you understand how to use it atleast, I will write a small demo showing off how to write a custom texture loader when I got the time, could be used for loading fractals for example.

    Quote Originally Posted by cairnswm
    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
    Hehe, stealing is good

    Well, the next project, after the imageList class with all the simple Draw functions in place (Draw, StrechDraw, TileDraw, DrawRotate, DrawAlpha etc) is done is the font renderer.

    What i have in mind is creating an abstractation between a font and a text renderer, ie the THPXFont class only contains the bitmap texture as well as glyph information (width, heigt, offset etc) and the loading functions and display lists.

    Then the text renderer(s ?) handles all the rendering routines, could be TPHXTextRendererPlain, TPGXTextRendererHtml and whatever you want. Ie something like this:


    [pascal]
    Font = FontList.LoadFont('Arial.png');

    TextRenderer = TPHXTextRendererPlain.Create();
    TextRenderer.TextOut(Font, 10, 10, 'My little text');

    TextRenderer.WrapText(Font, 10, 10, 200, 200, 'My very very very long text, it will not fit in one row ';

    TextRenderer2 := TPHXTextRendererHtml.Create();
    TextRenderer2.addFont(fsItalic, Font);
    TextRenderer2.addFont(fsBold, Font2);
    TextRenderer2.addFont('p', ParagraphFont);
    TextRenderer2.TextOut(Font, 10, 10, 'SomeHtml text<br>with <p>Styles</p>)';
    [/pascal]
    Something like that, ofc it wont be a full html renderer, but could still be usefull
    Edit:
    Or rather the creation of a font renderer would be more like this:

    [pascal]
    Renderer := TPHXTextRenderer.getRenderer("html");
    [/pascal]

    This way you could register your own renderers quite easy:

    [pascal]
    TPHXTextRenderer.registerRenderer('rtf', TMyRTFRenderer);
    [/pascal]

    Any ideas or suggestions ?
    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
    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)

    Yeah I know how to use others peoples stuff Its called Copy paste or just reuse the library

    If you like I'll add all the procedures etc to the TPhxImage class - this leaves you to carry on with the other items. I at least know enough on how to do this now

    I will use the logic as in S2DL (Probably mostly copy and paste). Once I'm done I'll give it back to you and you can optimise it.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  3. #23
    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)

    Oh, another thing

    I built in a nice fading effect in S2DL - basically I use an S2DLDraw class, it has functions to fade in and out, as well as some scene control methods (Start Scene and EndScene) - when Images are drawn they use the S2DLImage fade colors to define the glColor3f parameters.

    It would be nice to have something like this as well.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  4. #24

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

    Quote Originally Posted by cairnswm
    Yeah I know how to use others peoples stuff Its called Copy paste or just reuse the library

    If you like I'll add all the procedures etc to the TPhxImage class - this leaves you to carry on with the other items. I at least know enough on how to do this now

    I will use the logic as in S2DL (Probably mostly copy and paste). Once I'm done I'll give it back to you and you can optimise it.
    Yeah, that would be sweet indeed. However there's still the issue of wich rendering method to use, there's basically 4 ways:

    1, glBegin / glEnd - The wy you've done in your lib aswell as I did in GLXTreem, potentally slow.

    2. Display list, one for every pattern. Abit more advanced, but "should" be faster then the prefious method. Drawback of needing to modify the modelview matrix for each render (position, stretch).

    3. glVertexPointer + glTexCoordPointer, Should be faster then both of the previous versions, requires quite a bit of coding however, but no need to modify the modelvirew matrix and only one opengl call per draw.

    4. glBindBuffer (Vertex Buffer Objects), Should improve of the last variant even more due to the texturecoordinates being static on the gpu memory, only vertex data needs to be shuffled to the gfx card on each draw. And still no modelview matrix modifixations.

    The first 2 methods is quite straigth forward, infact they are already implemented to some degree, however there may be some performance issues with em.

    Then there's the Vertex Array and Vertex Buffer Object versions, shure they will bring some performence gain, but the question is if the performance gain is big enough to justify the extra work
    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

  5. #25
    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)

    I'll do method one I dont know enough about OpenGL coding to try any of the others

    Will send it to you tomorrow
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  6. #26

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

    Yeah, works for starters, its always possible to change that for a later version
    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

  7. #27
    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)

    I'd also like to do some changes on the phxWindow class. But I would rather you get it into some sort of final state before I make the changes. (I want to add the fading and scene management as in S2DL)
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  8. #28

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

    Wouldnt Scene Management be better of as a new class and file, ie phxScene, TPHXScene, TPHXSceneManager ?

    And it could be extended abit from your version, ie have support for multiple scenes, and nextScene, previousScene methods and such
    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

  9. #29

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

    Checked your scene fade funktion, it's not 100% as you're using glColor for fading, what if some funktion sets it own color ? Then you fading is nullified. A better approach is to disable deapth test and render a alpha blended quad that fills the whole window
    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
    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)

    Maybe we have different meanings for Scene.

    My scene is the current state of the drawing screen. Ie what level of fading is being used etc. (Basically manipulation of glColor3f).

    Your scene seems to map my idea of a game state.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

Page 3 of 30 FirstFirst 1234513 ... 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
  •