Sokoban (2025)

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie

Here's a quick mockup (playable, sorta) of Sokoban that I did tonight.

The idea here is to re-use the CDFJ engine that I've polished for Boulder Dash. Essentially just the systems are carried over, but graphics and game logic are new/modified. The characters, for example, are 5 playfield pixels wide here (like WenHop), and 27 scanlines deep.

I really wanted to see the comparison bewteen ChronoColour (as used in Sokoboo) and ICC (Interleaved ChronoColour) as used in later projects.  The video is showing ICC.


I might dabble with this for a few days and see where it goes.


Philsan


Andrew Davie

#2
I've worked on the pushing of boxes. Left and right are working OK now...
Game loop timing adjusted. Much nicer.


Andrew Davie

All box directions now work. The player animation is fine for left/right pushing, but I'm still to do the up/down.  The graphics for the shifted box characters are auto-generated from a single template shape through complex C macros. See Idiomatic C preprocessor macro programming for an explanation.


Andrew Davie

I realised, belatedly, that the Boulder Dash-type engine wasn't really a great match for Sokoban. The necessity of scanning the board limits the frame rate. But I really have zero reason to scan the board in Sokoban. So, I went about rewriting much of how the logic works in terms of starting box movement, triggering certain events, and overall game speed.

Now, for the most part, it runs in 1 frame (as it should!) and feels much smoother in terms of responsiveness. I'm part-way through reworking the boulder push code. The video shows lots of pushing (I did not push right, as that's borked at the moment).  As part of this, I consolidated movement code into fewer routines, essentially table-driven.

The annoying "walking in place" animations are just loose ends. I'll fix those shortly. I expect by next update the box pushing will look quite smooth and play well. There's glimpses of this towards the end of the video, where I push around a lot of boxes and it goes nice and smoothly and quickly.


Andrew Davie


In this instalment, I have separated the animation system from the movement system. Sort of. Now the walk animation is handled as a stand-alone unit cycling through walk frames, and the player points to whatever animation sequence it wants. This gives continuity when moving across "squares", as the walk animation doesn't stop/start and it's no longer bound to the player movement distance/speed. It was a bit of a pain to write, and perhaps overkill... but that' sme.

Also, now everything is smooth as the game loop is 1 frame/loop. The joystick is now much more responsive. I got rid of the buffered joystick stuff which gave a "slippery/buttery" feel. Now it's good.



Andrew Davie

I now have the "pills" (target markers) working, and you can push boxes on/off them.
It's quite smooth/nice, actually.  I might tackle the screen unpacking systems and then we'll have some playable levels. That would be good.


Andrew Davie

Hit me up if you'd like a binary to have a play with.
No game yet, but it's still fun just pushing boxes around.

Andrew Davie

Prior videos were using ICC (Interleaved ChronoColour).  Here's a video with ChronoColour, which of course does not flicker/shimmer at all. It looks pretty nice in this mode, too.


alex_79

Quote from: Andrew Davie on 09 Jul 2025, 01:42 AMIt looks pretty nice in this mode, too.
It does! The iCC mode tends to cause me a bit of eyestrain after a few minutes, especially if I'm close to the screen, so I usually prefer the plain CC mode.
Also, scrolling looks more crisp in CC mode, especially in the horizontal direction, and that, to me, compensates the less "solid" appearance compared to iCC (I always found the smooth full screen scrolling in Boulder Dash very impressive)

Andrew Davie

Quote from: alex_79 on 09 Jul 2025, 04:35 PM
Quote from: Andrew Davie on 09 Jul 2025, 01:42 AMIt looks pretty nice in this mode, too.
It does! The iCC mode tends to cause me a bit of eyestrain after a few minutes, especially if I'm close to the screen, so I usually prefer the plain CC mode.
Also, scrolling looks more crisp in CC mode, especially in the horizontal direction, and that, to me, compensates the less "solid" appearance compared to iCC (I always found the smooth full screen scrolling in Boulder Dash very impressive)


TY. My plan at this stage is to get a workable Sokoban done, with a few levels, and then release the source code for others to view/use. It's a good example of using the "character graphics" engine, with screen manipulation such as character changes and movement, and use of the automatic animation system (which here is doing the actual sliding of the boxes, and the pulsing of the dots).

Andrew Davie

#11
I've spent some time cleaning up the code. Basically removing any remnants of anything copyrighted from previous incarnations. It's close. I'm also trying to make it easy to understand for anyone game enough to try building it and modifying for themselves.

In particular...

1) The ChronoColour/iCC display code
2) Auto-detect and full implementation of NTSC, PAL, SECAM
3) The character-graphics screen draw systems
4) Full alphanumeric character set for sprites and playfield
5) The fine horizontal/vertical scrolling system
6) The auto-animating character graphics system
7) Circle and star "swipe" screen transitions
8) Sokoban on top of all that as a "how to".

I'm happy enough at this stage to start releasing binaries, too.  First one is attached!
Feedback welcome. Remember it's rough and only just over a week old.



Andrew Davie

#12
Sounds now added. Just a mockup tune.
I tidied up various animations, and polished a few things.
The scoreline shows the number of "pills" and the number of box moves made.
At startup I show a haiku. Just because. Was testing the word overlay system... but I kinda like it.
Next up, I think I need to work on the data format for levels; I can grab this from the last sokoban I did.



Andrew Davie

Well, I was putting off the room unpacking.  The idea is/was to use pre-defined rooms from various sokoban sites on the internet. There's a few formats going around the place. In Sokoboo (2019) I chose one format and had a hundred rooms or so. So, I went back to that, grabbed the room data and wrote a new unpacker in C. It worked first time - though, now I think about it, I should/should have used the assembly unpacker and saved myself the effort. Anyway, done now.

So in the video I'm just randomly cycling through the rooms. I suck at this game - most of them are totally beyond me as to how to solve. This has highlighted some issues though - it's real difficult to solve when you can't see much of the room. I'm obviously going to work on the scrolling to improve that - perhaps put in a manual scroll over the whole board with button pressed. Also, will be bringing back either overview mode or at least a zoomed out view as per BD.



Bomberman94

Plays and feels (very important for me) really great - not much missing for a ,,real" game!