Jump to content







Photo

256 x 256 screen maze working.

Posted by theloon, 15 August 2010 · 206 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





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.
  • Report
your other option is to use the 16 bit random number routines.

batari Basic Commands - rand

Quote

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.
  • Report
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!
  • Report
  • Report

May 2012

S M T W T F S
  12345
6789101112
13141516171819
2021 22 23242526
2728293031  

Tags

    Categories