Blockski+ , like Klotski but with a board editor.

So you have written that new, must have program. Let us see it here.
User avatar
BruceSteers
Posts: 1578
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Blockski+ , like Klotski but with a board editor.

Post by BruceSteers »

Added another little side game, a bit of Tetris if yr bored :)

Made a number of fixes since adding the multi-select. :-/

Some internal stuff...
I added a String[][] array to the board that's a grid reference to all the blocks, each String is a list of blocks occupying that space.
This speeds thing up slightly as now i am only referencing simple strings not complete block objects.
Checking if a block exists is now all done via the map array.

This allowed for a trick that i have used for the Tetris board. the board paint method can just paint a single block tile if a string exists at any grid part, ignoring blocks on the board.
So after a block has fallen and settled it is removed without removing the reference from the grid map.
so there is only ever one block on the board , the falling one. and when a line is filled i can simply delete the String[][] array line and add a new one to the top. The block on the board match the array.



Well it's been a fun adventure.

I have not used the klotski board editor much but it's getting there slowly with regards to the mess i made when adding multi-selection.
use it carefully, (mostly just don't rely on the undo feature yet)
Attachments
Untitled.jpg
Untitled.jpg (27.32 KiB) Viewed 2474 times
If at first you don't succeed , try doing something differently.
BruceS
User avatar
Technopeasant
Posts: 144
Joined: Saturday 13th July 2019 6:50pm
Location: Stony Plain, Alberta, Canada
Contact:

Re: Blockski+ , like Klotski but with a board editor.

Post by Technopeasant »

Nice work Bruce.
Technical director,
Piga Software
http://icculus.org/piga/
User avatar
BruceSteers
Posts: 1578
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Blockski+ , like Klotski but with a board editor.

Post by BruceSteers »

Technopeasant wrote: Saturday 9th March 2024 2:22am Nice work Bruce.
Thank you kind sir. 😎

It's getting there bit by bit ☺️
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1578
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Blockski+ , like Klotski but with a board editor.

Post by BruceSteers »

Since the last update i have been trying to iron out some of the bugs, 1 of which I introduced by changing from single selection to multiple selection.
Mostly the problems were caused by 2 things i think...
1. The BlockOverlap(hBlock, X, Y) method was returning the hBlock where it should have only returned other blocks that hBlock overlapped.
2. If the mouse went beyond the board limits something silently went wrong and caused errors in the layout.

So now BlockOverlap is fixed and the mouse can no longer go beyond the board limits during a drag event. (not sure if that'll work on wayland)

Save/ restore was also not working as expected.
It used to just save all the block names and their positions. then on restore it loaded the board and moved all the blocks. this turned out to be buggy. i think maybe some blocks loaded with different names.
So now it saves every blocks complete config (type, shape, size, color, etc) and on restore it clears the board of blocks and then creates new ones for each saved item. This seems to be working fine now. The bad side is previously saved games can no longer be restored. (sorry about that)

Added features in version 1.3.27 ...
* AutoSave in the editor ,set how many seconds to check if the board has changed and auto-save the changes.
* Shape editor now resizes. size can be changed in the shape editor and if an outer row/column is blank the block size is automatically reduced to fit.
* My GF was 2000+ moves into a game when her laptop gave a critical battery warning and before she plugged in the laptop died and she lost her game. so I added a battery checker/warning, you can set the battery percentage to warn at.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1578
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Blockski+ , like Klotski but with a board editor.

Post by BruceSteers »

Right then ,, this program coding is now winding down to a finish i think.

I found a few issues that were mostly related to blocks going outside the board area causing errors.
So now you cannot move blocks outside the board and you cannot create or paste blocks outside the board (they will be automatically moved within the board)

The swap buttons that swap width and height values now work better, if a block has a shape it is rotated like a tetris block.

the board cannot shrink below any block positions now either by swapping dimensions or manually setting.

The shape editor now can change width and height and will auto-trim any blank edges.

There has been many a tweak/fix.


Current status (known bugs)
Almost finished.

The play board is pretty darn stable and working well.
There is only one bug i know of, a "vanishing wall" can disappear when the prize block is just "next to it" and has not actually crossed it. (i'll get around to fixing that sometime)

The editor possibly has a bug or 2 still. mostly i think with undo/redo feature
but it is very usable now. I'm not sure it needs any more features, for now i will just be keeping an eye out for bugs.

V 1.3.35
https://forum.gambas.one/download/file.php?id=1575
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1578
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Blockski+ , like Klotski but with a board editor.

Post by BruceSteers »

Some more updates , currently on V 1.3.38

Blocks can now be flipped horizontally or vertically

A new paint mode for Wall blocks PaintErase. if paint mode is set to Erase it does not draw the wall but it erases the map beneath it giving invisible edges.
(see the attached snapshot that has large Erase walls on each corner)

Added some more boards made by my girlfriend who is complaining much less about bugs now ;) lol
Attachments
Untitled.jpg
Untitled.jpg (165.88 KiB) Viewed 1839 times
If at first you don't succeed , try doing something differently.
BruceS
Post Reply