Results 1 to 10 of 12

Thread: Do I need a graphics engine?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Quote Originally Posted by SilverWarior View Post
    It is not the PPXL sithe what is confusing you but the sheer lack of proper knowledge about what FreePascal and Lazarus are. You See FreePascal and Lazarus are actually two separate projects (programs) where:
    - FreePascal is actually a combination of Compiler, Debugger and Linker
    - Lazarus is just a development IDE which makes use of FreePascal much easier and also allows some other features similar to the ones found in Delphi like visual UI design using LCL component suite.
    Oh I understand the difference between Lazarus and FreePascal, I think haha.
    From my understanding Lazarus uses FreePascal, and Lazarus version 1.4.4(which I was using before) was built using FreePascal 2.6.4.
    Lazarus 1.6, which is the latest version, is the first one to use FreePascal 3.0.
    Therefore I found it kinda confusing that the PXL site says they support Lazarus 1.4+.

    But it's no big deal. The only important thing is that everything has been working perfectly fine ever since I switched to Lazarus 1.6.

    Quote Originally Posted by SilverWarior View Post
    I believe author of PXL decided to go that way in order to make maintaing support for both FreePascal and Delphi much easier as they can share same codebase.
    Yeah, that makes a lot of sense.


    Quote Originally Posted by SilverWarior View Post
    As I mentioned above that is not the case. Unlike regular TTimer the TMultimediaTimer is much more complex. And the reason why it is using Application.OnIdle event is to gain maximum possible resolution without interfering with standard application messaging system.
    Ok, thanks. I've spent more time looking at the timer, and I think I understand how it works now.

    Quote Originally Posted by SilverWarior View Post
    There are only two way of doing this.
    One is avoiding any lengthy heavy calculation or at least having ability to split that lengthy calculation into multiple steps.
    Second one is implementing multithreading support where you can move such calculation to secondary thread/s. I haven't tried implementing multithreading in combination with TMultimediaTimer but I'm sure it can be done to some degree (no true asynchronous processing of graphics and game simulation). But if you really do need something like you can find Multithreaded Timer on the web.
    Quote Originally Posted by SilverWarior View Post
    As a game developer you will have to learn on how to make an efficient code.
    Yeah, I understand. I'm trying to limit the amount of advanced stuff I have to learn at once, so I'm hoping I won't have to learn multithreading too.
    It shouldn't be a problem simply using the TMultimediaTimer. I just have to become a lot better at actually writing efficient code.

    Yeah I noticed even small bits of lag in the graphics make a huge difference! That's actually what made me decide to look into using a graphics engine in the first place.
    I tried to add an animated background, which I simply updated using a TTimer, but I noticed it was a bit inconsistent in it's updating. Probably because the code that created and updated the background only relied on my limited knowledge of basic LCL stuff.
    Still, it ran smoothly enough, until I started adding more and more user interactivity. Right now my OnClick code is so inefficient that every time the player clicks somewhere, the background stops updating for 0.1 seconds.
    It's really not much, but it's still very noticeable, and it's definitely something I can't have in the finished version of my game!
    Once I've figured out how to use PXL correctly, I'll have to spend more time learning how to handle user input a lot better.


    Quote Originally Posted by SilverWarior View Post
    You just have to believe in yourself. You would be surprised of how much you can achieve.
    And BTW I'm only 6 years older than you. So we both have still lots of time for learning even thou sometimes learning speed can be a bit slow due to not having much free time to be used for programming.
    I'm sticking with this for 15 years already (last 7 years more or less focusing on learning about game development) even thou sometimes it seems I'm not making any progress.

    Just remember that there will be days where you would be as we programmers like to call it "in the zone" when you will do a lot of progress. And there would be days where you would just spend whole day banging your head around a single problem without any success.
    You see programming is not like any other work it is more like art. During good days you will make huge progress and during bad days you won't. You just have to accept that and live with it. And most importantly don't quit even when it seems that there are no good days coming.
    Thanks for the feedback! Like I've said, I really appreciate the help

    ---

    All in all, I feel like I'm progressing well. There's still a lot of stuff I don't understand, but it still makes enough sense that I haven't had much problems learning it, so far.

    My only problem right now is I can't find a good way to use sprites.
    In my old code, the main game screen is split into a grid, where all squares are 24*24 pixels. And I have the pictures of everything that could appear on the screen, saved in a single large image.
    Then, depending on what was supposed to be in a certain square, I simply used CopyRect to copy the appropriate(24*24) parts from a single large image I created.

    However, I can't seem to find any way to copy a part of an image using PXL. There's a lot of different functions for deciding what(whole) image to use, and a lot of parameters to decide how to copy it, but I can't seem to find a way to simply use a small part of a large image.
    Have I missed something, or do I have to save the graphics for every single thing in the game as a separate image?

    ---

    Also, do you happen to know any open source games created using PXL, or one of it's similar predecessors? The samples that came with the library are pretty good, but they're all very simple, and none of them feature any sort of user interactivity.
    I think I could learn a lot from simply seeing how someone else has used the graphics engine to create a playable game.

  2. #2
    Quote Originally Posted by ajol View Post
    My only problem right now is I can't find a good way to use sprites.
    In my old code, the main game screen is split into a grid, where all squares are 24*24 pixels. And I have the pictures of everything that could appear on the screen, saved in a single large image.
    Then, depending on what was supposed to be in a certain square, I simply used CopyRect to copy the appropriate(24*24) parts from a single large image I created.

    However, I can't seem to find any way to copy a part of an image using PXL. There's a lot of different functions for deciding what(whole) image to use, and a lot of parameters to decide how to copy it, but I can't seem to find a way to simply use a small part of a large image.
    Have I missed something, or do I have to save the graphics for every single thing in the game as a separate image?
    So you were creating and using Atlas Image manually by yourself when using LCL. You don't need to do this in PXL.
    That is al already being handled by TAtlasImages class. So when you are rendering certain image you can only specify its name and all the rest is being done by PXL.

    And while it is still possible to copy part of the image (at least it was possible in PXL predecessors) I would not recommend you doing that because by doing so you will just end up by moving lots of data from Video Memory to System Memory and then back to Video Memory. And as you can guess this can affect the performance a lot.
    You se in PXL all textures are stored in Video Memory directly so graphics card can render them much quicker. And while in PXL predecessors all textures were loaded in one big Image Atlas PXL allows you to load and unload multiple Image Atlases. This can then be even used for dynamic asset loading and unloading.

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
  •