Sunday, 8 February 2015

SLOG #3: Thoughts about Random

Hey all, back for round three. Nothing especially groudbreaking this week, and a course test that took place a few days ago went along without a hitch for most everyone I've heard.

I have been thinking back to assignment 1 lately, but more specifically the generating random numbers element of the code. For example lets look at this:

>>> game_range = 10
>>> x = int(random.uniform(1, game_range + 1))
>>> x
9

Generating random numbers is an essential computer task, especially for cRPG's and other chance based games, but how does it work in regards to computers? From my basic knowledge of how computer's work deep deep deep down, how does one generate a completely random number?

Apparently they didn't use to. In my curiousity about the history of video games I've learned a tiny bit (no pun intended) about the way older computers worked. The interest in "random"-ness began by watching the video form of a thesis written by a certain Dr. Tom Murphy. He'd written a program, a very simple one, that played Nintendo Entertainment System games. No specific parameters for each game either. It was universal and, in this day and age, not too taxing of a program to run, all based around the potential increase in numbers always going on inside the NES.

Video version of Dr. Murphy's explaination available here: https://www.youtube.com/watch?v=xOCurBYI_gY
The actual paper: http://www.cs.cmu.edu/~tom7/mario/mario.pdf


In one of the uploaded videos of the program in action, it remarkably manipulated games with "random" power-up drops via button presses to make sure the power-up that gave the program the most points was always dropped by certain enemies. Always! The program was able to do this because one of its functions was simulating the future effect of a potential button presses or movements for each and every frame of the game. This doesn't explain how it managed to get the exact power up it wanted every time from a supposedly "random" drop though!

Turns out, to simulate "randomness" the NES actually takes things like player input and button presses into the equation. The users, playing away on the NES controllers, were providing some of the "randomness" for many of these games! To makes sure 1 of 6 power-ups dropped each time though, you'd have to be a computer program like Dr. Murphy's. I found this mind blowing.

I guess I just wanted to share how cool I found that video and computing idea. Still working out how exactly we accomplish "random" in computer and games nowadays though, but cheers and hope I find out in the future!
ES


No comments:

Post a Comment