PureTris !

Advanced game related topics
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: PureTris !

Post by Mindphazer »

By the way, if someone has a way to force the redraw of the piece every line while it drops (by pressing Space bar), i'll be grateful !
It's located in the loop

Code: Select all

While MoveDown() = #true
Wend
The MoveDown() procedure moves the piece one line below, but the CanvasGadget is not refreshed, so the piece is only redrawn at the bottom of the game area...
I've tried to insert a

Code: Select all

While WindowEvent() : Wend
inside the loop, but it has no effect.
On MacOS, inserting a

Code: Select all

Repeat : Until WindowEvent() 
does it, but doesn't on Windows....

Thanks
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
User avatar
Janni
Enthusiast
Enthusiast
Posts: 127
Joined: Mon Feb 21, 2022 5:58 pm
Location: Norway

Re: PureTris !

Post by Janni »

Great work Mindphazer. I will study this to learn.
Plays great on Linux Mint 20.3
Spec: Linux Mint 20.3 Cinnamon, i7-3770K, 16GB RAM, RTX 2070 Super
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: PureTris !

Post by infratec »

You can try this:

Code: Select all

Case #PB_Shortcut_Space
                RemoveWindowTimer(#MainWindow, #Timer)
                AddWindowTimer(#MainWindow, #Timer, 10)
And

Code: Select all

Case #PB_Event_Timer
      If EventTimer() = #Timer
        If MoveDown() = 0
          RemoveWindowTimer(#MainWindow, #Timer)
          AddWindowTimer(#MainWindow, #Timer, tempo)
        EndIf
      EndIf
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: PureTris !

Post by Mindphazer »

Janni wrote: Fri Apr 21, 2023 10:47 pm Great work Mindphazer. I will study this to learn.
Plays great on Linux Mint 20.3
Thanks Janni
Glad you like it !
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: PureTris !

Post by Mindphazer »

infratec wrote: Fri Apr 21, 2023 11:43 pm You can try this:

Code: Select all

Case #PB_Shortcut_Space
                RemoveWindowTimer(#MainWindow, #Timer)
                AddWindowTimer(#MainWindow, #Timer, 10)
And

Code: Select all

Case #PB_Event_Timer
      If EventTimer() = #Timer
        If MoveDown() = 0
          RemoveWindowTimer(#MainWindow, #Timer)
          AddWindowTimer(#MainWindow, #Timer, tempo)
        EndIf
      EndIf
That's very smart Infratec !
Thanks a lot the the tip
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: PureTris !

Post by Bisonte »

Very nice Image
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: PureTris !

Post by Mindphazer »

Thank you Bisonte

I have updated the code (version 1.0.2) with a few enhancements (thanks Fred & Infratec)
The game can be paused with "P" key
See first post
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: PureTris !

Post by Mindphazer »

Hi
I've corrected a few annoying bugs (surprisingly, they were present only on Windows, not on MacOS, that's why I did not noticed them)
I've also made a few improvements (statistics, shadow of the piece to see where it will be positioned when it falls)
I'm still hunting for bugs, but I hope they are very few left
First post updated
Beware, the form has been modified too, so don't forget to copy the form and the source (I'm too lazy to insert the form inside the source !)
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
miskox
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Aug 27, 2017 7:37 pm
Location: Slovenia

Re: PureTris !

Post by miskox »

Very nice! But I think there are some bugs: if a piece (at least some of them) is all the way to the left or to the right rotating it does not work or stops working (if I rememebr correctly in original it works).

Saso
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: PureTris !

Post by jassing »

miskox wrote: Sun Jun 25, 2023 7:33 pm Very nice! But I think there are some bugs: if a piece (at least some of them) is all the way to the left or to the right rotating it does not work or stops working (if I rememebr correctly in original it works).

Saso
They rotate around the center, so at the edge it's blocked... Pretty sure this is normal.
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: PureTris !

Post by Mindphazer »

miskox wrote: Sun Jun 25, 2023 7:33 pm Very nice! But I think there are some bugs: if a piece (at least some of them) is all the way to the left or to the right rotating it does not work or stops working (if I rememebr correctly in original it works).

Saso
Yeah you're right. I have already corrected this behaviour, plus some few things (mostly cosmetics) but i've been busy these days so i didn't have time to post the new version yet
I'll try to do it in the next days.
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
miskox
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Aug 27, 2017 7:37 pm
Location: Slovenia

Re: PureTris !

Post by miskox »

Thanks. If you are updating it...maybe add a keyboard shortcut for 'start new game' and 'quit/exit'?

I couldn't find an option to store a piece. If my memory serves me right it was possible to 'store' a piece and use it later for example. (or maybe I just can't find a key).

Otherwise thank you again - I played it for a long time and I really enjoyed it.

Saso
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: PureTris !

Post by AZJIO »

Great.

Is it possible to add settings:
1. Figures should not be repeated.
2. The total number of figures is the same on average. If some figure often falls out, then in the next step, if it falls out again, then another random figure is requested. That is, so that there is no alternation of two figures more often than others. One figure came across in a row 3-5 times.
3. Add a level of difficulty. At an easy level, you can change the expected figure 1 time. The next figure is indicated at the top right, and it could be changed using the F2 key, but no more than 1 time per turn.
4. In a difficult level, increase the speed of the fall of the figure, but not to such an extent that it is impossible to play.
5. Game mode without time. A figure has appeared and you are thinking how to put it. It only drops when you press the down arrow. In this mode, you can find out if the game creates situations where you cannot win because the pieces do not allow you to do so.
6. When saving, add UTF+BOM. Or better to encrypt records.
7. Add language support

I scored 19794 points, while the speed was so high that it was impossible to figure out where to put the piece, you just move it into free space so as not to line up in a pillar.
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: PureTris !

Post by Mindphazer »

miskox wrote: Mon Jun 26, 2023 5:38 pm Thanks. If you are updating it...maybe add a keyboard shortcut for 'start new game' and 'quit/exit'?

I couldn't find an option to store a piece. If my memory serves me right it was possible to 'store' a piece and use it later for example. (or maybe I just can't find a key).

Otherwise thank you again - I played it for a long time and I really enjoyed it.

Saso
Keyboard shortcuts to start and quit a game are already implemented in the next version.
There is no option to store a piece as it was not on my todo list :D But i may change my mind some day...

Thanks a lot, i'm glad you enjoyed it !
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: PureTris !

Post by Mindphazer »

AZJIO wrote: Mon Jun 26, 2023 7:27 pm Great.

Is it possible to add settings:
1. Figures should not be repeated.
2. The total number of figures is the same on average. If some figure often falls out, then in the next step, if it falls out again, then another random figure is requested. That is, so that there is no alternation of two figures more often than others. One figure came across in a row 3-5 times.
3. Add a level of difficulty. At an easy level, you can change the expected figure 1 time. The next figure is indicated at the top right, and it could be changed using the F2 key, but no more than 1 time per turn.
4. In a difficult level, increase the speed of the fall of the figure, but not to such an extent that it is impossible to play.
5. Game mode without time. A figure has appeared and you are thinking how to put it. It only drops when you press the down arrow. In this mode, you can find out if the game creates situations where you cannot win because the pieces do not allow you to do so.
6. When saving, add UTF+BOM. Or better to encrypt records.
7. Add language support

I scored 19794 points, while the speed was so high that it was impossible to figure out where to put the piece, you just move it into free space so as not to line up in a pillar.
Thanks AZJIO for your feedback.
I'll have a look at the random distribution of the pieces. For now it's just a simple and basic random function. I have to think how to do this
Adding the possibility to change the next figure is a good idea.
You're right : The speed is indeed too high in the high levels, and the game is unplayable ! I have changed the way the speed increases in the upcoming version.
Language support is now half done in the next version : all the strings are stored in a Datasection, making it easier to adapt to your language
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
Post Reply