Jump to content
  • entries
    38
  • comments
    50
  • views
    37,080

256 x 256 screen maze working.

Sign in to follow this  
Gemintronic

678 views

Had to fight with a weird compiler error. Hopefully the last time I'll see "error: Value in 'cmp #256' must be <$100." Also discovered rand didn't change room types often enough. Seems to work better if I swap bits around in the result. Here's an example of what I'm talkin' about:

 

changeworldx
if worldx = 0 then worldx = 255
rand = worldx
mytemp = rand
room_type{0} = mytemp{4} 
room_type{1} = mytemp{1} 
room_type{2} = mytemp{3} 
room_type{3} = mytemp{5} 
room_type{4} = mytemp{7} 
room_type{5} = mytemp{6} 
room_type{6} = mytemp{2} 
room_type{7} = mytemp{0} 
gosub changeroom bank2
return

Sign in to follow this  


4 Comments


Recommended Comments

A typical LFSR PRNG will go through runs where the numbers are predictable. You could use that to make the a kind of introduction for the first N rooms.

Share this comment


Link to comment

your other option is to use the 16 bit random number routines.

 

batari Basic Commands - rand

The standard random number generator should be random enough for most games. However, if it isn't random enough, you can optionally specify a 16-bit random number generator. This requires that you set aside one variable, and you can't use this variable for other purposes. To use the improved routine, place:

 

dim rand16 = <var>

 

at the beginning of your program. <var> is one of your 26 variables (a-z.) Then you use rand as you normally would.

Share this comment


Link to comment

Thanks for the tips! Er, I'll have to get me some learnin' in order to understand what a LFSR PRNG is much less a typical one. Low fidelity serial register pseudo random number generator? So much to study :)

 

The 16 bit number option sounds good. If the score can be broken down into 8 bit numbers maybe I can likewise split the results of the 16 bit random number. Trouble is I'm putting several 8 bit values into the melting pot. I can hardly cope with the score or back up it's values. 16 bit numbers and Batari are another subject to master!

Share this comment


Link to comment
Guest
Add a comment...

×   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...