Page 6 of 30 FirstFirst ... 4567816 ... LastLast
Results 51 to 60 of 300

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

  1. #51

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

    I've updated some of the scripting stuff. The updates are:
    1) Integrated the console window into the Lua environment, so you can type Lua Script into the console window and execute it. For example focus the console window and type: require "test"<ENTER>
    2) Started including some of the glfw stuff into the Lua Environment (more to come)
    3) Fixed some issues and added in the basic types; Rect and Point (more to come)

    Same download as before. If anyone has Lazarus on Linux please try and build to make sure I didn't screw something up. I believe that I have it setup to load the .so (though I may not have it with the package, you will need Lua 5.0.2) and I'm making use of crt so I'm not sure it will work . If not I'll have to start looking into libs for console control.

  2. #52

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

    I just uploaded a version that can supposidly load and display TPHXImage's. It seems to load them just fine, problem is it won't display them even though the proper methods are being called. Can someone take a look at this.

    Download from source above
    Build and run
    Select console window
    Type: require "test"<ENTER>

    It should be displaying a test image (copy of the same) at 100, 100. It doesn't . Maybe this has something to do with the image being loaded up during the frame process, I don't know .

    It does show though that the basic object import will work, still needs work on pas2lua to get it fully working for the engine (but it will work).

  3. #53

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

    Ok, I've fixed a few problems. Actually quite a few, now loading images from the script works. So does displaying them. I've also implemented the new version of the drawing routines (and made them actually work, had to use Matrix's to pull it off so it may be wrong but it works ).

    Give it a download and let me know what you think: http://www.eonclash.com/phoenix/ProjectPhoenixFull.zip

  4. #54
    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)

    Have you looked at the list of features available in Torque Game Builder? They are available here: http://www.garagegames.com/products/62#features

    Nice defintion of requirements for the new engine.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  5. #55

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

    Yeah, quite a nice list there

    A small screenshot of the font renderer. Quite nice TrueType font that looks very nice.

    http://glxtreem.net/Fonts.jpg
    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. #56
    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)

    The fonts look nice.

    I haven't had more time to spend on the phxImages. Will do it as soon as I can.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  7. #57

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

    Quote Originally Posted by jdarling
    Ok, I've fixed a few problems. Actually quite a few, now loading images from the script works. So does displaying them. I've also implemented the new version of the drawing routines (and made them actually work, had to use Matrix's to pull it off so it may be wrong but it works ).

    Give it a download and let me know what you think: http://www.eonclash.com/phoenix/ProjectPhoenixFull.zip
    Good work, one thought, do you have any plans on writing a true wrapper for Lua ? I'm feeling thats really what's needed to let the users to have a easy way of adding their own scripts. Ie an abstractation layer of the VM, Scripts, functions etc ?
    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. #58

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

    Most importly some easy way to add functions into lua for the user, ie in some similar way as dws2 does it:

    Code:
    Type TLuaVM = class
      procedure registerMethod&#40;Name&#58; String; FunctionClass&#58;  class of TLuaFunction &#41;;
    end;
    
    Type TLuaInfo = class
      Property Parameter&#91;Name&#58; String&#93;&#58; TVariant... default;
    end;
    
    Type TLuaFunction = class
      procedure exec&#40;Info&#58; TLuaInfo&#41;;
    end;
    
    ...
    
    LuaVm.registerMethod&#40;'getPlayerX', TgetPlayerX&#41;;
    
    Procedure TgetPlayerX.exec&#40;Info&#58; TLuaInfo&#41;;
    begin
      Info&#91;"Result"&#93;&#58;= Player.X;
    end;
    Or something in that range
    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. #59

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

    Quote Originally Posted by Andreaz
    Good work, one thought, do you have any plans on writing a true wrapper for Lua ? I'm feeling thats really what's needed to let the users to have a easy way of adding their own scripts. Ie an abstractation layer of the VM, Scripts, functions etc ?
    Even with your sample I'm a bit confused as to what you mean by a true wrapper for Lua? In the end I'll surface anything and everything that we need for the scripting environment to be useful. If the user wants to add functionality to the engine and wrap up there own objects and/or methods then they will either be able to use the conversion software (getting closer to accpetable) or do it by hand.

    If you mean completely porting Lua to Pascal so that it can be incorperated into the engine seamlessly, nope. That would require way too much work, and I'm not sure, but I think it would break some license restrictions.

    Something like what you posted already exists. Take a look at TLua in LuaWrapper.pas. You can't overwrap the PLua_State (unfortunately) but the user can use it to extend.

    My focus right now is to get the rest of the converter working properly with FPC and Delphi, build a few more templates for it and get method overloading working. That should make importing all of the engine very simple. Course that mutch wrapping will mean that people won't necessarly have to compile in FPC to write a game, they could pull off simply downloading the compiled version, writting a few scripts, adding some graphics and modles, and running a complete game. Thats my goal with the scripting environment.

    If they then want to make it faster, cleaner, better (or whatever) then they can start migrating the scripts into native code.

    BTW: Has anyone thougth about licensing and etc

  10. #60

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

    My point is that lua is quite complex for a user that never used it before with all the table and stack manipulation one have to use to get something to work.

    But if you take for DWS2 they have a very nice abstractation layer between the core scripting engine and the user, to add a new funtion to the engine all you need to do is inherit a special class that represents a function, i'll post a small demo that creates glVertex3f in DWS2:
    [pascal]

    const // type constants to make sure strings get reused by the compiler
    cSingle = 'Float';
    cInteger = 'Integer';
    cString = 'String';
    cBoolean = 'Boolean';


    Type TVertex3fFunc = class(TInternalFunction)
    procedure Execute; override;
    end;

    procedure TVertex3fFunc.Execute;
    var x, y, z: Single;
    begin
    x := Info['x'];
    y := Info['y'];
    z := Info['z'];

    glVertex3f(x,y,z);
    end;


    initialization
    //------------------------------------------------------------------------------
    RegisterInternalFunction(TVertex3fFunc, 'glVertex3f', ['x', cSingle, 'y', cSingle, 'z', cSingle], '');

    end.
    [/pascal]
    DWS can register either internal functions thats common to every instance of the vm or specific for every wm function.

    The idea is to seperate the user from the lua calls wich for a beginner seems very strange. You have created one part of that functionallity that i have seen so far, this is where you assign global variables:
    [pascal]
    ScriptEngine.Value['Time'] := Time;
    [/pascal]
    Easy and innutive, even through the name maybe should be ScriptEngine.Globals



    There's alot of support for registering classes and the like to, dws2 is quite nice in that aspect even through its not as fast as lua (as the core is written in pascal) and as far as i know doesn't support precompiled scripts.

    One comment more i have is that your TLUA class contains both the wm and the script source in one class, would love to se an seperation there, meaning that you can run multiple scripts in the same wm, thus you have a shared vm where you can run a list of precompiled scripts or functions in thoose scripts.

    Ie you have a wm with a TList of loaded scripts, where each script has a own name and a easy way to execute it in the parent wm, this way it will be easy to write events that calls a script, for example in the upcomming gui engine..

    I'm not a expert of lua myself but as far as i have understod yuu can have many instances of the luaVM actictive and every instance of it has its own set of global variables that can be shared between many scripts, wich would be a nice thing to have easy access to.

    The whole idea behind this is that the user shouldnt need to call any core lua functions if he doesn't wants to, ie he dont need to know anything about the lua interface to be able to include his scripts and functions in a easy way.

    Puh long one

    And now to a TPHXFont update:

    The font rendering is almost complete, its not exactly as i wrote before as it ended up in a more basic form, ie you have one THPXFont class that uses a binary format, with the option to load the texture from an external image or embedded in the font file, and a tool to convert external formats to the internal font format (only supports BMFFont atm, if anyone feel like adding more formats to it i can supply the current souce code ). The font class has basic font rendering capabilities, TextOut, textWidth, textHeight and the ability to compile a displaylist for a specified text.

    I will add special functions for word wrapping and text formatting to seperate classes later, for example TPHXStaticText that contains a list of static texts with colors and positions thats compiled into one displaylist to render large texts quickly.

    The next part of the engine is probably to convert the glxtreeem gui engine, (have prewritten gui editor so will save alot of time) but with some changes, if you have any suggestions for it please post em here.

    Then we have to deside how to work with game loops and timers, anyone has any good ideas on good solutions ?
    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

Page 6 of 30 FirstFirst ... 4567816 ... 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
  •