Randomness in games

Discussion, Reviews & High-scores

Moderator: Moderators

User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Randomness in games

Post by Jeff-20 »

Should games have random values and to what degree?

I've been playing Super Mario Bros. The entire game is pretty much scripted. The enemies and obstacles are entirely predictable. I feel like this gives the designer complete control over the experience.

Games, like my own Forest Glider, use random values to keep the experience "fresh" but suffer from slightly unpredictable behavior.

I had always felt it was a matter of balance, but now I am starting to think there should be no elements outside of the designer's and player's control. What do you think?
High Scores, Links, and Jeff's Basic Games page.
User avatar
tokra
Vic 20 Scientist
Posts: 1124
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Post by tokra »

Good question! Personally I prefer games that I can master by learning (like Mario and Doom), when a game has random elements it can easily become unfair or annoying even when you have to wait for a random thing to happen before you can finish the game.

On the other side games like "Poker" REQUIRE an element of chance to make them interesting.
User avatar
darkatx
Vic 20 Afficionado
Posts: 473
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Post by darkatx »

tokra wrote:...On the other side games like "Poker" REQUIRE an element of chance to make them interesting.
...especially, when the opponent loses all their clothes! ;)
Learning all the time... :)
rhurst
Omega Star Commander
Posts: 1371
Joined: Thu Jan 31, 2008 2:12 pm
Website: https://robert.hurst-ri.us
Location: Providence, RI
Occupation: Tech & Innovation

Post by rhurst »

I prefer a little bit of both, something akin to a gourmet mixture.

I love gaming rules enforcing the "boundaries", allowing for that predictability to make for expertise. But, I find there's nothing wrong with entertaining the player by breaking out from the "logic" with a little randomness (and does not necessarily have to come from a die roll either):

- why did the red ghost decide to enter the tunnel?
- why did the mother ship appear immediately again after getting shot?
- why did that ship decide to U-turn now?

One of my favorite "cheap" methods to "do a coin flip" or "in some instances" is to use the jiffy clock and filter off a bit (or bits) to determine if we hit that time to do something "else".

Another "rule" I like to enforce that's not based on randomness is to "punish the player that exploits an apparent weakness" in any game. I have a laundry list of such, "I know what you're doing outside the spirit of the game, so here's a little something else for you to overcome." :twisted:
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

For some things you may have no choice but to resort to "randomness" to generate data. For example, The Keep has thousands of possible level maps. There's no way that would fit in 3.5k, even if it was just one byte to determine the random seed from which to generate each level.

Games like Doom also rely on randomness for things like scatter for the shotgun and the damage done by each projectile. I was impressed to see though that they tweaked the damage code so that if the player is extremely low on health a bullet is less likely to kill you. There's also some randomness for enemy movement - move in this direction for a random amount of time, then decide randomly whether to zigzag left or right.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

At first I thought using random numbers were more memory efficient, but now I think it might be easier to pull numbers from various sections of ROM. It would be predictable in some ways and probably just as easy as calling RND. Blue Star's maps for example.

Like Super Mario Bros, the players actions alone can alter or change the predictability of the pattern. Omega Race and Fury seem to move in predictable ways with bursts of randomness to enhance the "panic" moments.
High Scores, Links, and Jeff's Basic Games page.
English Invader
Vic 20 Scientist
Posts: 1193
Joined: Tue Apr 28, 2009 3:51 pm

Post by English Invader »

Depends on the game. Platformers in the Super Mario mould (lots of levels and secrets to explore) should be fixed otherwise they'd be impossible, but some arcade games and single screen collect-em-ups like Flicky and Chuckie Egg could benefit from being randomised.

One of the games I've been playing recently is the NES version of Paperboy and one of the key things I've noticed about it is that the houses and obstacles are different each time you play. Most versions of PB are fixed and they're a lot easier as a result.
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Blue Star's maps are all specified platform by platform.
Astro Nell, on the other hand, uses overlaid character definitions. I don't think there's any randomness though.
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

This is how I generate randomness in anything I write that needs it. It uses the lower 8 bits of the 9-bit VIC raster counter at $9003/9004, combined with an accumulating seed value which is an aggregate of a base value (I start with $73, but anything will do) plus whatever value happens to be in successive Zero Page locations on any given call. The seed value has to be a byte in RAM somewhere as it's updated after each call, and the routine itself is self-modifying so that the ZP location increments on each call too.

Code: Select all

;-------------------------------------------------------------------------------
; RANDOMGEN
; Generate a random number from 0-255
; Notes:    Returns value in .A, uses no other registers

randomgen    SUBROUTINE
             lda $0                     ; Get next ZP value
             adc .seed                  ; Add seed value
             adc RASTER                 ; Add current raster count
             sta .seed                  ; Update seed value
             inc randomgen+1            ; Increment ZP address in first instruction
             rts

.seed        DC.B $73                   ; Initial seed value
User avatar
Mayhem
High Bidder
Posts: 3027
Joined: Mon May 24, 2004 7:03 am
Website: http://www.mayhem64.co.uk
Location: London

Re: Randomness in games

Post by Mayhem »

Jeff-20 wrote:I've been playing Super Mario Bros. The entire game is pretty much scripted. The enemies and obstacles are entirely predictable. I feel like this gives the designer complete control over the experience.
Although not quite everything is set... when and how the Hammer Bros jump and switch between platforms is random for example. But I know what you mean, the attack patterns are all set to trigger at always the same points in each level.
Lie with passion and be forever damned...
PhilRanger
Vic 20 Hobbyist
Posts: 143
Joined: Thu Aug 25, 2011 10:04 am

Re: Randomness in games

Post by PhilRanger »

Jeff-20 wrote:I've been playing Super Mario Bros. The entire game is pretty much scripted. The enemies and obstacles are entirely predictable. I feel like this gives the designer complete control over the experience.
I think that non-random is better for long games (it takes hours to go through Mario) while short games are often random. It could be because of lack of memory to implement a long scenario or just laziness. I really like your idea of relying on ROM for this. Better watch out for differences between versions though (PAL vs NTSC, etc.). Is this an issue on the VIC?
Phil Ranger
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
User avatar
Mike
Herr VC
Posts: 4845
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Randomness in games

Post by Mike »

PhilRanger wrote:Better watch out for differences between versions though (PAL vs NTSC, etc.). Is this an issue on the VIC?
The KERNAL ROM is different between PAL and NTSC (VIA Jiffy clock and RS232 register values, and VIC register values), but the BASIC ROM is the same.
PhilRanger
Vic 20 Hobbyist
Posts: 143
Joined: Thu Aug 25, 2011 10:04 am

Post by PhilRanger »

Thanks Mike!
Phil Ranger
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

Coincidentally, I just read about making a random number generator here (low on the page under "3 Randomness"):

http://www.cl.cam.ac.uk/freshers/raspbe ... een02.html
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

We've had several discussion on how the Vic's RND can be a little predictable. For example, if I reset TI$ and the generate a sequence of random numbers, they'll often be the same with each RUN. Most of us are more likely to think of this from the programmer's perspective.

My debate is more about the player's experience. It seems like we, as players, enjoy a bit of memorization and pattern predictability. Look at most side scrolling shooters! They'd probably be awful if completely random.
High Scores, Links, and Jeff's Basic Games page.
Post Reply