Missing games and levels in KSokoban?

Ian Wadham iandw.au at gmail.com
Sun Aug 28 03:18:32 BST 2022


Hi Friedrich,

> On 26 Aug 2022, at 10:38 pm, Friedrich W. H. Kossebau <kossebau at kde.org> wrote:
> 
> Am Freitag, 26. August 2022, 09:02:56 CEST schrieb Ian Wadham:
>> One of the things I disliked about KSokoban, which I played in KDE 2 and KDE
>> 3 times, was that a new maintainer came along and replaced all the games
>> and levels with an entirely different set (called Sasquatch).

Actually Anders Widell was the author all the time in the early days. It was he who
committed the first release at
https://invent.kde.org/games/ksokoban/-/blob/401d353748defbbf9ccd9770ce386b8505a38873

He also removed the original levels and replaced them with Sasquatch etc. So I wonder
if he was motivated by copyright concerns when he did that. As you will have seen, the
provenance of the original levels is given in the AUTHORS file, which you edited a few
days ago.

Incidentally, here is the  original TODO file: I don't think it has changed much over the years... :-)

* Icon
* Help file
* Go to specific level
* Scores
* Save/restore
* Load levels from files
* Drag & drop movement

>> Although the
>> new levels were good, the earlier levels were nice because they were graded
>> from easy to hard and gave everyone, including little kids, access to the
>> game.
>> 
>> I’ll have a dig through the repository in the next day or two and see what
>> the current situation is re sets of levels.
> 
> Okay. Already saw that in the ML archive discussions and made a mental note, 
> but with lower priority currently compared to theming.

The level files released by Anders were indeed text files, even though they were
always named “level.data”. They can be opened directly by vi and Apple’s Text
Editor on my MacBook Pro. They should probably have a .txt suffix these days.

The only “binary” or data-like feature is the occurrence of a line at the end of each level
that contains a single zero-byte. That is, of course, the ‘\0’ character or C-type string-
terminator. All those ‘\0’ characters could just be deleted, leaving the empty lines. Then
the whole “level.data” file would be easily parseable into games and levels as a multi-line
text file, thus obviating all that bin2c complexity that was in the original build.

FWIW that roundabout way of loading the game data was one thing that put me
and others off persevering with porting KSokoban to KDE4. It was hard to be sure
that it was just a workaround to avoid file I/O and not something more signifant that one
might risk breaking (IIRC file I/O was a bit ho-hum in KDE 1 and Qt1 days, so maybe
that’s why Anders used bin2c and #include to get the levels loaded).

I see that Shlomi got around the problem, when porting to KF5, just by keeping an
instance of the “levels/data.c” file in the repository and removing the “levels/level.data”
text-file.

Anyway, if you wish to recover/reorder any or all of the games, the two versions of
“levels/level.data” just before the change over to Sasquatch and later to KF5 ought to
contain the most recent commits of all the text or text fragments you may need.

> Even more after I 
> discovered https://ksokoban.online which helped me solve levels where I first 
> thought "this is impossible, the data or game must be broken" :P and was to 
> give up working on reviving releases.
> (totally could understand also why people even filed bug reports against 
> ksokoban about "level x is not solvable", as I later saw, could have been me 
> :P)

That is one cool website, one of the best I’ve seen for playing a game. Simple,
direct and easy to operate. And what a joy to have a “Show Solution” option… :-)

>> Also, I think the game is a good one to have a Game Editor added.
> 
> The author of easySok agreed there, I saw :) Too bad that app also stalled.
> 
> Thought the few who would like to do levels can use a plain texteditor, as the 
> supported level format is plain text based, no?

Yes, it is text, but probably not easy to edit and play. Experience with composing
KGoldrunner levels suggests that you need a visual editor and a quick way to
switch to “play” (and test) mode when trying out ideas, moving walls, re-positioning
treasure, etc. A lot depends on exact placement to change a level from easy, to hard,
to impossible. I think the same might be true in KSokoban. As time went on, guys
would send me KGoldrunner levels that were unplayable by me, so I added a feature
to record all moves and save them to a file, which could be renamed as a “solution”
file. Then I insisted that game-composers supply such a file along with their levels.
The ingenuity and inventiveness of those guys has given me endless pleasure over
the years...

> See also
> https://docs.kde.org/trunk5/en/ksokoban/ksokoban/loading-external-levels.html
> 
> The whole level loading and management support though needs an overhaul 
> indeed, to make things more discoverable, understandable & usable.

Hear, hear!

> Would be my own next target after theming, together with bringing back those 
> lost levels where possible. But only later this year, or early next. But agree 
> this is a rather weak spot.
> 
> And having a dedicated separate editor for easy level design would be neat. As 
> well as integration with online communities already collecting & managing 
> levels. But that is a lot of work I do not see myself currently having time 
> left for, TODO list already full :)

Well, it’s great that you are working on all this, Friedrich.

All the best.
Ian W.



More information about the kde-games-devel mailing list