2020-10-14


Just starting out and really wanting to start something new whilst making a game that I would enjoy playing myself. I’m come to appreciate that I really like puzzles in games - whether it’s spotting patterns or solving problems.

So I’m beginning Marbles2 (or Marbles Squared) in NextBASIC.

I’ve started with the random algorithm and I wanted a simple routine that I could repeat in other languages. I found a reasonably simple XOR shift algorithm which is written in assembly but simple enough that I could port it to JavaScript (for testing).

This routine is then encoded into bytes (decimal) and used in my NextBASIC - again, only because I want to control the RNG. So I get to do confusing things like this:

#autoline 10

PROC init()
PROC pickRandom() TO %a

PRINT %a
STOP

DEFPROC init()
  %i=0
  REPEAT
    READ %o
    BANK 17 POKE %i,%o
    %i=%i+1
  REPEAT UNTIL %o=201
ENDPROC

DEFPROC pickRandom()
  ; default seed is 1 - to change this we need to BANK 17 DPOKE %1, %<16-bit> - but only during start game
  %r=% BANK 17 USR 0
  BANK 17 DPOKE %1,%r
ENDPROC =%r&3

DATA 1,1,0,120,31,121,31,168,71,120,31,169,79,168,71,201: ; length: 16

The code above lets me generate a random number from 0-3. Bit overkill, but works nicely.

Then right on cue, Paulo Silva released an input driver which simplifies reading from joystick and keyboard and separately I can use the mouse driver as a third input option. Took me about 10 minutes to have all those input methods available and suddenly some of the core requirements (being able to move around) are solved and I can focus on the problem solving.

Get Marbles Squared (ZX Spectrum Next)

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.