Missing games and levels in KSokoban?

Friedrich W. H. Kossebau kossebau at kde.org
Thu Sep 1 00:02:35 BST 2022


Am Sonntag, 28. August 2022, 04:18:32 CEST schrieb Ian Wadham:
> 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/401d353748defbbf9ccd9770ce386b8
> 505a38873
> 
> 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.

Okay, matches what I have understood looking at the history, so was not blind 
somewhere.

> >> 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.

On the webs I had seen some also using/recommending the extension ".sok" IIRC. 
Sadly no MIME type ever put to use, but might be also hard given no magic data 
available to guess by content and when a suffix is also not wide-spread.

> 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.

Thanks for the investigation and report, will take as notes once I get to 
that.

> 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.

I would put my clueless bet as well on avoiding I/O and also package size 
(when looking at the use of zlib), even more when taking into account when the 
code was written.

These days one might simply use Qt resource system instead, and have moc do 
the code generation instead ;)

Though think that is not such a drama, more an implementation detail, at least 
does not really get into my way luckily. Having written code for data 
conversions might have trained my brain here :)

> 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.

Noted.

> >> 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...

Can see that, thanks for the motivational text :)

Let's see how much I catch fire trying to get KSokoban at least to release 
breathing again here. For now that is my minimal goal.

Next goal though is already walked onto, getting the graphics themable and 
thus also open for scalable material. Being curious about the feasibility, I 
had first success in switching the code to use QGraphicsView and KgTheme,
State can be seen in my work branch, the data.c file for the graphics there is 
already gone, and things work as before to what I tested :)
-> https://invent.kde.org/games/ksokoban/-/tree/work/kossebau/graphics
It is a primitive port right now (e.g. just painting everything as background, 
no QGraphicItems for all the moving objects). Developer in me wants to improve 
this soon of course, that's why he does it, but the user does not notice ;)
Once that is sanitized, the ants theme (from Magazynier) is to be integrated 
and activated next. Hopefully latest in October, so things are ready when 
proposing the inclusion for KDE Gear 22.12.

If time permits, having level support reworked before might be nice as well, 
but only thinking about having this done for 23.04 here, for some interesting 
winter time challenge.

Cheers
Friedrich




More information about the kde-games-devel mailing list