Recent

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

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Fairtris 2: The Ultimate Challenge
« on: March 16, 2024, 10:09:42 pm »
Release for Windows 64-bitFairtris_2.0.0.20_release.zip

Repositoryhttps://github.com/furious-programming/Fairtris-2-UC
Fairtris 2: wikihttps://github.com/furious-programming/Fairtris-2-UC/wiki



Fairtris 2: The Ultimate Challenge is another installment of the game Fairtris, this time not in the form of a tool for testing various mechanics and generators, but as a normal video game. The engine remained the same, but it was modernized, I added a lot of improvements and fixes (including bug patches), and it also received a new graphic design, much nicer than that of its predecessor — a graphical jump from NES to SNES. The game is of course free, the source code is open and unlicensed, so you can do anything you want with it.

The new version almost completely breaks compatibility with the NES, almost all features that exist in Nintendo Tetris® have been removed, and only those that provide the best responsiveness of controls and the most fun remain. Fairtris 2 does not have a gameplay limit like the NES version — the highest supported piece falling speed has been slightly lowered to allow for infinite play. This allows you to play as long as you can (or as long as you can stand it).

In line with new achievements of classic Tetris players, I added support for glitched color palettes for the stack and pieces that are used at levels 138 to 255. The final challenge is to reach level 255 and beat it, which will be rewarded with a special screen. Reaching level 256 takes about an hour and a half and is very difficult, especially due to the very unfriendly glitched colors on some levels.

The control mechanics have been unified and only the best functions have been selected, and an option to set the speed of automatic piece shifting has been added, available in the game options screen. The new Fairtris still supports seven different RNG algorithms, so everyone can choose the one they like and give them the best fun.

The game window can run in desktop mode and be smaller than the screen, it can also run in desktop fullscreen mode (on any screen) and in exclusive fullscreen mode, giving the best performance (unfortunately only on the main screen). The game can be operated using the keyboard and gamepads, and you can also change the keyboard/gamepad mapping in the game options.



If you need to learn more, please see readme and wiki of the project on GitHub. There you will find descriptions of individual game screens, controls and the game content. Have fun! 8)
« Last Edit: March 16, 2024, 10:16:28 pm by furious programming »
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.


flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Re: Fairtris 2: The Ultimate Challenge
« Reply #2 on: March 17, 2024, 01:51:49 am »
You are right — fixed, thank you for feedback!
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

dseligo

  • Hero Member
  • *****
  • Posts: 1406
Re: Fairtris 2: The Ultimate Challenge
« Reply #3 on: March 17, 2024, 02:54:56 am »
You are right — fixed, thank you for feedback!

And kudos for the game - it is very fun to play! :)

ginoo

  • Jr. Member
  • **
  • Posts: 84
Re: Fairtris 2: The Ultimate Challenge
« Reply #4 on: March 17, 2024, 09:48:39 am »
not for linux? It's written that it only works with windows.

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: Fairtris 2: The Ultimate Challenge
« Reply #5 on: March 17, 2024, 10:40:32 am »
not for linux? It's written that it only works with windows.
Not for Linux, reasons:
- QueryPerformanceFrequency / QueryPerformanceCounter
- Taskbar (comobj)
- ShellExecute (really ?, for opening the wiki ... tsk  :P )

Thus also not the biggest issues in the world.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Re: Fairtris 2: The Ultimate Challenge
« Reply #6 on: March 17, 2024, 01:04:32 pm »
not for linux? It's written that it only works with windows.

Yes, only for Windows, just like the wiki says. I don't know Linux, I don't use it, so I don't know about ports to platforms I don't know. Besides, I've just finished working on the first release — for now I'm collecting feedback, correcting errors and adding improvements. Ports can wait.

Not for Linux, reasons:
- QueryPerformanceFrequency / QueryPerformanceCounter

You can change the entire Fairtris.Clock.pp module to this one — https://github.com/chronoscz/Fairtris/blob/master/source/Fairtris.Clock.pp — and everything will work properly.

Quote
- Taskbar (comobj)

You can safely remove Fairtris.Taskbar.pp unit and all code related to it, because it is used only on Windows, to update the state of the taskbar button progress bar.

Quote
- ShellExecute (really ?, for opening the wiki ... tsk  :P )

Really — this function is used to open a website with a given address in the default browser. Just replace it into OpenURL from the LCLIntf unit, for example. I will implement support for Linux and other desktop platforms later. For now I need to collect feedback and fix all problems and bugs, if any exists.
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

lainz

  • Hero Member
  • *****
  • Posts: 4599
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Fairtris 2: The Ultimate Challenge
« Reply #7 on: March 17, 2024, 01:09:41 pm »
Some strange bug, when I first downloaded the game and run it, the game was like 100 pixels moved to the right down of the screen, instead of being centered.

The bug appeared only once, even if I delete the settings file.

I'm not sure if it has to do that I'm running at High DPI 125%

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Re: Fairtris 2: The Ultimate Challenge
« Reply #8 on: March 17, 2024, 01:15:51 pm »
Windows 11?

By default, the game window should run in exclusive fullscreen mode, not be centered on the screen.
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: Fairtris 2: The Ultimate Challenge
« Reply #9 on: March 17, 2024, 01:16:04 pm »
Yes, only for Windows, just like the wiki says. I don't know Linux, I don't use it, so I don't know about ports to platforms I don't know. Besides, I've just finished working on the first release — for now I'm collecting feedback, correcting errors and adding improvements. Ports can wait.
You made that clear from the start furious programming.

Sorry for the tease and, indeed the porting can wait and only makes sense when your original code runs as intended.

Thank you for the tips and links as I did not realize there was a fork.

Quote
For now I need to collect feedback and fix all problems and bugs, if any exists.
Yes, exactly that and in case someone can't wait for the port.... well... it is now clear how to fix things at least for Linux.

Thank you for sharing  8-)
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Re: Fairtris 2: The Ultimate Challenge
« Reply #10 on: March 17, 2024, 01:20:28 pm »
@TRon: adapting the game code to Linux will take 5 minutes for someone who knows Linux, so if you can't wait, just for now, do it yourself. In the near future I will add support for other platforms but I don't know them at all, so I need some help with porting — someone who can test the ported version, confirm that it works and prepare the release. 8)
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Re: Fairtris 2: The Ultimate Challenge
« Reply #11 on: March 17, 2024, 01:41:48 pm »
Ok, I checked what needs to be changed to make the code independent of the platform and it turned out that it actually took five minutes of work. I added compiler directives (taskbar) and used functions from LCLBase (help) and SDL (clock) and it seems that now the code should also compile on other platforms, including macOS, Linux and FreeBSD.

Changes:

Help:
ac1fc93c3ff6e19f771bdda63eec7fa72f7d22a1

Taskbar:
415e4920e595a7dd3b64e591c853c300e7af6551
8a3461873565e18bb03cb1cd6d3581bde8915c4f

Clock:
853b7fbc683f8e8115af690b8c207666f4705af49

Please, give me a feedback if there are problems with compilation on non-Windows platform. Thank you for feedback!



Edit: I need to change also the code of determining the target directory for settings file and best score files. On Windows, these files are stored in the folder with the executable file. On other platforms it must work differently.
« Last Edit: March 17, 2024, 01:57:17 pm by furious programming »
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

lainz

  • Hero Member
  • *****
  • Posts: 4599
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Fairtris 2: The Ultimate Challenge
« Reply #12 on: March 17, 2024, 02:15:06 pm »
Windows 11?

By default, the game window should run in exclusive fullscreen mode, not be centered on the screen.

Yes Windows 11

And yes it was full screen but as Insaaiad with an offset. Maybe an issue of the graphics driver perhaps?

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Re: Fairtris 2: The Ultimate Challenge
« Reply #13 on: March 17, 2024, 02:25:32 pm »
And yes it was full screen but as Insaaiad with an offset. Maybe an issue of the graphics driver perhaps?

Maybe, but also maybe an issue with handling exclusive fullscreen in SDL2. You are the second one who have problems on Windows 11. The other guy can't see the window when he run the game first time — there is no window on the screen, a button on the taskbar that shows ~5fps for few seconds (so something sucks CPU horribly for some unknown reason) and then, the window pops up as small, not in exclusive fullscreen mode. I have no idea what's wrong with this Windows 11. Maybe I should force the SDL to use OpenGL instead of counting on the default graphics backend (which is Direct3D on all Windows systems).

If you like, you can play with the code that handles toggling exclusive video mode. It is located in the Fairtris.Placement.pp unit, in the TPlacement.UpdateVideo method — https://github.com/furious-programming/Fairtris-2-UC/blob/master/source/Fairtris.Placement.pp#L273-L292

Code: Pascal  [Select][+][-]
  1. procedure TPlacement.UpdateVideo();
  2. begin
  3.   if FVideoEnabled then
  4.   begin
  5.     SDL_SetWindowSize      (Window.Window, FVideoBounds.W, FVideoBounds.H);
  6.     SDL_SetWindowPosition  (Window.Window, FVideoBounds.X, FVideoBounds.Y);
  7.     SDL_SetWindowFullScreen(Window.Window, SDL_WINDOW_FULLSCREEN);
  8.  
  9.     UpdateWindowClient();
  10.     UpdateWindowCursor();
  11.     UpdateWindowHitTest();
  12.   end
  13.   else
  14.   begin
  15.     SDL_SetWindowFullScreen(Window.Window, SDL_DISABLE);
  16.     UpdateWindow();
  17.   end;
  18.  
  19.   UpdateWindowBoundsMouse();
  20. end;

Nothing special. If the exclusive fullscreen is to be used (FVideoEnabled flag is set), then the bounds of the primary monitor are used to set the window size and position (native resolution of the primary monitor). Then the SDL_SetWindowFullScreen enables exclusive fullscreen. Other methods only updates the renderable client area, cursor visibility and the hittest callback, and they are not related to the position and size of the window.

PS: I've added support for storing settings and best score files in the user's preferences directory (instead of in the executable folder), so now the game code should be fully compatible with Unix-like systems. The SDL_GetPrefPath function is used to determine preferences directory.

PPS: I've added forcing SDL to always use OpenGL.
« Last Edit: March 17, 2024, 02:42:43 pm by furious programming »
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: Fairtris 2: The Ultimate Challenge
« Reply #14 on: March 18, 2024, 03:17:02 am »
Please, give me a feedback if there are problems with compilation on non-Windows platform. Thank you for feedback!
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"
e.g.
Code: Pascal  [Select][+][-]
  1.   if SDL_GetWindowWMInfo(FWindow, @SysInfo) = SDL_TRUE then
  2.     FHandle := SysInfo.Win.Window // <-------------- HERE
  3.   else
  4.     raise SDLException.CreateFmt(ERROR_MESSAGE_SDL, [ERROR_MESSAGE[ERROR_SDL_CREATE_HANDLE], SDL_GetError()]);
  5.  
Since you distribute your own copy of SDL headers....

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

Ah, ic. it is driver dependent, solved it for now with:
Code: Pascal  [Select][+][-]
  1.   if SDL_GetWindowWMInfo(FWindow, @SysInfo) = SDL_TRUE then
  2.       {$if     defined(windows)}
  3.       FHandle := SysInfo.Win.Window
  4.       {$elseif defined(unix)}
  5.       FHandle := SysInfo.x11.Window
  6.       {$else}
  7.       raise SDLException.CreateFmt(ERROR_MESSAGE_SDL, [ERROR_MESSAGE[ERROR_SDL_CREATE_HANDLE], SDL_GetError()])
  8.       {$endif}
  9.     else
  10.       raise SDLException.CreateFmt(ERROR_MESSAGE_SDL, [ERROR_MESSAGE[ERROR_SDL_CREATE_HANDLE], SDL_GetError()]);
  11.  

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

Then the game actually runs at Linux for me.
« Last Edit: March 18, 2024, 04:38:14 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

 

TinyPortal © 2005-2018