Jump to content

tinyBigGAMES

Members
  • Content Count

    44
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by tinyBigGAMES


  1. Dllama.png.dfea16179b4ec59d12401f29fc43574d.png

    Dllama, a simple and easy to use library for doing local LLM inference directly from Delphi (any language with bindings). It can load GGUF formatted LLMs into CPU or GPU memory. Uses Vulkan back end for acceleration.

    Simple Example

    uses
      System.SysUtils,
      Dllama,
      Dllama.Ext;
      
    var  
      LResponse: string;
      LTokenInputSpeed: Single;
      LTokenOutputSpeed: Single;
      LInputTokens: Integer;
      LOutputTokens: Integer;
      LTotalTokens: Integer;
    
    begin
      // init config
      Dllama_InitConfig('C:\LLM\gguf', -1, False, VK_ESCAPE);
    
      // add model
      Dllama_AddModel('Meta-Llama-3-8B-Instruct-Q6_K', 'llama3', 1024*8, '<|start_header_id|>%s %s<|end_header_id|>',
        '\n assistant:\n', ['<|eot_id|>', 'assistant']);
    
      // add messages
      Dllama_AddMessage(ROLE_SYSTEM, 'you are Dllama, a helpful AI assistant.');
      Dllama_AddMessage(ROLE_USER, 'who are you?');
    
      // display the user prompt
      Dllama_Console_PrintLn(Dllama_GetLastUserMessage(), [], DARKGREEN);
      
      // do inference
      if Dllama_Inference('llama3', LResponse) then
        begin
          // display usage
          Dllama_Console_PrintLn(CRLF, [], WHITE);
          Dllama_GetInferenceUsage(@LTokenInputSpeed, @LTokenOutputSpeed, @LInputTokens, @LOutputTokens,
            @LTotalTokens);
          Dllama_Console_PrintLn('Tokens :: Input: %d, Output: %d, Total: %d, Speed: %3.1f t/s',
            [LInputTokens, LOutputTokens, LTotalTokens, LTokenOutputSpeed], BRIGHTYELLOW);
        end
      else
        begin
          Dllama_Console_PrintLn('Error: %s', [Dllama_GetError()], RED);
        end;
      Dllama_UnloadModel();
    end.



     

     

    • Like 2

  2. logo256.png.913a963b047a94ecfea50aeb397bd79a.png

     

    Integrate with OpenAI's ChatGPT API seamlessly from Delphi.

     

    Features

    • Easily access the GPT API from a single class
    • Supports both GPT3 and GPT4 models
    • API key can be read from ChatGPTApiKey environment variable if defined
    • Automatically sanitizes input to minimize errors
    • Ability to define proxy settings
    • Adjust personality response with a precision range of 0-1, from precise to creative
    • Stream responses just like in the ChatGPT web interface

    Usage

    • Get your API Key: https://platform.openai.com/account/api-keys
    • Define environment variable ChatGPTApiKey and assigned your API key. You may have to reboot your machine for it to take effect.
    // Basic example showing how to query ChatGPT
    uses
      AskChatGPT;
        
    var
      LChat: TAskChatGPT;
    begin
      LChat := TAskChatGPT.Create;
      try
        // set chat params
        LChat.Model := GPT3; // use the GPT3 model, or GPT4 for the GPT4 model
        LChat.Creative := 1; // 0-1, 0 being most percise and 1 being most creative
    
        // ask question
        LChat.Question := 'What is Delphi?'
    
        // print question
        PrintLn('Q: %s', [LChat.Question]);
    
        // process and print response
        if LChat.Process then
          PrintLn('A: %s', [LChat.Response]);
      finally
        LChat.Free;
      end;
    end;

    Media

     

    Download

    https://github.com/tinyBigGAMES/AskChatGPT

    • Like 4

  3. 1. If you have not done so, make sure you have excluded all Delphi related folders + your project folders from real-time virus scanning

    2. ASLR is enabled by default so there may be places in your code that are now suddenly invalid whereas it worked perfectly before. There may be places where you must use NativeInt/NativeUInt instead for example. So, check for ASLR related issues that may exist in your code base.

     

    After doing the above, the constant AVs and crashes diminished for me. 


  4. 5 hours ago, David Heffernan said:

    Ugh, this has to be the worst possible solution

    lol, I will assume that you never used CreateFileMapping? So, with just three calls with no other dependencies, you can setup IPC between EXEs. With just two calls you can allocate virtual memory into the address space of your EXE or those same calls with different parameters, you can map a large file into your EXE address space and access it as it was contiguous memory. The power of CreateFileMapping at your disposal. Why does it need to overlay complicated?


  5. SDL_logo.png.762740747c963e21ec70726a062e5a92.png

     

    SDL3 for Pascal

     

    If you want to get your hands dirty and directly use the new SDL3, I got you covered. 😎

     

    Add SDL3 to your uses statement and it will be linked into your executable with direct access, no DLLs to maintain.

     

    You also get miniaudio (for audio), Nuklear (for GUI), pl_mpeg (for video) and stb (for images & fonts) and more.

     

    Added a contrib folder and accepting PRs, if you wish to add a contribution. To start the ball rolling, I added ziparc archive utility for making standard password protected zip archives, using zlib/minzip from SDL3pas only.

    Enjoy!

     

    https://github.com/tinyBigGAMES/SDL3

    • Like 4

  6. 1 hour ago, aehimself said:

    I know I'm being picky, so feel free to completely ignore my "suggestions".

     

    The demo looks really good. I was thinking on trying myself out in game development so an easy-to-use library could keep my initial struggles at a minimum. So keep up the good work, I'll keep an eye on the repo for sure!

    Hi, thanks. Oh no worries, I welcome all feedback. 

     

    I just committed a huge update to the repo today with all of that and more. :classic_cool:

     

    There is a new unit GamePascal.Framework, there is a new class TGame that you can derive your games from with all of what you suggested built in. TGame, TActor, TActorList, TActorScene together allow you to have a dynamic and responsive OOP system to manage your game. All the examples have been updated to take advantage of this.  
     

    • Like 1

  7. Also, you can always spin up a TCompiler instance (see GPCC if you want to play around with it now) and compile your source standalone via the built-in CaaS (compiler as a service). :classic_cool: There will be more information/examples about CaaS in future releases.  The allows for the move toward a standalone game engine/ide environment in the future.


  8. 1 hour ago, aehimself said:

    You might want to include the differences, pros and cons in the GitHub readme not to leave the impression of a library that gets outdated as soon as you get used to it.

    Let's leave that feature to some JavaScript frameworks 🙂

     

    Point taken. 
     


  9. 1 hour ago, aehimself said:

    It would be nice to see an actual demo of what the engine can do.

    Things are a little bit confusing, what happened to GameVision toolkit, and what it Delphi GameKit?

    GVExamples in the distro (unzip and run). This is just v0.1.0, more examples and features coming in subsequent releases.

     

    GV was folded into DGK when I switched to SDL2 and it optimized for more recent versions of Delphi.

    GPT uses SDL3, it is designed to work on more compiler/windows versions and will have more/advanced features that will eventually be included. Will not be hampered by limitation of a compiler version not having feature X which prevents you from using it. As long as your compiler version can target win64 and have Unicode, then it should be able to work.

    • Like 1

  10. logo.thumb.png.9b86269d21ecf7f83e4eee493dd03b22.png

     

    GamePascal™ is a professional indie game toolkit that allows you to do 2D game development using the Object Pascal language. Officially supporting Embarcadero Delphi® and FreePascal compilers on desktop PC's running Microsoft Windows® and uses Direct3D® for hardware accelerated rendering.

    It's robust, designed for easy use and suitable for making all types of 2D games and other graphic simulations. You access the features from a simple and intuitive API, to allow you to develop your projects rapidly and efficiently. There is support for textures, audio samples, streaming music, video playback, loading resources directly from a compressed and encrypted archive, a thin object-oriented actor/scene system, collision detection and much more. GamePascal, make 2D games in Pascal. Easy, fast & fun!

     

     

     

    https://gamepascal.org

     


  11. You MUST exclude all Delphi folders + YOU_PROJECT_FOLDER from your real-time virus scanning, else world of hurt ensues.

    I use Window Security and if I do not do this, it will chew on Delphi/generated exe and interfere with many aspects of the normal code and debug process.


  12. 19 hours ago, aehimself said:

    Windows Defender. I know what sites to visit and what to download / execute 🙂

    Spot on. Win10 Pro x64.

    No idea. I have an on-board Intel 620 and an additional Radeon R5 M430. The last time I used my PC for gaming was when I quit WoW about 10 years ago so I'm kinda rusty in these things 🙂 Intel's driver is 30.0.101.1960, Radeon is at 27.20.20904.4000 if it makes any sense.

     

    When I first started your demo there was a moment of DOS prompt and then nothing. No worries if my laptop cannot run it, it's not a workhorse. I just got a tidy bit worried, questioning my life decisions and uploading the executable on VirusTotal.

    Handle your exceptions if you can, please 🙂

    I found the issue and updated GVExample, it should work for you now. You can redownload from the release page. Sorry about that. The repo has been updated as well. Thanks for reporting. 👏

    • Like 1

  13. Just so you know, all my EXEs are code signed tinyBigGAMES LLC (for your confidence and peace of mind). I would never intentionally release malicious software. I do understand your concern however, I would have been thinking the same thing, LOL. I suspect most likely the virus scanner which is interfering with it. I use Window Defender too and I have exclude all Delphi related folders just to be able to use it comfortably, else I get random AVs and other issues all day long. If you have a folder that you have excluded or if you could possible exclude GVExamples folder and see it will run. Note, you can right click on the exe, view properties and you will find its signed. LOL, "questioning my life decisions", how many times have I been to that very place. I do appreciate you check it out though. This demo is in the repo, and you can directly compile it in Delphi.

×