The Chaos Project (working title)

Posted by Powerful Kyurem on Dec. 28, 2013, 1:13 a.m.

So, for the past few days, I have been attempting to literally create chaos in Game Maker.

So what is chaos exactly?

Well, it is a program with one object that randomizes a string and then, if it is valid, executes it.

Sounds simple right? Why do it?

Well, it isn't simple, first of all. There are over 1,000,000 possible permutations, and over half of them are invalid!

So why do this? Well, because it is interesting. What would happen in a chaotic state. There is essentially an equal chance for anything to occur (assuming GM can do it). What would happen? It might make an awesome video game level, AI, weird visual effects, nothing, or (if you ran it in GM Pro that allows external file editing) a virus. The results are limitless.

Currently the 'debugger' uses me to check it. I simply click yes or no on whether it is valid, and it records my answer (granted it resets every time I run it).

I have recently considered having two types of random generated code to limit wasteful combinations:

1. Creating another object.

2. Setting another object's event code to a ligit GML String.

This would limit combinations that do nothing, and would probably increase the amount of chaos in the simulation.

Comments

Iasper 10 years, 11 months ago

This idea doesn't exactly sound useful to me but anyway, why check for each possibility manually? There is an infinite amount of possibilities so you'll never be able to validate them all. Why not simply hide errors, execute the string and check if an error has occurred in your code?

panzercretin 10 years, 11 months ago

Actually, this is pretty interesting. Find a way to control this and you could use this to make randomly-generated enemy AI, for example. Now that would be neat.

Toast 10 years, 11 months ago

Quote:
Find a way to control this and you could use this to make randomly-generated enemy AI, for example. Now that would be neat.
It's called machine learning

Quote:
The Chaos Project
This is so dumb I don't even know what it's called.

spike1 10 years, 11 months ago

What would be cool is if you could couple this with a target that the code should reach, that way when I'm feeling lazy I can just give it a start and end result(Passing in the parameters it can change), and then it would come out with the code after half a day :D.

panzercretin 10 years, 11 months ago

Quote:
It's called machine learning

any examples of that in gaming? I'd love to see two AI have evolving behavior patterns in some evolutionary gladiatorial combat thing.

Iasper 10 years, 11 months ago

CleverBot could be given as an example of machine learning although it's probably not what you're looking for. Besides that, I believe this thing he's writing is just making a string with random characters before trying to parse it which is not exactly considere useful nor efficient.

Cesque 10 years, 11 months ago

This is somewhat relevant. NIGHTMARE FUEL WARNING!

Quote:
It's called machine learning

Come to think of it, I never tried to see what happens when you generate code using Markov chains (other than bugging out due to dangling brackets, but that's solvable). Hmm…

Edit: Also, I assume what INH talks about should be more like a genetic algorithm.

Quote:
any examples of that in gaming? I'd love to see two AI have evolving behavior patterns in some evolutionary gladiatorial combat thing.

There are games where the enemies "adapt" (Jabberwock even made one… it was called Dogfighter IIRC), but I'm not sure if any games use genuine machine learning (using known situations to handle new situations). Then again, I haven't been keeping track.

The problem with machine learning is that it needs data to be trained on, which isn't very efficient in a real-time environment. I suppose some bots may work this way though (analyze player strategies and learn "correct" ones - hey, if it works with chess…).

Quote:
There are over 1,000,000 possible permeantations, and over half of them are invalid!

"Over half" is technically correct, because 99% (rounded down) is indeed larger than 50%, but you still fail statistics and large-scale probabilistic thinking forever.

To give you an idea, an average word in English is 5 letters long. Keep refreshing this page (randomised 5-letter string combinations) and let me know when you find an actual English word.

Now consider the fact that (using an online scrabble dictionary as a reference) the number of 5-letter words in English exceeds 80,000. I don't have the time to count, but I assume the number of executable GM commands doesn't exceed a hundred. And remember, we're talking about strings of length 5 in this example.

The number of possible 5-letter permutations of the 26 letters used for English is 11,881,376. So - unless I messed something up, and I often do - the probability of randomly generating an English word (including inflected forms, like plurals) by banging 5 letters together is 0.67%.

For 6-letter words, you get 308,915,776 permutations. An increase in string length by a single character increases the number of permutations 26 times (plus the sum of all previous calculated lengths if you intend strings to have variable size). How long did you intend your strings to be, again?

There's a reason random generation algorithms usually involve conditional probabilities.

panzercretin 10 years, 11 months ago

I was personally imagining it'd generate by the function rather than by the letter, throwing in conditionals and variables in-between. As in, rather than getting the equivalent of bashing on the keyboard for a few hundred million years, you'd instead piece together individual entries of the library with random yet valid arguments et cetera. An analogy - instead of randomly generating a novel character-by-character, you'd give the computer a sense of sentence structure and make it generate word-by-word from a predetermined dictionary.

Granted, n-1 times out of n, you'd get something banal like:

repeat(alarm5)
{
draw_line(x,39,score,get_hue(879,sin(health-5))^3)
with rjkhretr
{
motion_set(45645.3453,get_distance(345,993,mouse_y,4546*4556-455*6/5))
score-=3
}
show_message("uweifhkjergnsbruisgontrhsb"+(lives+vergrtttr.x-instance_count+390458394805))
}

But still, it's a start.

Cesque 10 years, 11 months ago

Quote:
As an analogy - instead of randomly generating a novel character-by-character, you'd give the computer a sense of sentence structure and make it generate word-by-word from a predetermined dictionary.

This would end up either very restricted (programming mad libs) or generate unparsable nonsense. It's still more sensible, obviously. But hey, he (she?) said string.

Edit: Oh yeah, you're basically talking of a programming equivalent of a context-free grammar. It could apply its nonsense functions recursively for even more fascinating infinite loops!

Edit 2: Goddammit, me too.

Edit 3: Goddammit, I'm replying to future posts by panzercretin.

panzercretin 10 years, 11 months ago

If anyone had the balls to make it, I'd love to download an .exe that just produced a bunch of unparsable nonsense jargon, especially if it had a tendency for the occasional draw function. Something tells me that would be hilarious to watch. Just boot it up, press space whenever you wanted new jargon, sit back and watch the garbage parade.

Come to think of it, if anyone does end up making it, Garbage Parade would be a really cool name - especially compared to Chaos Project.

edit: godammit i'm supposed to be taking a break from this place