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

Thread: Library recommendation?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    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
    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
    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
    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
    Hi Everyone,

    Sorry for resurrecting an old thread, but I started working on this again and want to finally get this game on to Steam.

    I was eventually able to get the fake fullscreen working, so thanks SilverWarior for suggesting that!

    I wasn't able to port the game to lazarus (too much assembly and other hacks that sadly don't work in lazarus), so I'm sticking with Delphi 5.

    Now I need to change the MIDI sound into streamed audio (.ogg or .mp3), which is unfortunately not supported by UnDelphiX.

    So does anyone have a suggestion on what library to use? It doesn't have to do much other than play background music (looping without gap), should sometimes suddenly change into a different song (my songs have 2 different endings). Should be free (but not GPL) and work in Delphi 5.

  9. #9
    Hi!
    Have you checked BASS Sound Library from https://www.un4seen.com/
    It can be used for free as long as you are not earning any profit from your project. But for commercial usage you need to purchase one of the valid licenses.

    The thing that I love about BASS is that it has support for lots of sound formats even including support for playing Module music files.
    Another great thing about BASS Sound Library is that it supports wide array of platforms. While this might not seem very important to you since using Delphi 5 you are basically limited only to Windows platform. But it can still be an advantage because if in the future you chose to use some moder version of Delphi to try and develop another game for some other platforms as well you will already have good knowledge of using sound library that supports that platform.

    The only thing is that I'm not sure if BASS sound library still support so old Delphi versions as Delphi 5. But since it is free to use for non-commercial use I strongly suggest you give it a try.

    EDIT: BASS Sound Library is compatible with FreePascal so if in the future you decide to switch from Delphi to FPC/Lazarus you can keep using the same library.
    http://wiki.freepascal.org/Multimedia_Programming#BASS
    Last edited by SilverWarior; 30-12-2017 at 02:46 PM.

  10. #10
    Quote Originally Posted by Wiering View Post
    Hi Everyone,

    Sorry for resurrecting an old thread, but I started working on this again and want to finally get this game on to Steam.

    I was eventually able to get the fake fullscreen working, so thanks SilverWarior for suggesting that!

    I wasn't able to port the game to lazarus (too much assembly and other hacks that sadly don't work in lazarus), so I'm sticking with Delphi 5.

    Now I need to change the MIDI sound into streamed audio (.ogg or .mp3), which is unfortunately not supported by UnDelphiX.

    So does anyone have a suggestion on what library to use? It doesn't have to do much other than play background music (looping without gap), should sometimes suddenly change into a different song (my songs have 2 different endings). Should be free (but not GPL) and work in Delphi 5.
    Delphi 5 is pretty old. Did you tried Tokio? There is the free starter edition at Embarcadero's website. I installed it recently and has some differences with the old Delphi I know (I got stuck with Delphi 6) but it is not hard to upgrade my knowledge (but it is being a bit tricky to make my Allegro wrapper compatible with it though).

    Glad to see you're still fighting!
    No signature provided yet.

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
  •