Fairtris — a fair implementation of Classic Tetris®

Thread in 'Other games' started by furious programming, 15 Sep 2021.

  1. What is Fairtris?

    Fairtris is a video game, a clone of the 32-year-old Tetris® game produced by Nintendo for the Famicom and NES consoles, designed for modern Windows systems. Fairtris is not an emulator — it is a full-fledged game, created from scratch in Free Pascal language and with OpenGL support via the SDL library. Thanks to this combination, it is super-fast and ultra-light. This project was initially created as a tool to test various RNG algorithms, but after some time it turned into a complete video game.

    You can download the game here — Fairtris 2.0.0.5 beta 2 (for Windows Vista, 7, 8, 8.1 and 10).

    Also check out the project repository and the rich Fairtris wiki pages. If you want, you can also join a Discord server and take an active part in discussions and testing of the latest version of the game.


    Important features
    • implementation of gameplay mechanics compatible with the Nintendo Tetris® game,
    • extended mechanics with hard-drop and accumulation of soft-drop points,
    • support for EIGHT regional versions of the game, including original NTSC and PAL versions,
    • support for as many as SIX random piece generators, including the classic RNG,
    • the ability to start the game from any level up to the killscreen,
    • the ability to play on a keyboard or any USB controller (with input mapping support),
    • supports window mode and the low-resolution exclusive video mode,
    • support for additional meters, such as TRT, BRN or gain meter,
    • stores the best results for each game region and RNG type,
    • has a pause menu with the ability to quickly restart the game and change settings,
    • shows the game summary screen after each game,
    • support for two themes (minimalistic dark and classic skin),
    • possibility to use it with NestrisChamps and MaxoutClub,
    • it's light and very fast — should run smoothly even on a heavily loaded PC,
    • it is fully portable, no installation required,
    • and many more!
    More detailed information on how to handle the game and its mechanics can be found on wiki pages. If you want, you can also check out the FAQ page where you will find answers to basic questions.

    fairtris.png
     
    Last edited: 14 Oct 2021
    sinefuse, K and Muf like this.
  2. New version available for download — Fairtris 2.0.0.6 beta 3

    There were no big changes — only slight fixes for several menu screens, making it easier, for example, to resume and restart the game. I also changed the behavior after pressing the help button. Previously, the window would minimize and the browser help would open, but for some users, the window would not minimize properly when exclusive video mode was active. Therefore, I gave up minimization in favor of switching to windowed mode. I've also added code to open a specific wiki page based on the current scene, so you can get helpful information faster.
     
    Last edited: 4 Dec 2021
  3. The final, stable version has been released — Fairtris 2.0.0.7

    Final and stable version, implementing all fixes and improvements from the three previous beta versions. The last modification is the rendering of the window just after waiting for the next frame, which better imitates the NMI of the NES console (get input, handle logic, wait for the interrupt and then display the image on the screen).

    This release is designed for 64-bit Windows only (Vista, 7, 8, 8.1, 10 and further).


    End of development

    Fairtris was created mainly to test, in conditions similar to the original NES console, whether the classic Tetris® could be better by implementing a different and better RNG, as well as introducing changes to the gravity system in the PAL region. In one sentence, it allows you to check different variations of the same game and choose what's best for it. Considering the job is done, the development of this game is complete — all plans have been fully realized.

    If there is ever a demand for a PC version to replace the NES consoles, the code for this project can be used to create a worthy successor. In this case, the only need will be to select one or invent fair but challenging RNG and select NTSC region (possibly additionally PAL, if players care about it), implement the correct transition calculation and avoid any bugs in the game mechanics that exist in the original.[/url]
     
    Last edited: 4 Dec 2021
  4. I decided to break the compatibility with this Nintendo crap and fix the mechanics to create responsive controls. This will allow the player to focus entirely on stacking, rather than thinking about whether the DAS is charged or not (and if not, what to do to charge it). The original DAS is just as shitty as the controls in Prince of Persia — the player feels like pulling a charcoal cart rather than shifting small pieces.

    The latest version is now available for download — Fairtris 2.2.0.1


    Repaired DAS

    In the original game, DAS is clunky to use, preventing smooth play at levels 19 and above, which effectively limits the player from maximizing scores. To keep the DAS charged, you need to use the "wall charge" frequently. But wall charge was implemented to make the tucks possible, and using it to load the DAS so you can move piece quickly is nothing more than exploit.

    Therefore, I decided to fix this mechanism so that it does not hinder the player's gameplay. DAS works as in the original, but is additionally fully charged during the "entry delay" if the player is holding the left/right button. Since the player is holding the left/right button before a new piece spawns, it means the player knows where he wants to put the next piece and want to move it as quickly as possible after spawning and should be able to do so.

    This solution makes the controls responsive, but on the other hand, it is backward compatible — the basic technique of playing is still "skill stop", but thanks to the fix, "slow-tap" can be used without fear that it will not be possible to quickly move the next piece.


    Spin buffering

    In the original game, it is possible to make tucks in two ways — either by pressing the left/right button at the right moment (when the piece is on the desired row), or in advance (in a buffered manner). The second method makes it possible to push the piece against a fragment of the stack, and in the first frame of the game, in which the piece is on the desired row, it is automatically slid into the slot. Unfortunately, in the case of spins, their buffering is not implemented.

    In order to make the mechanics consistent and encourage the player to undertake advanced stacking techniques, spin buffering has been implemented. Thanks to this change, it is possible to press the rotation button a little earlier, and the piece will be rotated in the first frame in which it will be possible (similar to the case of tucks).


    Wall kick

    The original game has such poor control mechanics that a piece that is pushed against the stack frame cannot be rotated in certain configurations (because after rotation, a part of the piece would be outside the stack frame). This means that some spins, e.g. allowing you to burn a line in order to prepare for a tetris, are not available at all. For example — "S-spin" on the right edge is possible and often used, but not on the left, and would be very helpful.

    In order to expand the spin pool and give the player more room for maneuver, a basic "wall kick" has been implemented.

    However, the wall kick has been implemented in its basic form, i.e. the piece can only bounce off the walls of the stack and only changes its position horizontally. It is impossible to bounce off the contents of the stack, and the unrealistic, overcomplicated spins and twists, known from modern Tetrises, are also unavailable. Thanks to all of this, the controls are comfortable, intuitive and powerful, giving the player tons of possibilities, while maintaining the classic style (which is important in this case).


    New RNG algorithm

    The last thing added is a new generator — called BALANCED. This generator works very similar to the classic one, however, it prevents droughts by checking drought counters for each type of Tetrimino, and also prevents flooding by keeping a short spawn history.

    The operation of this generator is similar to the classic one, but it is balanced in such a way as not to hinder the gameplay unfairly. The generated sequences are unpredictable, the distribution of pieces does not seek equality, which makes the game challenging. However, on the other hand, it does not prevent the player from stacking perfectly, although only a few (the best stackers in the world) will be able to get to the killscreen without burning a single line.

    IMO, this is the best generator available in Fairtris.
     
    Last edited: 4 Dec 2021
  5. New version available to download — Fairtris 2.3.0.1


    Video mode and multi-screen support improved

    This version introduces fixes related to video mode support, its resolution and aspect ratio. From now on, the video mode is always launched on the main screen and always in the current resolution (forcing to use 800×600 resolution for video mode has been removed). Additionally, unlike the previous version, regardless of the mode, the game image is always rendered in 4:3 aspect ratio, so it always looks correct, regardless of resolution and display mode.

    Disabling the video mode has also changed. Previously, the window position was restored in this case, and in the latest version the window is always centered on the main screen. The windowed mode has not changed — it is still possible to move the window to any screen, as well as use the windowed full-screen mode also on any screen and with any resolution.
     
    ScottFritzpatrick likes this.
  6. On several computers I got the message, that the SDL system failed to initialize. I use the 64 bit version of Windows 10.
    Do you know how to solve this issue?
    upload_2021-12-8_22-5-43.png
     
    furious programming likes this.
  7. This error is generated by the SDL library, so it is independent of the source code of the game itself. The message implies that the user does not have sufficient privileges, so that the SDL subsystem cannot be initialized. To run the game, you need basic permissions and these can only be granted by the system administrator, as they have been restricted.

    Fairtris does not require administrator rights, and only saves data in the game directory (game settings and best scores). It does not store data in the user directory, nor does it modify the system registry. As for SDL, the question should be put to its creators — one, I am not responsible for its source code, and two, I have no idea what the "sensor manager" in this library is.
     
  8. Thank you for your fast response- The first thing that I've tried is to start the game as administrator and it didnt worked. Its definitely something related to SDL because your first 1.0 release worked fine.
     
  9. I will try to do something about it. Fairtris does not need a sensor module, so it should not be initialized at all. So I will try to change the code to initialize only the modules that the game needs (video, audio and joystick only). Perhaps this will resolve the initialization error.
     
  10. Ok great, I´ll give you some feedback then.
     
  11. @ScottFritzpatrick — in the attachment is the executable file with the added patch. Extract it, replace the existing exe file with the new one and check if the game initializes correctly. If so, let me know and I will release a new version.

    Thanks for reporting a bug and for your help.


    Edit: attachment removed after test.
     
    Last edited: 12 Dec 2021
  12. Works perfectly fine now - excellent work!
     
    furious programming likes this.
  13. Due to the reported problem, a corrected version has been released — Fairtris 2.3.1.2

    In this version the only change is the improved SDL subsystem initialization, so that Fairtris only uses initialization of the required SDL modules (video, audio, joystick and events only). This prevents the problem with initialization of the "sensor manager" module, which may occur on some computers.
     
  14. I am preparing a new, third version of the game — all because in the coming weeks we want to organize an online tournament in Fairtris between the Polish League seasons. And to be able to play matches under fair conditions, I need to provide both players with the same set of pieces, and to provide it, I need to add the option to enter seed for RNG to the game.

    That's why I decided to add a new menu and give you the option to choose the game mode. The single-player mode remains unchanged, but in addition there will be a qualification and match mode for the tournament on points, as well as a qualification and match mode for the tournament in speedrun. I already have the mode selection menu programmed — this is what it looks like for both skins:

    fairtris — game modes.png

    The single "single player" scene menu hasn't changed, and the other four will look like this:

    fairtris — game mode menus.png

    For qualifications, you will be able to set a countdown timer, while for a tournament match you will be able to type the seed for pieces generator. The game interface for the gameplay scene will be properly prepared for these modes to display the current speedrun timer, etc. (on the left a match for points, on the right a speedrun match):

    fairtris — gameplay modes.png

    The core of the game remains one and it will be used regardless of the selected mode — all I need to do is add an additional code to it, which will take into account the time calculation, add a "kill-screen" at the 19 level for speedrun etc. In addition, the renderers will slightly expand so that they paint additional data. The new version should be ready this year.
     
  15. And finally there is a fresh version — Fairtris 3.0.0.2 beta
    The full functionality of the new version of Fairtris is described in the project wiki.


    New game modes

    The main novelty in this version is the expansion of the game modes from one to six. Now the game is divided into two main categories — a marathon, the aim of which is to collect as many points as possible, and speedrun, in which you should reach the level 0 to 19 as quickly as possible (i.e. clear 190 lines) in no more than ten minutes.

    In addition, the marathon and speedrun qualification mode has also been implemented, which allows you to set a qualifications timer (the counter is visible during the game and in several menus). In addition to qualifying, there is also a match mode, in which the generator seed is set in order to have the same set of pieces for both players, so that the duel is fair. Seed can be entered manually from the keyboard or generate a random one (you can also copy it to the system clipboard and paste from it, using standard keyboard shortcuts).


    Multiple scores lists

    All results are collected in two main lists (marathon scores and speedrun times), regardless of the game mode selected (casual play, qualifying or match). Additionally, the game has temporary lists for qualifiers and matches to make it easier to show how qualifying was done and how the effectiveness of match games looked like.


    Choice of control mechanics

    A completely new thing is the ability to choose the control mechanics — modern mechanics are default, characterized by high responsiveness and greater possibilities (support for hard-drop, wall kick, spin buffering and more ways to charge the DAS), as well as classic, in line with the original mechanics from Tetris for the NES console.


    Generator performance has also been improved, rendering of some menus has been improved, and some new sounds have been added.
     
    Last edited: 18 Jan 2022

Share This Page