Resource centre for ZX Spectrum games
      using Manic Miner and Jet Set Willy game engines

 

Archive of the

Manic Miner & Jet Set Willy Yahoo! Group

messages

 

 

 

Message: 5797

Author: andrewbroad

Date: 13/04/2006

Subject: Re: Willy's behaviour on conveyors during the toilet-run

 

Daniel wrote:

>
> I was extremely upset by Andrew's message # 5784 and the
> suggestion that:
>
> 1. "Jet Set Willy: The 2005 Megamix" is not toilet-completable;
> 2. A game can run differently on different emulators;
> 3. The emulator I normally use (ZX32) does not emulate ZX Spectrum
> faithfully.

I apologise for any upset caused. It just never occurred to me that
different right-keys would behave differently during the toilet-run!
However, I /have/ experienced unfaithful emulator-behaviour in the
area of keyboard-handling:

1. The old emulator that I used on my Mac, MacSpectacle 1.8.2, can't
recognise more than two keys being pressed at once.

2. RealSpectrum behaves differently from a real Spectrum in JSW's
WRITETYPER mode. Keys '1' to '6' ('1' to '8' in JSW128) form a room-
number in binary, but some combinations don't take you to the room
they're supposed to. And the set of WRITETYPERable rooms are
different on a real Spectrum and in RealSpectrum!

JSW48 rooms which are NOT WRITETYPERable:
- real Spectrum: [18,19, 22,23, 26,27, 30,31, 34,35, 38,39, 42,43,
46,47,48,49, 52,53, 56,57, 60,61]
- RealSpectrum: [24-31, 58-63], i.e. RealSpectrum cannot
recognise '4', '5' and '9' being pressed together (in fact my PC
makes a weird beeping noise whenever '4', '5' and '9' are pressed
together).


> I also found out, Andrew, that you usually play using the "P"
> key for "Right", and "O" for "Left", isn't that true? :-)

Yes - I am right-handed, so I always use 'O' for left (index-finger)
and 'P' for right (middle finger).

For jumping I usually use Space (thumb), and sometimes Caps-Shift
(little finger) - although I have to be careful not to use them
together as this resets the game! ;-)


> Here's what I found out - and it's very interesting! :-)
>
> I.
>
> [For all of the features mentioned in this section please discard
> the key "P" - I am NOT referring to it. If I mention the "Right"
> key, I mean: "W", "R", "Y", "I" and the cursor key, and if I
> say "there is no way" to do something, this may exclude holding
> "P".]

Pressing 'P' to stop during the toilet-run is just as valid as
pressing 'W' (or whatever) to move forwards on a right-conveyor.

In fact, from my perspective, 'P' is *the* right-key, and 'W' is
just a special key that I must use if I get stuck on a right-
conveyor during the toilet-run.


> So here are the general rules of Willy's behaviour on conveyors
> during the toilet-run:
>
> - Willy runs smoothly over the left-, off- and sticky-conveyors.
> There is no way to stop him there.

Except by pressing 'P'.

Unfortunately, if you stop on a left-conveyor, you cannot move on -
not even by pressing 'W'! :-(

Off-conveyors behave exactly the same as Water-cells in all
circumstances (cell-behaviour does not include conveyor-animation).

Running over a sticky conveyor during the toilet-run is like walking
over a right-conveyor (or walking right over a sticky conveyor) in
normal mode - you cannot stop, not even by pressing 'P'.

These are interesting extensions to the field of conveyor-mechanics,
and there's no reason why a patch-vector shouldn't put Willy in
toilet-run mode (POKE 34271,2) temporarily (perhaps on a per-room
basis, using POKE 34271,0 to restore him to normal mode in all other
rooms).

I might do that in Advanced MM/JSW Trainer, so that the player can
practise toilet-run mechanics without having bed-completed the game.


> - Willy stops on a right-conveyor, at the edge of it. Then you can
> nudge him rightwards by pressing the "Right" key - he goes to the
> right step-by-step (or two-steps by two perhaps, because it's
> still double speed). You can also turn Willy around - by pressing
> the "Left" key - but you cannot move him to the left.
> A right-conveyor IS a good way to stop Willy during the toilet-run
> in order to introduce challenges which involve avoiding guardians.

But pressing 'P' is an even better way.


> The above behaviour patterns are probably true also with conveyor-
> ramps. I did not test this thoroughly, I have just checked that
> Willy stops on a right-conveyor (and can be moved on with
> the "Right" key).

They will be. In JSW48/128, the test for Conveyor's colour-attribute
under Willy's feet is independent of the test for Ramp's colour-
attribute.

And I'd be amazed if JSW64's Conveyor-Ramps were any different,
though I must confess that I have neither tested nor disassembled
JSW64 to verify this.


> II.
>
> The peculiar behaviour of the key "P":
>
> - When you hold "P" and press one of the "Left" keys, Willy turns
> around (but won't go left).

Which could be useful for avoiding a VG in a pixel-perfect situation.


> - When you hold "P" and press one of the other "Right" keys, Willy
> behaves similarly to being on a right-conveyor - he moves
> rightwards every time you press another "Right" key (while holding
> "P").
>
> The above shows, IMO, that pressing "P" during the toilet-run
> causes EXACTLY the same effect as if Willy were on a right-
> conveyor.

Fascinating.


> If you hold the key "P", it doesn't matter whether you are running
> over Water or Earth - the effect is the same.

In JSW48/128, the code to check what Willy's standing on (#8E36)
works like this:
1. If there is a Fire-cell under Willy's feet - either in his left
cell-column OR his right cell-column, then go to Step 4.
2. If there are two Air-cells under Willy's feet - in both his left
cell-column AND his right cell-column, then go to Step 4.
3. Willy is standing, so go to Step 7.

[Falling]
4. (#8E62) If Willy is jumping, then go to #8FBC to handle
horizontal movement.
5. Code for falling...
6. Return from Willy's movement subroutine (do not continue to Step
7).

[Walking and Conveyors]
7. (#8ED4) Set the conveyor-mask to recognise the left- and right-
keys.
8. If there is a Conveyor-cell under Willy's feet, then set the
conveyor-mask to ignore the left-key (if it is a right-conveyor),
the right-key (left-conveyor) or both (sticky conveyor).
9. Detect keypresses, using the conveyor-mask to decide what to
ignore...

In short, anything other than Air or Fire is a stand-onable cell,
which may have conveyor-behaviour or not.

JSW48/128 uses the colour-attribute of a cell to determine its
behaviour (i.e. its effective cell-type), so cell-types can be
combined by giving them the same colour-attribute.

So in the above, where it says "if there is a X-cell...", this
actually means "if there is a cell that has the current room's
colour-attribute for X..."

It may help to understand that JSW48/128 constructs the secondary
attributes-buffer from the actual room-definition. Each cell in the
secondary attributes-buffer is simply a colour-attribute, and it is
these colour-attributes which determine cell-behaviour - not the
cell-types in the actual room-definition.


> This whole thing is very interesting, because it means that "P" is
> a very special key for the toilet-run. I was unaware of its
> peculiar behaviour (which includes stopping Willy almost
> anywhere), because I always play using "Q" for "Left" and "W" for
> right (and usually "Space" for jumping). On the other hand Andrew
> apparently uses "O" and "P" for left and right, respectively, and
> that's why he wasn't aware of the "normal" behaviour of the other
> "Right" keys.

It's a good job you realised that, or we'd probably both think the
other was mad by now! ;-)


> So, to sum up, I can say with relief that "JSW: The 2005 Megamix"
> IS PERFECTLY TOILET-COMPLETABLE :-) . I would also kindly suggest
> that placing a right-conveyor on the route of the toilet-run might
> be one of the features to take into account for the Advanced
> Trainer (as well as using "P" to stop Willy elsewhere).

I plan to include all the quirks mentioned in this and Message 5787
when next I update my Advanced MM/JSW Trainer page (except off-
conveyors, which actually have no conveyor-behaviour at all).


> At this point I see no need for further experiments with various
> emulators, as I think they all behave in the same way. However, if
> somebody should want to experiment, I have uploaded two files into
> my folder ("Daniel Gromann"), called "ConvExp1.z80" and
> "ConvExp2.z80". The first one lets you see easily what happens
> on all four kinds of conveyors plus when falling on a right- and
> left-conveyor, and the other one lets you see what happens when
> you fall on an off- and sticky-conveyor.

ConvEx2.z80 is redundant to me, for I simply used runtime POKE
34271,0 to get past "Falling on LEFT-conveyor" and "Falling on
STICKY-conveyor" (and POKE 34271,2 once past the respective
obstacles).

ConvEx2.z80 would also be redundant if you used one of the three
methods for giving the player a choice of ways during the toilet-run:
1. Rope (as in _The 2005 Megamix_)
2. Vertical lift (press 'P' to stop)
3. Horizontal lift (keep stopping and starting to stay on the lift!)


> Also, for the sake of completeness, I should say I have tested the
> above-mentioned phenomena on the following emulators:
>
> - ZX32 v. 1.03.98.0211 and v. 2.00.04.04 (beta)
> - Real Spectrum v. 0.97.26
> - Warajevo v. 2.51
> - Spectaculator 6.10
> - X128 v. 0.94
> - MESS 0.104
> - ZXSpin v. 0.504
> - Spec256 v. 1.2
> - Multi-machine emulator v. 1.30b
> - EmuZWin v.2.7
> - Aspectrum 0.1.8
> - Es.pectrum v. 06b
> - GLECK 0.0.5
> - YaSE 2 v. 0.4.1
> - Z80 v. 4.00

Good grief! There's dedication.


> So I think that the picture is clear and we know exactly how Willy
> behaves on various types of conveyors during the toilet-run and
> how the player can influence it. I guess that now it is up to you,
> technically-minded ones, to explain WHY that happens and why "P"
> plays such a special role... :-)

I guess it's because Step 9 above (#8EFA) works roughly as follows:
9.1. Read Port #DFFE (keys 'Y' to 'P') and apply conveyor-mask.
9.2. If Willy is in toilet-run mode, then modify the conveyor-mask
to ignore left-keys in the following steps.
9.3. Read Port #FBFE (keys 'Q' to 'T') and apply conveyor-mask.
9.4. Read Port #EFFE (keys '6' to '0') and apply conveyor-mask.
9.5. If a Kempston-joystick is present, then read Port #001F and
apply conveyor-mask.
9.6. A keypress resets the pause-counter.
9.7. Modify the byte at #85D0 (Bit 0: Willy's direction; Bit 1:
horizontal movement on/off) according to what was pressed, so that
it will be acted on in the next time-frame.

So we see why the right-keys 'Y', 'I' and 'P' /could/ be treated
differently - it's because they are detected before Step 9.2.

So why is 'P' a special case? The explanation involves a lot of low-
level bit-twiddling, I'm afraid, so here's the gist of it. If 'P' is
pressed, then the LSb of Port #DFFE will be read as 0. And if Willy
is in toilet-run mode, then a 1 gets shifted into the accumulator
and XORed with that 0, giving a LSb of 1, which disables moving to
the right.

--
Dr. Andrew Broad
http://geocities.com/andrewbroad/
http://geocities.com/andrewbroad/spectrum/
http://geocities.com/andrewbroad/spectrum/willy/

 

 

arrowleft
arrowright