Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 67

Thread: PyroGineび「 Game Engine

  1. #11
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Re: PyroGineび「 Game Engine

    The PyroGine really is impressive with all that work you've put into it Jarrod. I'm curious however, would it be possible at all to do cross-platform development with it in the future? I know it uses Direct3D, but what about OpenGL or OpenAL in the future?

    Oh and I've seen some screenies of The Probe. Lookin' good so far. Nice work Paul. Don't forget to show off your screenshots here on PGD as well.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #12

    Re: PyroGineび「 Game Engine

    No wories WILL, I will post my progress on PGD too

    cheers.
    Paul

  3. #13

    Re: PyroGineび「 Game Engine

    This is pretty good news

    All this talk (here and PM between us admins) is getting me excited again

  4. #14

    Re: PyroGineび「 Game Engine

    Quote Originally Posted by Traveler
    This is pretty good news

    All this talk (here and PM between us admins) is getting me excited again
    LOL! I'm glad we excite you haha

    cheers,
    Paul

  5. #15

    Re: PyroGineび「 Game Engine

    IPC_________________________________________________

    Need to be able to communicate with another application on the same machine, no problem, just do:

    [code=delphi]// init IPC server
    srv := TPGIPCServer.Create;

    // init IPC client
    cli := TPGIPCClient.Create;

    // event handler
    procedure OnData(aData: Pointer; aSize: Integer; aHWnd: HWND); virtual;
    procedure OnConnect(aHWnd: HWND); virtual;
    procedure OnDisconnect(aHWnd: HWND); virtual;

    // send data
    procedure SendMessage(aData: Pointer; aSize: Integer; aHWnd: HWND); virtual;
    [/code]

    Using these classes and the event handlers you can do inter-process communication. An example of this is how I communicated between the command-line compiler and the IDE. Rather than capturing the output (which proved to be error prone) switching to IPC gave me more precise control in logical OOP fashion and worked much better.

    Database_________________________________________________
    Need to communicate with a database on a remote server, locally or just create a local database? No problem, you can do:

    [code=delphi]// create database object
    db := TPGDatabase.Create;

    // set the type of database
    db.Kind := dtMySQL; // or dtSQLite3

    // use open for local database
    db.Open(...);

    // use connect for local & remoate mysql database
    db.Connect(...);

    // execute a query
    db.ExecSQL(...)

    // get a query result
    tbl := GetTable(....)
    [/code]

    If you've done any remote database work you know that it can take some time to make the connection which will normally block your application, again PG has a solution, threaded support:

    [code=delphi]function ThreadConnect(const aHost, aUser, aPassword, aDatabase: TPGString; aEventHandler: TPGDbThreadConnectEvent): Boolean; virtual;
    function ThreadExecSQL(const aSQL: TPGString; const aArgs: array of const; aEventHandler: TPGDbThreadQueryEvent): Boolean; virtual;
    function ThreadGetTable(const aSQL: TPGString; const aArgs: array of const; aEventHandler: TPGDbThreadQueryEvent): Boolean; virtual;
    function ThreadStatus: TPGDbThreadStatus; virtual;
    [/code]
    These methods allow you to connect and query the database by pushing the operation in a background thread and allowing your application to continue running. When the operation completes or fails and event will fire.

    Highscores_________________________________________________
    The threaded support allows the TPGHighscore object to send and retrieve high scores without blocking your game. Oh yea, if you want high score support for your game, you can use the TPGHighscore class, which gives basic HS functionality. If you need more you can use the database support to make your own, locally or remote. Using the Highscore feature you can send your scores to a remote database then on your website you can use php for example to display those scores.

    [code=delphi] TPGHighscore = class(TPGObject)
    public
    constructor Create; override;
    destructor Destroy; override;
    function Connect(const aHost, aUser, aPassword, aDatabase, aTable: TPGString): Boolean; virtual;
    function Connected: Boolean; virtual;
    procedure Close; virtual;
    procedure ClearResults; virtual;
    function DropTable: Boolean; virtual;
    function Post(const aName: TPGString; aScore: Integer; aSkill: Integer; const aLocation, aDate: TPGString): Boolean; virtual;
    function List(aSkill: Integer; const aStartDate, aEndDate: TPGString; aLimit: Integer): TPGDatabaseTable; virtual;
    function LastError: TPGString; virtual;

    function ThreadConnect(const aHost, aUser, aPassword, aDatabase, aTable: TPGString): Boolean; virtual;
    function ThreadList(aSkill: Integer; const aStartDate, aEndDate: TPGString; aLimit: Integer): Boolean; virtual;
    function ThreadPost(const aName: TPGString; aScore: Integer; aSkill: Integer; const aLocation, aDate: TPGString): Boolean; virtual;

    function ThreadState: TPGHighscoreThreadState; virtual;
    procedure ClearThreadState; virtual;

    public
    function GetDB: TPGDatabase; virtual;
    property DB: TPGDatabase read GetDB;

    function GetDBResults: TPGDatabaseTable; virtual;
    property DBResults: TPGDatabaseTable read GetDBResults;
    end;
    [/code]

    Data_________________________________________________
    Need to handle large data sets in a sparse fashion, no problem, use a TPGSparseArray:

    [code=delphi]// create array
    dat := TPGSparseArray.Create;
    ...
    // set some data
    dat.Cells[99999,13443] := "Wow, this is HUGE";
    dat.Cells[2343, 13] := 1234567;[/code]

    A sparse array is what I use to handle the Unicode character set for the included FontStudio utility. By default a massive array would have to be created to hold the entire Unicode set (max int I think it was using) for each loaded font. NO, no that was to much. Sparse arrays to the rescue.
    Jarrod Davis
    Technical Director @ Piradyne Games

  6. #16

    Re: PyroGineび「 Game Engine

    Actors_________________________________________________
    • TPGActors - Are the base objects that can exist and have interaction in the game world.
    • TPGActorList - Is a dynamic double linked list that Actors can live on. An ActorList can process collisions which will call the Actors OnCollide method.
    • TPGActorScene - Is a object that handle multiple ActorList objects. For example, rather than having one list that has to check collisions against objects that will not collide, you can have multiple lists, one for particles, one for enemies and one for the player. The idea is that you will normally never do collision check for particles so keep them on a separate list making making the collision check more efficent.
    • TPGAIState - The AI system in PG is based around an event driven state machine and TPGAIState is an object that represents this logical state.
    • TPGAIStateMachine - Is an object that manages all the AI states. It can changes states, got back to the previous state, have a global state that can run in parallel with the current state and so on.
    • TPGAIActor - Is an actor that has a state machine to manage it's states.
    • TPGEntity - Is an AIActor that can exist in the game world, it has shape (based on sprites), position, can do collision, can be animated so on. You will use an entity most of the time.
    [br]
    An Entity can do PolyPoint collision. It's a precise and fast way to do collisions. Basically the sprite images will be auto traced to make a polygon outline around them. Then the line segments that make up the polygon will undergo a fast 2D intersection test to see if a collision occurs. Before this however, a very fast spherical check will be performed first to make sure the objects are close, if so the more precise PolyPoint check if performed. The auto trace feature took a lot of time to get working correctly and a guy I met from Russia finally help me get it working properly. I can not remember his name now. If your reading this, respect goes out to you dude. PM me.

    Sprites_________________________________________________
    The TPGSprite class can manage a list of textures in a local fashion. It will allow you to define your images into pages and groups. A page is the texture file loaded in, a group is the images on this texture. It is more efficient to have multiple images on one textures than to have one image per texture. So TPGSprite will allow you to add images to a group based on a grid layout or if you need to tightly pack your images into the available space you can specify a rectangle. So all the images added to a group becomes an animation if you wish. When you create an entity, you pass in a sprite object and the group the images belong to.

    [code=delphi]// init sprite
    FSprite := TPGSprite.Create;

    // define boss sprite
    page := FSprite.LoadPageFromArchive(gTestbed.Archive, 'media/sprites/boss.png',
    PG_ColorKey);
    group := FSprite.AddGroup;
    FSprite.AddImageFromGrid(page, group, 0, 0, 128, 12;
    FSprite.AddImageFromGrid(page, group, 1, 0, 128, 12;
    FSprite.AddImageFromGrid(page, group, 0, 1, 128, 12;

    // init boss entity and add to scene
    entity := TBoss.Create;
    entity.Init(FSprite, group);
    Scene[1].Add(entity);

    // define figure sprite
    page := FSprite.LoadPageFromArchive(gTestbed.Archive, 'media/sprites/figure.png',
    PG_ColorKey);
    group := FSprite.AddGroup;
    FSprite.AddImageFromGrid(page, group, 0, 0, 128, 12;

    // init boss entity and add to scene
    entity := TFigure.Create;
    entity.Init(FSprite, group);
    Scene[0].Add(entity);
    [/code]
    Jarrod Davis
    Technical Director @ Piradyne Games

  7. #17

    Re: PyroGineび「 Game Engine

    The PyroGine really is impressive with all that work you've put into it Jarrod. I'm curious however, would it be possible at all to do cross-platform development with it in the future? I know it uses Direct3D, but what about OpenGL or OpenAL in the future?
    Thanks. It is certainly a possibility. It will be a lot of work, but once I get things stable on the Windows side and I can begin to think about cross-platform design. I will have to rework a lot of stuff because the core of PG has been in development since the early 2000s (whoa, that seems so long ago already) from a Windows/DirectX perspective. I'm committed to cross platform support. A future version of Delphi (NDA and all that stuff prevents me from talking about the specifics) may help make this a magnitude easier.
    Jarrod Davis
    Technical Director @ Piradyne Games

  8. #18

    Re: PyroGineび「 Game Engine

    WOW! awesome

    @sparse arrays: I believe that Font Studio fonts only use a Word array, so 65536 only...

    cheers,
    Paul

  9. #19

    Re: PyroGine™ Game Engine

    Yea... a Word array that was 65536 for each font you loaded. I modified it to use my sparse array instead to save a ton of memory.

    DLLs
    Want to bind a procedural variable to a routine in a DLL? Do this:

    [code=delphi]var
    proc: procedure(msg: pchar);
    ...
    PG.DLL.Bind(proc, "myproc", "myproc.dll");
    [/code]

    The TPGDLL class will access the dll, see if it's already loaded, if so use it, if not load it in and bind the variable to the specified exported routine. This object can manually load a DLL, return the count and names of all loaded dlls.

    Attributes
    All classes in PG are derived from TPGObject and this base class implements Attributes. Each object can have up to 256 attributes associated with it. An example of use would be using it to classify enemies or subclass objects in general.

    [code=delphi]Obj.Attributes[10] := True;[/code]

    The actor list system allows you to act on a group of actors base on their attribute values. If you wanted to remove all the objects on the list or query just those objects you can do so by checking if the attribute is set.

    Graphics
    PG has many graphics related classes such as:
    • TPGRenderDevice - Manages low-level Direct3D rendering. Supports viewports, swap chains, and primitives.
    • TPGTexture - Represents a Direct3D texture. Various rendering methods, render targets, direct pixel access, copy to/from textures/surface
    • TPGSurface - Represents a Direct3D surface. Can be any size, does not support direct rendering, but bits can be copied to a texture to be rendering.
    • TPGPolygon - A multi segment polygon object. Can be scaled, rotated and transformed.
    • TPGPolyPoint - Implements the PolyPoint collision system.
    • TPGSprite - A manager for texture images. One sprite object is capable of managing all images in your project.
    • TPGImage - Allows rendering of very large images. For example want to render via hardware a 800x600 non-power of two sized image, use TPGImage.
    • TPGBezier - Implements a brazier object.
    [br]Audio
    A robust audio system that can play most music formats including MP3, OGG, WAV, MOD, S3M and IT. All music formats are treated in the same way, they can be loaded and played as a sound effect or streamed and played as music. So you can have compressed sound effects as ogg files rather than WAVs if you want. You can even stream music from within an archive. Since password protected zip files are supported, applying a GUID for your password to keep your resources secure, your music can be played directly from this archive. Included also is a music player that allows you to playback a list of music on disk or from an archive. If you wanted to have the option of allowing the user to play their own songs, you can do it with PG. You can control the channels, frequency, panning, volume, global volume, control if the music continues to play if the application focus is lost and even dynamically update volume, panning and frequency in real-time based on distance. The music will be updated automatically in a background thread so there is no need to manually call PG.Audio.Update for manual processing.
    Jarrod Davis
    Technical Director @ Piradyne Games

  10. #20

    Re: PyroGineび「 Game Engine

    Thanks so much for all this info Jarrod! I've copied it into a .rtf document for my convenience

    cheers,
    Paul

Page 2 of 7 FirstFirst 1234 ... 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
  •