Page 5 of 7 FirstFirst ... 34567 LastLast
Results 41 to 50 of 67

Thread: PyroGineび「 Game Engine

  1. #41

    Re: PyroGineび「 Game Engine

    Hmmm... interesting.

    Tell me:
    [*]What vid card are you using? Using the latest drivers?[*]What version of DirectX are you using? Needs DX9 Summer 2003 run-time or higher[*]Does you're card supports 3D in a window? Run delTestBed when the startup dialog shows, click options and change to fullscreen. Do they show up in fullscreen?[*]PG only use 32bit textures internally, but if the texture can not be created it will add an entry to the log file and abort. [*]See if there is a *.log file in the same folder with the exe (should be exename.log). See if there are any errors.[*]If your running from VirtualBox you have to make sure the Direct3D support is installed which translate to ogl calls so you have to have good ogl drivers in this case.[*]Make sure the PyroGine dll in the distro is the correct one being called. For example if you've used an older version where the DLLs where in the examples folder too and you've unzipped the newer version over the same folder, the exes will be calling the wrong version. Starting with v0.4.0, the PG DLL is only in the 1.0/bin folder

    Jarrod Davis
    Technical Director @ Piradyne Games

  2. #42

    Re: PyroGine™ Game Engine

    I have tested this on two machines. One i7, Windows 7, Radeon 4870. One Core2 Duo laptop using XP and a crappy Mobile Intel 4 series 3d card. Both appear to have no problems running the demos.

    I have retested the Delphi demos (using delTestbed.exe) but none of them show any text at all (except for the line that says it made with the Pyrogine game engine.) AstroBlaster, PollyPointcollision and Elastic seem capable of running fullscreen, while RenderDevice and DisplayDevice aren't.
    There are no log files.
    I have made sure that the dll file is in the same directory as the executable.

    I have also tested the demos inside the examples\bin directory. AstroBlaster does have text there (though it's of a very low quality) but RenderDevice still has nothing. Interestingly I can only run the demos using delTestBed.exe or scrTestbed.exe. All other exe's either crash after shutdown or on startup(pasTestbed).

    One other thing I noticed while toying with the source code. If I make an error that only occurs during runtime I'm not presented with an error. The game just closes, this makes debugging very hard because I have no clue where to look. Is there a way around that?


  3. #43

    Re: PyroGineび「 Game Engine

    Hi,

    Download this test file, unzip and compile with Delphi. You should get something that looks like this:

    [img width=400 height=300]http://pyrogine.com/support/Traveler/test1.png[/img]

    The code will load a native FontStudio font file and draw using a few of the render methods. This demo is using a larger font along with the rsBlend render state. I suspect that texture coords are too small for the default console font which has to use the rsImage render state in order to see it because it's very small and does not support blending. For font you will either use rsBlend or rsImage, blend will give you the best overall quality.

    [code=delphi]program test1;

    {$APPTYPE CONSOLE}

    uses
    SysUtils,
    PGGraphics,
    PGFonts,
    PGApplication;

    var
    Font: TPGFontStudio;

    begin
    PG.DisplayDevice.Open('Traveler - Test1', dm800x600, True, True);
    PG.RenderDevice.SetMode(0, seDiscard);

    Font := TPGFontStudio.Create;
    Font.LoadFromFile('Impact19.fnt', PG_FontColorKey);

    while not PG.Terminated do
    begin
    PG.ProcessMessages;

    if not PG.RenderDevice.Ready then
    begin
    Sleep(55);
    continue;
    end;

    PG.RenderDevice.ClearFrame(cfDefault, PG_SkyBlue);
    if PG.RenderDevice.StartFrame then
    begin
    PG.Font.Draw(3, 3, 1.0, PG_White, rsImage, fjCenter, 'Testing a few font features using font Impact 19px', []);
    PG.Font.Draw(3, 20, 1.0, PG_White, rsImage, fjCenter, 'Created with the FontStudio utility.', []);
    Font.Draw(0,100,1.0,PG_Red,rsBlend,fjLeft, 'Left', []);
    Font.Draw(0,120,1.0,PG_White,rsBlend,fjRight, 'Right', []);
    Font.Draw(0,140,1.0,PG_Blue,rsBlend,fjCenter, 'Center', []);
    Font.DrawGradient(0,180,1.0, PG_Green, PG_Blue, rsBlend, fjCenter, 'Gradient', []);
    Font.DrawGradient(0,200,3.0, PG_Red, PG_Blue, rsBlend, fjCenter, 'Scaled', []);
    PG.RenderDevice.EndFrame;
    end;

    PG.RenderDevice.ShowFrame;

    end;

    FreeAndNil(Font);
    PG.RenderDevice.RestoreMode;
    PG.DisplayDevice.Close;

    end.[/code]
    Jarrod Davis
    Technical Director @ Piradyne Games

  4. #44

    Re: PyroGineび「 Game Engine

    Excellent! That works like a charm

    I see now where the confusion came from. I was under the impression that text was being written to the screen, without the use of files generated by Font Studio.

    I have one more query, I hope you don't mind. I have gone through the entire AstroBlaster source and even duplicated the demo part by part. Thing is, my version refuses to listen to keyboard input. I assume I have overlooked something, but I cant find what that is. Do you perhaps have an idea?

    Thanks again.

  5. #45

    Re: PyroGineび「 Game Engine

    Ahh, good to hear it's working for you.

    Yea everything that you see on screen other than low-level pixel routines are drawn using textures and PG support FS native textured fonts. Note that the TPGFont class is the base class for fonts in PG so if you have a need to support another font utility or wish to create your own textured fonts you can do so.

    If your demo is derived from TPGTestCase or TPGGraphicalTestCase then PG.Input.Update is being called for you when your Update method is called, but you have to make sure you call inherited so that the inherited code gets called. If you're not using TestCase, then you must call PG.Input.Update manually each frame.

    TestCase based code:
    [code=delphi]procedure TYouDemo.UpdateFrame(aElapsedTime: Single);
    begin
    // must call inherited so that inherited code which automatically calls Input.Update
    inherited;

    // your code here
    ...
    end;
    [/code]

    This applies to LoadResources/FreeResources methods as well. For example when inherited is called inside LoadResources, the display and render devices are setup for you.

    if you using a raw game loop you have to make sure you manually open, process and close input:

    [code=delphi]program test1;

    {$APPTYPE CONSOLE}

    uses
    SysUtils,
    PGGraphics,
    PGFonts,
    PGApplication;

    var
    Font: TPGFontStudio;

    begin
    PG.DisplayDevice.Open('Traveler - Test1', dm800x600, True, True);
    PG.RenderDevice.SetMode(0, seDiscard);

    Font := TPGFontStudio.Create;
    Font.LoadFromFile('Impact19.fnt', PG_FontColorKey);

    // open input using the open DisplayDevice's window handle
    PG.Input.Open;

    while not PG.Terminated do
    begin
    PG.ProcessMessages;

    if not PG.RenderDevice.Ready then
    begin
    Sleep(55);
    continue;
    end;

    // this area is where you do updating

    // process input
    PG.Input.Update;

    // you can check for keys, update simulation etc.
    if PG.Input.KeyHit(KEY_ESCAPE) then
    begin
    PG.Terminated := True;
    end;

    PG.RenderDevice.ClearFrame(cfDefault, PG_SkyBlue);
    if PG.RenderDevice.StartFrame then
    begin
    PG.Font.Draw(3, 3, 1.0, PG_White, rsImage, fjCenter, 'Testing a few font features using font Impact 19px', []);
    PG.Font.Draw(3, 20, 1.0, PG_White, rsImage, fjCenter, 'Created with the FontStudio utility.', []);
    Font.Draw(0,100,1.0,PG_Red,rsBlend,fjLeft, 'Left', []);
    Font.Draw(0,120,1.0,PG_White,rsBlend,fjRight, 'Right', []);
    Font.Draw(0,140,1.0,PG_Blue,rsBlend,fjCenter, 'Center', []);
    Font.DrawGradient(0,180,1.0, PG_Green, PG_Blue, rsBlend, fjCenter, 'Gradient', []);
    Font.DrawGradient(0,200,3.0, PG_Red, PG_Blue, rsBlend, fjCenter, 'Scaled', []);
    PG.RenderDevice.EndFrame;
    end;

    PG.RenderDevice.ShowFrame;

    end;

    // close input
    PG.Input.Close;

    FreeAndNil(Font);
    PG.RenderDevice.RestoreMode;
    PG.DisplayDevice.Close;

    end.[/code]

    No worries. I'm here to help so feel free to ask away. It helps to find and quash any bugs and we can get a better understand how PG works and different ways it can be used. So thank you as well.
    Jarrod Davis
    Technical Director @ Piradyne Games

  6. #46

    Re: PyroGineび「 Game Engine

    Okay, that makes perfect sense.
    My demo is derived from TPGGame. I used Game.dpr in the Pascal directory as a base template. I tried to manually add PG.Input.Update in UpdateFrame(aElapsedTime: Single), but that does not seem to do much.

    What is the preferred class to work with? TPGTestCase or TPGGraphicalTestCase somehow seemed 'wrong' to me to use as they implied test classes used specifically for the Delphi demos.

  7. #47

    Re: PyroGineび「 Game Engine

    Actually, if you're using TPGame, which is what you want to use for working code, then that should be fine. However, you do have to Open input before it will work. You can open it in two ways. Via PG.Input.Open, which will use the handle from PG.DisplayDevice, which has to already be open or if you're using your own window such as a form for example you need to use PG.Input.OpenEx which allows you to pass in a window handle.

    TPGTestCase and TPGGraphicalTestCase should be use for quick prototyping as a lot of stuff will already be setup for you which allows to try out your ideas and concepts with worrying about the plumbing. Your production code should use TPGGame.

    Doing this:

    [code=delphi]type
    TGame = class(TPGame);
    var
    g: TGame;
    ...
    g := TGame.Create;
    g.Run;
    g.Free
    [/code]
    is enough to get the SkyBlue screen. To do more you should override the necessary routines such as LoadResources/FreeResources, Init/Done etc. For Game I use Init/Done for set up stuff that is global such as the archive file, configuration and so forth. LoadResources/FreeResources should be use to init your textures, audio, open input etc.

    If you look at uGame.pas in examples/pascal (which your using), this is the basic template need for using TPGame. If you use pggdev and create a new Game project this template will be generated automatically for you (same for a test case project).

    So for your class derived from TPGame I think all you needed was to make sure you open input then it should work. I would use uGAme.pas as a template because these are all the methods that you need to override to take advantage of it. Again, note that for testcase, most of the important stuff will be setup/shutdown for you, in game you have to do it all manually. Let me know if that worked. I can post a demo based on TPGame to make it more clear if you want, let me know.





    Jarrod Davis
    Technical Director @ Piradyne Games

  8. #48

    Re: PyroGineび「 Game Engine

    Most excellent! Input is working now. Thanks again for all the quick and helpful replies.

  9. #49

    Re: PyroGineび「 Game Engine

    Welcome.

    Oh, about the run-time errors.... if they can be captured there should be a .log file generated. For example if you try and load a texture and it is not successful, the reasons will (should) be posted in the .log file.
    Jarrod Davis
    Technical Director @ Piradyne Games

  10. #50

    Re: PyroGineび「 Game Engine

    PyroGine v0.4.0 Dev Update (04/26/2010)
    [*]Tweaked PolyPoint Collision code. (Thanks Traveler)[*]TPGStartupDialog was returning the wrong state when clicking on the dialog close button. (Thanks Traveler)[*]Generated EXE image from TPGScript and PGPCC are now fully compatible with each other.
    Jarrod Davis
    Technical Director @ Piradyne Games

Page 5 of 7 FirstFirst ... 34567 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
  •