Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Library recommendation?

  1. #1
    Junior Member
    Join Date
    Sep 2003
    Location
    Netherlands
    Posts
    25

    Library recommendation?

    Hello, I used to work with Delphi a lot, but then moved on to Haxe and C#.
    Anyway, I have an old game (Charlie II) written in Delphi that uses unDelphiX. Unfortunately, the game no longer works in full screen mode on Windows 8/10, which is probably due to Microsoft no longer supporting DirectDraw. So my question is, what would be a good game library nowadays to replace unDelphiX with?
    Basically, all it needs to do is draw (scale up) a 320x200 pixel buffer to the screen every frame, but it should also support sound and keyboard/joystick input, be able to switch to full screen mode and also work in windowed mode so I can use windows menus and UI. And it needs to work in Delphi 5 (since I can't use later versions commercially).
    Thanks!

  2. #2
    I'll stick out my neck and recommend SDL2
    • Multi platform support
    • Hardware accelerated (using GL and/or DirectX depending on platform)
    • Pretty much industry standard (supported by Steam)
    • Support for Joystick, Gamepads, force feedback and Touch/Multi Gestures
    • Support for image loading (Through SDL_image)
    • Support for music/soundfx (Already in the lib, but works much better when using the extension SDL_mixer)
    • Support for TrueType fonts (SDL_TTF)


    Some links to wet your appetite:
    SDL2
    Free Pascal meets SDL
    SDL2 Pascal Headers

    To scale a 320x240 image to fit the current window I usually render to an offscreen texture and then stretch it to fit the screen, works other way too if you need to scale it down. Don't hesitate to ask me about SDL2, been using it since forever (it feels like it..). Also got a more OOP oriented set of wrapper classes around SDL2 that I can provide you with, still a work in progress and not very relialble and may cause serious damage to your mood...

    And why use Delphi5 when FPC/Lazarus is free for commercial use? Even if I'm not the biggest fan of Lazarus I can really recommend FPC! Gives you the opportunity to deploy your work to Linux and OS/X aswell.

    [EDIT]Delphi starter is free for limited commercial use (think it's $1000 before you have to upgrade it)

    (Ñuño Martínez will probably say Allegro ).
    Last edited by Rickmeister; 11-02-2017 at 01:54 PM.

  3. #3
    Junior Member
    Join Date
    Sep 2003
    Location
    Netherlands
    Posts
    25
    Thanks Rickmeister, that's probably a good idea, I'll try to see if I can get SDL2 to work.

    Why still use Delphi 5? So far, every time I tried to convert a Delphi project to Lazarus or FPC, I was unsuccessful. Even if I can eventually get everything to compile, the executable will just crash or do nothing. And this game is huge and full of inline assembly.

    I'll look at Delphi starter too, thanks!

  4. #4
    There are other options too. Pascal bindings exists for SFML, Allegro and TileEngine are a few examples. Of the mentioned ones I've tried out SFML, Allegro and SDL2 but as I have quite alot of experience with SDL I'm sticking to that.

  5. #5
    Hi Wiering!
    I personally don't think it is really worth switching to another game library just because of this "full screen" difficulties you are facing. Why?
    Switching to another game library will require you to rewrite most of your code do to the fact that each game library is using a different approach for its usage.
    Another big obstacle might be the fact that you are using "ancient" version of Delphi, meaning that you will have hard time finding game library that still officially supports such old Delphi version. So you won't be able to rely on game library authors to help you with solving of potential bugs since they probably won't be able to reproduce them.

    So in my opinion it would be better for you to simply solve the current "full screen" problems with using of unDelphiX. How?
    Since your game already runs just fine in windowed mode I guess the best solution would be to simply implement "borderless full screen window" support. Note that this is becoming preferred full screen mode even in modern games as it does not block notification messages from other programs. Also there is basically no more performance loss or this performance los is really negligible on modern computers while in the past there was significant performance loss if you would be running your game in windowed mode.
    Also it might not be a bad idea of contacting the author of unDelphiX library. While the original DelphiX library did heavily rely on DirectDraw I believe unDelphiX library is trying to use DirectX7 functionality instead. The author of unDelphiX library would probably be the best person for offering you more information on this matter. And if not that notifying the author about possible incompatibilities of unDelphiX with newer OS versions might lead him into fixing the unDelphiX library accordingly.

    As for porting your code from Delphi 5 to Lazarus:
    I guess the most common problem is the fact that in FPC/Lazarus you can't use same names for method parameters and object properties as it confuses the compiler about which is which.
    http://stackoverflow.com/questions/4...76621#42076621

    Another problem that you will probably face is the fact that newest versions of FCP/Lazarus and also Delphi already have Unicode string support enabled by default but Delphi 5 only had AnsiString support. And since there is a big difference between ANSI strings (one character = one byte) and Unicode strings (one character = two or more bytes) this will probably broke any routines that work on strings using pointers and probably most routines used to save strings to and load them from files.

  6. #6
    Junior Member
    Join Date
    Sep 2003
    Location
    Netherlands
    Posts
    25
    Thanks SilverWarior, the reason is that I want to try to get the game on Steam and the broken full screen mode is a complaint I get most, so it needs to be fixed.
    Actually the DelphiX version is already kind of a port, since it started out as a DOS game, so it mainly just uses one DIB from DelphiX to draw the screen on, so moving to a different library shouldn't be that bad.
    But your idea for borderless full screen window is probably a good temporary fix (eventhough I would prefer real fullscreen for the smoothness), it sure would be better than having an option in the game that doesn't work.
    I recently contacted the author, maybe he will still reply. But I think it is something that Microsoft needs to fix (and from https://answers.microsoft.com/en-us/...3-997b996b9567 I don't think it is very high on their priority list.

    I don't remember running into that problem of the names, but it's a good thing to know. And yes, unicode could be a problem too, especially combined with assembly (I used to have lots of optimized string functions like UpCaseStr with assembly). I should probably rewrite all my assembly code to standard pascal.

  7. #7
    Junior Member
    Join Date
    Sep 2003
    Location
    Netherlands
    Posts
    25
    Quote Originally Posted by Rickmeister View Post
    There are other options too. Pascal bindings exists for SFML, Allegro and TileEngine are a few examples. Of the mentioned ones I've tried out SFML, Allegro and SDL2 but as I have quite alot of experience with SDL I'm sticking to that.
    I'll look at those, but I think SDL2 is probably the most commonly used (I've seen many games that use it).
    I used to avoid SDL because of the license, I'm glad they changed it!

  8. #8
    Quote Originally Posted by Wiering View Post
    Actually the DelphiX version is already kind of a port, since it started out as a DOS game, so it mainly just uses one DIB from DelphiX to draw the screen on, so moving to a different library shouldn't be that bad.
    If you are drawing the contents of the game screen into a DIB (device independent bitmap) and then rendering that DIB onto the screen you don't even need specific library. That could all be done with a Windows API.
    But in your original post you were also talking about sound and input handling. Here is where I believe you might encounter even greater difficulties.

    Quote Originally Posted by Wiering View Post
    But your idea for borderless full screen window is probably a good temporary fix (eventhough I would prefer real fullscreen for the smoothness)
    As I sad before on modern computers there is virtually no performance impact of running a game in borderless full screen window.
    If you don't believe me just check any modern game that has support for full screen borderless window and make a comparison. You might even find out that some of the modern games no longer even support the true full screen mode.
    Last edited by SilverWarior; 12-02-2017 at 03:28 AM.

  9. #9
    Junior Member
    Join Date
    Sep 2003
    Location
    Netherlands
    Posts
    25
    Quote Originally Posted by SilverWarior View Post
    If you are drawing the contents of the game screen into a DIB (device independent bitmap) and then rendering that DIB onto the screen you don't even need specific library. That could all be done with a Windows API.
    But in your original post you were also talking about sound and input handling. Here is where I believe you might encounter even greater difficulties.
    It's actually not DIB but DXDIB, and yes I also use a DXDraw, DXTimer, DXInput, DXSound and DXWaveList. What I meant is that game itself is not based on DelphiX, like when you use DelphiX's sprites and collision detection, instead I use it as a layer around the game.

    Quote Originally Posted by SilverWarior View Post
    As I sad before on modern computers there is virtually no performance impact of running a game in borderless full screen window.
    If you don't believe me just check any modern game that has support for full screen borderless window and make a comparison. You might even find out that some of the modern games no longer even support the true full screen mode.
    Could you name any examples of modern games that use full screen borderless window?

  10. #10
    Quote Originally Posted by Wiering View Post
    It's actually not DIB but DXDIB
    Actually DXDIB or to be more precise TDXDIB is a unDelphiX component intended to ease up working with DIB images.
    Notice that all od unDelphiX components and many of its classes have DX prefix. This prefix is still from the time of the original DelphiX library. unDelphiX is actually an unofficial version of DelphiX which has been updated with more features and better compatibility with newer versions od DirectX.
    And yes many people mistakenly think that DX prefix in unDelphiX library is actually referring to DirectX API which is not true. This has caused quite some confusion in the past and even whole lot of problems when people would have both DelphiX and DirectX wrappers in same project as it lead to scenarios of having duplicate names.

    Quote Originally Posted by Wiering View Post
    Could you name any examples of modern games that use full screen borderless window?
    Hmm... Where should I start? Let's start by checking my steam library

    Age of Empires 2: HD Edition
    In the options you have three choices for Dipslay Mode:
    - Windowed: which is self explanatory
    - Full Screen: which is true Full Screen mode
    - Full Desktop: which is borderless full screen window mode. Note some people experience problem when switching between Full Screen and Full Desktop mode due to a bug in AOE2 HD

    BeamNG Drive
    It has ability to run in borderless full screen window but always switches back to standard windowed mode when it loses focus (user clicks on some other application on the second monitor - dual monitor setup)
    Done quite some testing and haven't seen any performance difference

    Empyrion - Galactic Survival
    Also supports borderless full screen window. Also haven't noticed any performance difference.

    Grand Theft Auto V
    It does support borderless full screen mode.
    Here I used in-game benchmark system to test out the performance difference between true full screen and borderless full screen window mode. The is a slight performance drop in borderless full screen window mode of about 3 FPS. But that is still negligible especially if you take into account that GTAV is graphically heavy demanding game and my computer (AMD FX-8350 Eight Core, 16 GB RAM, Radeon R9 270 2GB VRAM) isn't some very powerful gaming rig either.

    Medieval Engineers, Space Engineers
    Both support full screen window mode. There is slight performance drop when running in full screen window mode but nothing serious. Just a few FPS similar to GTAV

    Scrap Mechanic
    Haven't noticed any performance difference

    X-COM: Enemy Unknown
    Haven't noticed any performance difference but since it is turn based game I guess if there is any difference it would be much harder to spot.

    These are just some of the more known games who have the borderless full screen window mode available in the options menu. But there are also others which might require starting game with additional command parameter or manually editing game settings files.

Page 1 of 2 12 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
  •