Re: Missing games and levels in KSokoban?

"Friedrich W. H. Kossebau" <[email protected]> Thu, 01 Sep 2022 01:02:35 +0200
Newsgroups gmane.comp.kde.devel.games
Organization KDE
Message-ID <7735691.qOBuL9xsDt@klux>
Am Sonntag, 28. August 2022, 04:18:32 CEST schrieb Ian Wadham:
> Hi Friedrich,
>=20
> > On 26 Aug 2022, at 10:38 pm, Friedrich W. H. Kossebau <[email protected]>
> > wrote:>=20
> > 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 a=
nd
> >> KDE 3 times, was that a new maintainer came along and replaced all the
> >> games and levels with an entirely different set (called Sasquatch).
>=20
> 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/401d353748defbbf9ccd9770ce38=
6b8
> 505a38873
>=20
> 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 y=
ou
> 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 bli=
nd=20
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.
> >>=20
> >> I=E2=80=99ll have a dig through the repository in the next day or two =
and see
> >> what
> >> the current situation is re sets of levels.
> >=20
> > Okay. Already saw that in the ML archive discussions and made a mental
> > note, but with lower priority currently compared to theming.
>=20
> The level files released by Anders were indeed text files, even though th=
ey
> were always named =E2=80=9Clevel.data=E2=80=9D. They can be opened direct=
ly by vi and
> Apple=E2=80=99s 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" II=
RC.=20
Sadly no MIME type ever put to use, but might be also hard given no magic d=
ata=20
available to guess by content and when a suffix is also not wide-spread.

> The only =E2=80=9Cbinary=E2=80=9D 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, t=
he
> =E2=80=98\0=E2=80=99 character or C-type string- terminator. All those =
=E2=80=98\0=E2=80=99 characters
> could just be deleted, leaving the empty lines. Then the whole =E2=80=9Cl=
evel.data=E2=80=9D
> 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=20
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 mo=
re
> signifant that one might risk breaking (IIRC file I/O was a bit ho-hum in
> KDE 1 and Qt1 days, so maybe that=E2=80=99s why Anders used bin2c and #in=
clude to
> get the levels loaded).
>=20
> I see that Shlomi got around the problem, when porting to KF5, just by
> keeping an instance of the =E2=80=9Clevels/data.c=E2=80=9D file in the re=
pository and
> removing the =E2=80=9Clevels/level.data=E2=80=9D text-file.

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

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

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

> Anyway, if you wish to recover/reorder any or all of the games, the two
> versions of =E2=80=9Clevels/level.data=E2=80=9D just before the change ov=
er 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.
> >=20
> > The author of easySok agreed there, I saw :) Too bad that app also
> > stalled.
> >=20
> > Thought the few who would like to do levels can use a plain texteditor,=
 as
> > the supported level format is plain text based, no?
>=20
> 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 =E2=80=9Cplay=E2=80=9D (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 =E2=80=9Csolution=E2=80=
=9D 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 pleasu=
re
> 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=
=20
breathing again here. For now that is my minimal goal.

Next goal though is already walked onto, getting the graphics themable and=
=20
thus also open for scalable material. Being curious about the feasibility, =
I=20
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=20
already gone, and things work as before to what I tested :)
=2D> https://invent.kde.org/games/ksokoban/-/tree/work/kossebau/graphics
It is a primitive port right now (e.g. just painting everything as backgrou=
nd,=20
no QGraphicItems for all the moving objects). Developer in me wants to impr=
ove=20
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 integrate=
d=20
and activated next. Hopefully latest in October, so things are ready when=20
proposing the inclusion for KDE Gear 22.12.

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

Cheers
=46riedrich