Apr. 15th, 2017

mdude: Yellow and green ink blot style image. (Default)
Something I've been playing with is the idea of computer programs which produce other computer programs via probabilistic selection. Basically similar to the idea of Markov chain generated text or procedurally generated images, but with code.

The previous instance I created in SmileBASIC for the 3DS, which was lost when the 3DS broke and I replaced it. For output, I only got it to print numbers, which were calculated by a series of randomly generated math expressions. Constant values were added, and later variables, with a simple naming scheme of [variable type][index number] so as to easily keep track of what variable names were in use by simply counting the number of each variable type created.

To begin with, though, I was testing the control flow system with calls to the RND in place of expressions. Each time a code block deliminator was selected, it would then be decided whether to go one nesting level up or down, based on the length of the program and the current nesting level depth. The type of code block was chosen when starting it, and remembered in a stack for when it was exited. When exiting a nesting layer was chosen when there were none left, the program end was written.

This produced amusing enough results for a while, though now that I'm starting over I think I'll try things a little differently, and as I'm making it a little more complex I figure I'll write down my thoughts somewhere before I go far in it, which is why I'm doing exactly that here. I'm using javascript this time, mostly so I can easily upload it to link to various people I know without them having to get a particular 3DS program to run it. As such, I'll be making some use of objects and whatever other elements of javascript that seem handy.

While I could have done so on the 3DS, I think this time I'll make an effort to focus on graphics, and try imposing a simple control structure to generated programs, working towards something that could possibly make things vaguely game-like with a much higher probability. I'm thinking at the very least setting up distinct input, process and output phases for the main game loop, plus maybe a setup and maybe a menu system. I'd like it to veer a little more towards inscrutable nonsense than not though, so aside from that I don't think I'll be hard-coding anything like lives or objectives, maybe not even a particularly designated object to be a player character.

Might want to limit the number of draw functions their are though, to help give things a more unified graphical style per generated game despite the chaos of it. I do know that I'll want output phase functions to operate on specially designated variables that don't get read outside that phase and are blanked at the start of it, to better separate the processing in it from the actual process phase. A sort of arbitrary designation, but it's something I thinking could be useful in organizing my manually made javascript games, and it just seems like I'd be more interesting in the kind of quirks created by such a system than by one that makes graphics randomly throughout the program.

Profile

mdude: Yellow and green ink blot style image. (Default)
Meticulac

May 2017

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
28 293031   

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 19th, 2017 04:57 pm
Powered by Dreamwidth Studios