Jump to content
IGNORED

Sokoban


Andrew Davie

Recommended Posts

OK, I've started on both ends of that zany idea of an internet high score table with a code generated by the game. First I need to find out how to do an actual web page with a database backend. It's been 25 years (well, 1995) since I did web page stuff and it's... changed a bit. I've been pointed to WordPress, and also PHP. I had a bit of a look at both, leaning towards PHP but not quite sure yet.

On the '2600 side, I need a screen that displays a code. The code is an encrypted form of information giving the level ID (not number, as it may move - so it's an actual ID tied to levels making them unique), number of moves, and perhaps a time to complete. I had intially suggested a 6-letter code, but instead I've opted for a 9-digit code as digits are already available. The video shows what I've come up with - 9 digits in a 3x3 box. It's just showing random stuff for now, of course. It comes up after the successful completion of any level.

 

  • Like 2
Link to comment
Share on other sites

A couple of more different characters for the walls...

946397096_ScreenShot2019-09-17at11_19_42pm.thumb.png.239eefd01bba42ce23d0d7f103955685.png

 

That doesn't look very '2600-like at all...

363344689_ScreenShot2019-09-17at11_25_01pm.thumb.png.df402d0105cedce1d9c08b19e971a0ce.png

 

I'll have 4 wall-types altogether - block, brick, stripe and rock.  I put the 4th in and I get a timing issue in the kernel. Yet there are no page crossings. Mmmmh. Strange. Well, I always enjoy a hunt.


 

Edit: an alternate 'rock' ....

 

494561044_ScreenShot2019-09-17at11_48_06pm.thumb.png.569dd3742a58a62cf42140cb947cb640.png

 

 

 

 

Edited by Andrew Davie
  • Like 3
Link to comment
Share on other sites

Here's a fascinating "bug" I had yesterday. I mentioned I couldn't add the 4th character in the game, because the screen started glitching. Well, it turned out to be a very very obscure "bug" which Z26 and Javatari do not emulate correctly, and Stella does. The weird thing, though, is that Stella showed a glitch, and the other two didn't. And I most definitely did NOT expect a glitch!

So, I'm using 3E bankswitching. The key to this is that 1K of RAM gets switched to $f000-$F3FF and you read from those addresses but if you want to write to RAM, then you add $400 to the address.  So, to write to $F020 you access $F420. Easy enough. I was running self-modifying code in the RAM to draw the kernel. All has been working just fine, but adding another character definition AFTER the kernel... caused the kernel to glitch...

 

1202092528_ScreenShot2019-09-18at12_46_56am.thumb.png.5eedacedab5d1a0cc2e873e12db40299.png

 

See that stuff at the left.... shouldn't be there. Only appears there when I put the new character in.

 

It turns out that I had a subroutine in the RAM bank which just happened to be at the very end of the bank. Now subroutines end with "RTS". And when I put the extra character in, it only just fit, and the RAM became fully used. No problem there, so far. But what is interesting is that the RTS then became the very last byte of RAM - at $73FF.  And as a part of the normal operation of RTS, there is access to the byte AFTER the instruction. So, very briefly, the bus had $7400 on it. And at that point the bankswitching goes "ah! I see an access to the write address $7400, I better do that and write data to $7000 as instructed".  So the first byte of RAM got corrupted. And what was at the very first byte of the RAM?  A "SLEEP 6" delay instruction for the kernel timing. So that got stomped on - but interestingly because it was 3 "nops", you could stomp on the first one with just about anything and not cause the kernel to crash. You just affected the timing.


That's it in a nutshell - this is one of the more obscure bugs I've ever seen. Had me scratching my head for a day or so - until eventually I reported it as a Stella bug. Ironically, it turns out to be a bug in the other emulators I tried and Stella got it correct.  Stellerator also gets it right, although I wasn't aware of that emulator at the time. I have to thank @DirtyHairy for his brilliant sleuthing in finding this one!

It's also a very rare and actual real-world example of why emulation (sometimes) needs cycle-accurate emulation of the CPU, not just instruction-accurate emulation.

 

 

 

 

 

 

 

 

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

9 hours ago, Andrew Davie said:

Had me scratching my head for a day or so - until eventually I reported it as a Stella bug. Ironically, it turns out to be a bug in the other emulators I tried and Stella got it correct.

That's not the first time something like this has happened.  Many people over the past few years have reported bugs in Stella behaviour because it didn't behave like other emulators, and in the end we found it was because of incomplete emulation in the other emulators.  Several people have even commented that Stella 6 is deficient in audio, since it makes some games sound so much worse than before (and worse than other emulators).  But in fact Stella/Stellerator are the most accurate in that area, and the 'bad' audio is actually how a real console really sounds.  Sometimes people don't realize how limited the original console really was, and they base their opinion on the 'idealized' sound that some other emulators produce.

  • Like 7
Link to comment
Share on other sites

15 minutes ago, stephena said:

That's not the first time something like this has happened.  Many people over the past few years have reported bugs in Stella behaviour because it didn't behave like other emulators, and in the end we found it was because of incomplete emulation in the other emulators.  Several people have even commented that Stella 6 is deficient in audio, since it makes some games sound so much worse than before (and worse than other emulators).  But in fact Stella/Stellerator are the most accurate in that area, and the 'bad' audio is actually how a real console really sounds.  Sometimes people don't realize how limited the original console really was, and they base their opinion on the 'idealized' sound that some other emulators produce.

 

To be fair to me, in this particular case the other emulators showed expected behaviour, and Stella didn't :)

It's just my expectations were not expecting... the unexpected :P

 

Link to comment
Share on other sites

1 hour ago, Andrew Davie said:

 

To be fair to me, in this particular case the other emulators showed expected behaviour, and Stella didn't :)

It's just my expectations were not expecting... the unexpected :P

 

Wasn't meant as a disparagement, simply stating the fact that it's happened before.  And definitely I agree that if you have an emulator that displays exactly what you expect (especially when it looks good) and another one doesn't, then you will tend to think the 'good looking' one must be correct.  But of course that's not always the case, just as with this example.

 

In any event, the feedback and bug report is appreciated, even if in the end it wasn't a Stella bug at all.

  • Like 1
Link to comment
Share on other sites

12 hours ago, Andrew Davie said:

Here's a fascinating "bug" I had yesterday. I mentioned I couldn't add the 4th character in the game, because the screen started glitching. Well, it turned out to be a very very obscure "bug" which Z26 and Javatari do not emulate correctly, and Stella does.

 

 

May want to ping John about the bug, he's still updating z26.

  • Like 1
Link to comment
Share on other sites

I've been working on a "CODE" screen. At the completion of each level, you're presented with this screen, which displays 12 decimal digits. These digits encode information about the level you have just completed. This information includes the number of moves, the time taken, the level number, and some extras to make the code difficult to reverse-engineer. Of course, someone's going to do that eventually... but for now, it's a.... code.

 

You take this code to the sokoboo website, and enter it. If your code indicates a new high score for that level, you get to enter your name/initials and be famous forever. Well, maybe not forever... "a period of time", let's say. And, maybe not famous... perhaps "seen".  Anyway, that's the basic concept - a website holding the "high scores" for each level.

 

Now, what's a high score?  Well, it's doing a level in fewer moves and quicker time than others.  If you can do that, you get on the top 10 list for that particular level.  Of course, you can just ignore the code altogether and be a loser.

 

So, the code is presented as 12 digits organised into 3 rows of 4 digits each. Because I can, basically. The kernel wasn't the simplest thing to write - getting those 4 digits with the shape definitions for all the digits in all the various combinations/mirroring/masking, etc... in under 2K... was a bit of a challenge. I've had to "cheat" a bit, and there's a bit of masking going on.

 

Anyway, the codes right now are bogus so don't save them.  When the website is up and running, then I will activate the codes, and we can see which levels people are playing, which are basically impossible (though none of them should be) and more interestingly, how many moves they take.

 

Very happy to have @DirtyHairy on board to help with this!

 

The video shows a few levels with the code screen presented after each level completion.

 

 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

A videos showing the code display screen "reveal" - in slow-mo so you can see exactly what's happening.

 

 

I'm still a little bit wishy-washy about this. I don't particularly like how the "animating" digits look. They aren't really that "clean" and appear to wobble all over the place I might go to a sort of pseudo 7-segment type of digit instead, and see how that goes. It would be more in keeping with the in-game "scoreline", though it would be a shame because I actually like the look of these digits.
 

Edit3: Gonna leave the digits, as the super-fast version (see Edit2) looks pretty good to me.

Edit: OK, the "normal" video is completely buggered by the 30Hz video frame rate, so I've removed it and instead I'll add the binary and you can look at "normal" through an emulator or on the real thing.

Edit2: I just tested a "super fast" version and kind of like it - that's the 2nd binary.

Let me know which you prefer - the first or second binary :P

 

 

sokoboo_20190921.bin

sokoboo_20190921fast.bin

 

Edited by Andrew Davie
30Hz killer
  • Like 1
Link to comment
Share on other sites

On 9/22/2019 at 9:11 AM, Andrew Davie said:

If anyone can be bothered doing some TV screenshots for me, I'd love to see how the colours and graphics are working on actual TVs.

I tried, but I can only capture the game play with my phone and the phone.  The colors are much more rich and crisp, than what you see via my phone capture. 

 

On 9/20/2019 at 10:59 AM, Andrew Davie said:

Let me know which you prefer - the first or second binary :P

I prefer the second (fast) binary.  Love what you've done with the game so far.

 

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...