Recent

Author Topic: Fairtris 2: The Ultimate Challenge  (Read 6410 times)

furious programming

  • Hero Member
  • *****
  • Posts: 864
Re: Fairtris 2: The Ultimate Challenge
« Reply #15 on: March 18, 2024, 12:45:46 pm »
I haven't had time to have a closer look but compiling default project result on linux x86_64 for me in:

Code: [Select]
Fairtris.Window.pp(91,24) Error: identifier idents no member "Win"

A native handle of the window is needed only on Windows and only to update the progress bar state of the taskbar button, so for non-Windows platforms it can be excluded using compiler directive. Fixed.

Quote
Since you distribute your own copy of SDL headers....

Only because I am confident in their operation and so that someone who downloads the repository or clones it does not have to search for and download files themselves, without which the project cannot be built or run. Therefore, the repository contains a copy of the current headers from PascalGameDevelopment and latest SDL libraries.

PS: I forgot to add license file to the folder where the header files are located — I have to fix this.

Quote
(quick check) If I comment out that part and after installing libsdl2-image-dev and libsdl2-mixer-dev the project seems to build fine.

Ok, thank you for testing!

Quote
After that, some error messages about not being able to locate the datafiles.... hard coded directory separators are the culprit there so I have attached a modified version of fairtris.arrays.pp

Nah, the codebase was written for Windows only and directory separators were hardcoded. This is another project where I forgot about them... I'll get right to it and use the DirectorySeparator constant.

Quote
Then the game actually runs at Linux for me.

I'm very happy about this. If the game works, we have our first success. Then it would be a good idea to check if a few other things also work:
  • Does toggling exclusive fullscreen using the F11 key work correctly?
  • If the exclusive video mode is turned off, is it possible to change the window size with the mouse wheel and the + and - keys?
  • If the window is smaller than the screen, can it be moved by pressing the left mouse button on its upper area (top 20% of the window height)?
  • Does double clicking the left mouse button toggle exclusive fullscreen?
  • Does the game detect the connection of a USB gamepad and allow you to set its mapping correctly in the game options screen?
These are the main issues, very important, that need to be checked. If anyone is interested, I would like to ask them to test it. If anyone doesn't understand something or don't know how to check it, feel free to ask — I will answer any questions. Thank you for all feedback.
« Last Edit: March 18, 2024, 12:49:59 pm by furious programming »
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Roland57

  • Sr. Member
  • ****
  • Posts: 450
    • msegui.net
Re: Fairtris 2: The Ultimate Challenge
« Reply #16 on: March 18, 2024, 03:16:48 pm »
@furious programming

Thank you for having done the modifications for Linux (and thanks to TRon).

The answer to all your questions is yes, excepted for + and - keys (which do nothing here, unless I am wrong) and for USB gamepad (untested because I don't have a gamepad).

Linux Mageia 64-bit.

My projects are on Gitlab and on Codeberg.

furious programming

  • Hero Member
  • *****
  • Posts: 864
Re: Fairtris 2: The Ultimate Challenge
« Reply #17 on: March 18, 2024, 06:33:17 pm »
The answer to all your questions is yes, excepted for + and - keys (which do nothing here, unless I am wrong)

Remember that these are the + and - keys that are next to Backspace (i.e. non-numeric). The have SDL_SCANCODE_EQUALS and SDL_SCANCODE_MINUS. Maybe on Linux they are assigned to different keys, not to the ones next to Backspace?

To test them, turn off exclusive fullscreen and then you can use mouse wheel and + and - keys to enlarge and reduce window size.
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Roland57

  • Sr. Member
  • ****
  • Posts: 450
    • msegui.net
Re: Fairtris 2: The Ultimate Challenge
« Reply #18 on: March 18, 2024, 08:01:04 pm »
Remember that these are the + and - keys that are next to Backspace (i.e. non-numeric).

OK. It works.
My projects are on Gitlab and on Codeberg.

furious programming

  • Hero Member
  • *****
  • Posts: 864
Re: Fairtris 2: The Ultimate Challenge
« Reply #19 on: March 18, 2024, 10:23:58 pm »
Ok, thank you very much for feedback. Don't worry — gamepads also works fine.
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

TRon

  • Hero Member
  • *****
  • Posts: 3158
Re: Fairtris 2: The Ultimate Challenge
« Reply #20 on: March 19, 2024, 08:48:08 am »
Latest version 2.0.1 fairtris sources build with Lazarus 3.0/FPC 3.2.2 on/for Linux x86_64 (gtk)

Does toggling exclusive fullscreen using the F11 key work correctly?[/li][/list]
Yes

Quote
If the exclusive video mode is turned off, is it possible to change the window size with the mouse wheel and the + and - keys?[/li][/list]
yes

Quote
If the window is smaller than the screen, can it be moved by pressing the left mouse button on its upper area (top 20% of the window height)?[/li][/list]
Nope

Quote
Does double clicking the left mouse button toggle exclusive fullscreen?[/li][/list]
Yes

Quote
Does the game detect the connection of a USB gamepad and allow you to set its mapping correctly in the game options screen?[/li][/list]
No idea. I would have to dig up a controller in order to check that properly.
All software is open source (as long as you can read assembler)

furious programming

  • Hero Member
  • *****
  • Posts: 864
Re: Fairtris 2: The Ultimate Challenge
« Reply #21 on: March 19, 2024, 02:14:15 pm »
    Quote
    If the window is smaller than the screen, can it be moved by pressing the left mouse button on its upper area (top 20% of the window height)?[/li][/list]
    Nope

    So it looks like the SDL hittest functionality does not work as expected. But remember — dragging the window is supported only if the window is smaller than the screen and the left mouse button is pressed when the cursor is inside the top 20% of the window height. Bottom 80% is used to handle double clicks, to toggle exclusive fullscreen mode.

    If the window is displayed in fullscreen mode (both desktop and exclusive), dragging the window is disabled. The custom hittest callback in this case is unregistered, so the entire window area supports only double clicks (standard hittest behavior, handled by the SDL).
    « Last Edit: March 19, 2024, 02:18:38 pm by furious programming »
    Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

    Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

    lainz

    • Hero Member
    • *****
    • Posts: 4593
    • Web, Desktop & Android developer
      • https://lainz.github.io/
    Re: Fairtris 2: The Ultimate Challenge
    « Reply #22 on: March 19, 2024, 02:17:06 pm »
    The standard in games for fullscreen is Alt + Enter.

    furious programming

    • Hero Member
    • *****
    • Posts: 864
    Re: Fairtris 2: The Ultimate Challenge
    « Reply #23 on: March 19, 2024, 02:21:42 pm »
    @lainz: yes, but for all other applications it is F11, both desktop applications and (some) games. Reserved keys in Fairtris were implemented in the way that the special function can be assigned to one key, so I leave it unchanged. And this is the only reason why Alt+Enter is not handled.
    « Last Edit: March 19, 2024, 02:24:27 pm by furious programming »
    Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

    Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

    hukka

    • New Member
    • *
    • Posts: 30
      • Github
    Re: Fairtris 2: The Ultimate Challenge
    « Reply #24 on: March 19, 2024, 08:15:54 pm »
    As someone who's been following the NES Tetris scene as a spectator, I found your projects really cool.

    I would hardcode Alt+Enter to toggle fullscreen since it's standard for games, and have F11 as the customizable secondary keybind.
    Also I suggest having the choice of using integer scaling instead of the awfully blurry bilinear scaling.

    furious programming

    • Hero Member
    • *****
    • Posts: 864
    Re: Fairtris 2: The Ultimate Challenge
    « Reply #25 on: March 19, 2024, 09:51:19 pm »
    As someone who's been following the NES Tetris scene as a spectator, I found your projects really cool.

    I'm very happy about that, thank you.

    Although you can be not only a spectator, but also a player. Fairtris 2 doesn't have much in common with the NES version, apart from mechanics, scoring, colors and sounds, but you can always try the first Fairtris, which is compatible with Nintendo Tetris for the NES. Using it, you can even play with other NES players via MaxoutClub, for example.

    Quote
    I would hardcode Alt+Enter to toggle fullscreen since it's standard for games, and have F11 as the customizable secondary keybind.

    Okay, if you insist. I removed the TNavigation class and changed the references to its properties to read keys from the TKeyboard class. Everything that was there before works the same as before, and I also gave the option to toggle fullscreen using the Alt+Enter shortcut. The changes are already in the repository and will be available in the next release. Here is the commit with all changes made.

    All special function keys were hardcoded (and still are) and there is no way to remap them. They are selected in such a way that no one needs them to assign gaming functions to them. Therefore, it makes no sense to provide the possibility of remapping them.

    Quote
    Also I suggest having the choice of using integer scaling instead of the awfully blurry bilinear scaling.

    Integer scaling is not an option because it looks super ugly. Moreover, Fairtris 2 supports a pixel aspect ratio of 8:7 for CRT compatibility — with square pixels the playing field is too high and the effect is as if the game was running too fast. So nothing will change on this topic. Moreover, pixel perfect graphics and square pixels result from a complete misunderstanding of what retro style is.
    Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

    Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

    TRon

    • Hero Member
    • *****
    • Posts: 3158
    Re: Fairtris 2: The Ultimate Challenge
    « Reply #26 on: March 20, 2024, 01:13:46 am »
      Quote
      If the window is smaller than the screen, can it be moved by pressing the left mouse button on its upper area (top 20% of the window height)?[/li][/list]
      Nope
      So it looks like the SDL hittest functionality does not work as expected. But remember — dragging the window is supported only if the window is smaller than the screen and the left mouse button is pressed when the cursor is inside the top 20% of the window height. Bottom 80% is used to handle double clicks, to toggle exclusive fullscreen mode.
      I double-checked.

      The moving of the window does (initially) work but as soon as I resized the window (+ - keys) the movement ability seems gone for me. No idea if that is as intended but I assume it is not ?

      Quote
      If the window is displayed in fullscreen mode (both desktop and exclusive), dragging the window is disabled. The custom hittest callback in this case is unregistered, so the entire window area supports only double clicks (standard hittest behavior, handled by the SDL).
      Do note that I also toyed with going full-screen and back to windowed mode so there might be something more to it than only the resizing.

      edit: indeed. The moment the game reaches the 'full-screen' state using + / - keys and then return back to a smaller windowed screen then the dragging functionality does not seem to exist anymore. Switching between windowed and full-screen (and back to windowed) with F11 key has the same effect.
      « Last Edit: March 20, 2024, 01:25:17 am by TRon »
      All software is open source (as long as you can read assembler)

      furious programming

      • Hero Member
      • *****
      • Posts: 864
      Re: Fairtris 2: The Ultimate Challenge
      « Reply #27 on: March 20, 2024, 07:43:04 am »
      Thanks for testing.

      Note that every time the size of the window changes, the hittest callback is updated. For fullscreen modes, the callback is unregistered so there is no option to test hit and drag the window. For all windowed modes, sizes smaller than the display, the callback is registered and dragging the window should be allowed. Code responsible for (un)registering the hittest callback is here:

      Code: Pascal  [Select][+][-]
      1. procedure TPlacement.UpdateWindowHitTest();
      2. begin
      3.   if FVideoEnabled or (FWindowSizeID = SIZE_FULLSCREEN) then
      4.     SDL_SetWindowHitTest(Window.Window, nil, nil)
      5.   else
      6.     SDL_SetWindowHitTest(Window.Window, @WindowHitTest, nil);
      7. end;

      this method is called both when the window size changes in the windowed mode, and when toggling fullscreen. There is no place where I could forget about setting the callback, so there must be a problem with the SDL. If you can, add some debug code to this method and check the result of the SDL_SetWindowHitTest — if it is -1 then there was error when setting the hittest callback and use the SDL_GetError function to get error message. You can just print it in the console (first enable the console usage in the project options window):

      Code: Pascal  [Select][+][-]
      1. procedure TPlacement.UpdateWindowHitTest();
      2. var
      3.   Result: Integer;
      4. begin
      5.   if FVideoEnabled or (FWindowSizeID = SIZE_FULLSCREEN) then
      6.     Result := SDL_SetWindowHitTest(Window.Window, nil, nil)
      7.   else
      8.     Result := SDL_SetWindowHitTest(Window.Window, @WindowHitTest, nil);
      9.  
      10.   if Result <> 0 then
      11.     WriteLn('Error message: "', SDL_GetError(), '"');
      12. end;

      If there is a problem and the error occurs, I need to report this problem to SDL developers because there can be a bug in the SDL library.
      « Last Edit: March 20, 2024, 07:46:26 am by furious programming »
      Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

      Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

      furious programming

      • Hero Member
      • *****
      • Posts: 864
      Re: Fairtris 2: The Ultimate Challenge
      « Reply #28 on: March 20, 2024, 10:40:21 am »
      Ok, I've changed support of the hit-test callback. There is no point to register and unregister it multiple times, since it can be used to handle hit-test both in the windowed mode and in the exclusive video mode. So from now, the hit-test callback is registered only once and never unregistered. This will work the same as previous but should help avoid problems on Linux systems.

      Here is the commit — https://github.com/furious-programming/Fairtris-2-UC/commit/5b601c6b3c74c34496303c72697e0a468088ce17

      Edit: I also moved the hit-test callback to the Fairtris.Window.pp unit. It should be there.
      « Last Edit: March 20, 2024, 10:51:07 am by furious programming »
      Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

      Working solo on an arcade, action/adventure game in retro style (pixel art), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

      TRon

      • Hero Member
      • *****
      • Posts: 3158
      Re: Fairtris 2: The Ultimate Challenge
      « Reply #29 on: March 20, 2024, 09:32:34 pm »
      Ok, I've changed support of the hit-test callback. There is no point to register and unregister it multiple times, since it can be used to handle hit-test both in the windowed mode and in the exclusive video mode. So from now, the hit-test callback is registered only once and never unregistered. This will work the same as previous but should help avoid problems on Linux systems.
      Thanks. Behaviour changed.

      From full-screen back to windowed (F11) the drag is now available so that issue got solved  :)

      The only thing that seem to fail for me is when pressing + up to the point where the window is full-screen and then pressing - again to make it a window again still does not allow me to drag. It is as if the hit-test area does not exist after the window has reached full-screen size. It is possible to workaround it by pressing F11 to go full-screen and F11 again to go back to windowed mode, as then the drag seems to become available again.
       
      I am a bit stressed on time so haven't been able to further investigate. I'll try to do that later this week.
      All software is open source (as long as you can read assembler)

       

      TinyPortal © 2005-2018