PhD student creates AI machine that can write video games

Dec 17, 2012 by Bob Yirka report

(Phys.org)—Micheal Cook, a PhD researcher in the Computational Creativity Group at Imperial College in Britain, along with colleagues, has released a video game that was written in part by an Artificial Intelligence (AI) "machine." The video game, called "A Puzzling Present" is the latest co-developed by an AI machine named Angelina.

Cook et al have been working on ways to program AI machines to write video games and Angelina is the result – a system made up of various code modules that allow for learning to take place. In the case of Angelina, the learning comes about by examining and borrowing code from existing video games and applying them in unique or novel ways to new games that are being developed. At the heart of the new games are properties known as mechanics – code that gives characters special characteristics, such as the ability to fly, bounce or jump when commanded to do so by the human player.

Cook writes on the group's blog that the way to get an AI machine like Angelina to understand its basic task is to start with a baseline. For Angelina, that meat offering a basic video game without any meat to it – a single character for example, that can be moved on screen, a wall that cannot be surmounted and an exit. Angelina is then told that the goal is to find a way to allow the character to get over the wall and then to the exit. "She" then studies code from other video games, looking at how a similar task might have been accomplished in another environment and then applies what she's learned to the new game. Code is then borrowed and used to allow the character to jump high enough to get over the wall and then to make its way to the exit. To create a full , this process is repeated over and over, eventually leading to various levels and roadblocks that provide for fun game playing.

One problem Cook says, is getting Angelina to understand the level of difficulty that she's building into games. To help her learn, the team has added a feature that asks for user feedback regarding difficulty level. That says, Cook, might be the real key to the design of a highly evolved AI game design system.

For those worried that human coders might lose their jobs to AI machines, Cook says that he doesn't see that happening; instead, he says, he envisions a world where programmers use AI machines as expert assistants that help to come up with new ideas and mechanics – with the end result being better games for everyone.

Explore further: Communication-optimal algorithms for contracting distributed tensors

More information: www.gamesbyangelina.org/
ccg.doc.ic.ac.uk/wiki/doku.php?id=michaelcook

Press release: phys.org/wire-news/117287606/a… me-for-christma.html

Related Stories

NPD: US retail video game sales fell in September

Oct 14, 2011

(AP) -- U.S. retail sales of video game hardware, software and accessories dipped 4 percent to $1.13 billion in September, according to market researcher NPD Group. Sales of the games themselves grew somewhat, but this was ...

Recommended for you

Designing exascale computers

Jul 23, 2014

"Imagine a heart surgeon operating to repair a blocked coronary artery. Someday soon, the surgeon might run a detailed computer simulation of blood flowing through the patient's arteries, showing how millions ...

User comments : 23

Adjust slider to filter visible comments by rank

Display comments: newest first

Lurker2358
1 / 5 (9) Dec 17, 2012
This is slightly better than a random level generator and a random ability selector.

There's not a huge amount of intelligence to it, except that every level was in fact winnable. This is doing a little more than random levels. The A.I. is selecting a mechanic based on pre-existing code which will allow the character to get over or around the obstacle.

The mechanics demonstrated here are too powerful. The AI does not entirely understand what it's doing, which is a bit more complicated than merely making a level "possible," but making it entertaining. Some of the levels are absurdly hard, while others can be solved on the first try within about 2 seconds.

I will say this, if we define "intelligence" as solving a problem in the most efficient manner possible, this may actually be a precursor to animal-like or even human-like intelligence, even if it's not smart enough to "invent" new code on it's own, it is smart enough to recognize what an existing "tool" does and use it...
Lurker2358
1 / 5 (9) Dec 17, 2012
And honestly, in many cases humans are not actually "smarter" than that. We learn mostly by trial and error, and of course "teaching" from mentors who themselves learned mostly by trial and error. Much of what we call "intelligence" is actually more or less "accumulated knowledge".

This game is very simple though.

I wonder what his core algorithm could do if it was given other types of problems, such as selecting the best mode of transportation given real world parameters, and such.

Also this game only had "movement" mechanics. Could he program an A.I. which can select "weapon" mechanics to attack or disable enemy characters on the screen in different ways, which would be varying in usefulness on different types of terrain?

Can he make it smart enough to insert "combos": "randomly" insert a flying enemy on a map, and give the player character an ice gun to freeze the enemy so you can jump on it to make a hard jump, like in Metroid?! That would be impressive. This is composition.
mtrc
5 / 5 (8) Dec 17, 2012
Hi, I'm Mike - the PhD student behind ANGELINA.

"The A.I. is selecting a mechanic based on pre-existing code which will allow the character to get over or around the obstacle."

Actually, it's not. The system is looking through the game code of both my platformer game and the Flixel game library, and modifying code segments. After it makes a modification, it then tries to play the game again and measures what's changed as a result of the modification it made. It can deduce whether the change allowed the player to access new regions of the level by doing this, and thereby suggest potential mechanics.
mtrc
5 / 5 (8) Dec 17, 2012
"The AI does not entirely understand what it's doing, which is a bit more complicated than merely making a level "possible," but making it entertaining."

I think it's a bit unfair to say things like this. I'm an avid gamer myself, and I've written critically about games in the past too. I know how simple the things that ANGELINA can produce are - but as a scientist I have to stop, pause and consolidate my work from time to time, so that my peers (and the public) can see what I'm doing and share feedback.

Of course your feedback is useful too, but I'd hate for you to think that I'm kicking back, satisfied. I'm very much not! I'm raring to push on and tackle the next problems - things like 'fun' or 'challenge'. What I've presented here is the most basic the system can be - it finds mechanics that it promises are useful. It doesn't promise anything more. Yet!
mtrc
5 / 5 (8) Dec 17, 2012
As for the algorithm, extensions and so on: the technique is highly flexible, but it needs work to expand the things it can change in the code; to improve its ability to solve levels so it can do it faster and more accurately; and also to broaden the scope beyond platform games. I'm definitely working on it though. If you - or anyone else reading this, thanks PhysOrg for writing the piece! - want to get in touch, I love talking to people - mike@gamesbyangelina.org

Thanks!
DavidW
1.3 / 5 (13) Dec 17, 2012
"in part"

should have been in the title.

As if we are not important enough to get the complete truth upfront.

This is a sickness of mind, as we ARE important because the truth says we are important when the truth says that the most important thing in life is life.

To deny such a truth and then to think and behave that another living being is not important is 100% irrational thoughts caused by choosing a lie over the truth. Thoughts and actions based on lies (in this case ignoring the truthful importance of others) is exactly the same as going down the rabbit hole. While we may read the story and that is real, the content is not real.

We are all important. If the truth is ignored then we have a duty to all life, because all life is important, to stand with the truth first. That is what will do the most good in all things.
antialias_physorg
5 / 5 (4) Dec 17, 2012
It can deduce whether the change allowed the player to access new regions of the level by doing this, and thereby suggest potential mechanics.

So we're dealing with a genetic algorithm approach. Modify-test-evaluate-repeat?

I'd think the crazy difficult part must be to get all the algorithms in the library to have compatible interfaces to allow automatic plug-in compatibility.

Of course your feedback is useful too, but I'd hate for you to think that I'm kicking back, satisfied. I'm very much not!

Well, you gotta stop at some point and type up the thesis.
FrankHerbert
3 / 5 (10) Dec 17, 2012
Mike, thanks for the personal response and good luck on your PhD.

DavidW, go away moron.
Lurker2358
1 / 5 (6) Dec 17, 2012
I'd think the crazy difficult part must be to get all the algorithms in the library to have compatible interfaces to allow automatic plug-in compatibility.


Not necessarily.

Properly organized code in a video game produces a chest full of "mechanics" sorted by abilities, weapons, equipment,whatever. When a new unit is created you just initialize the ability or weapon from the list. It works just like telling someone to check a toolbox for a screwdriver.

Here is an extra layer, where the A.I. is able to figure out which "tool" (it thinks) is best for the job, and even make a few modifications to the tool.

Maybe the maps in the package weren't enough to fully demonstrate the power, because the "X" mechanic in the levels were limited to "unlimited flight," "doubling jump height," and "charged jumping" in the form of the bounce jump. These mechanics are incredibly simple and well within what could be easily achieved with just checking all variable values between 0 and a limit.
Lurker2358
1 / 5 (8) Dec 17, 2012
I've actually seen, and even written, equally advanced scripting in starcraft: broodwar triggers, and in Warcraft 3 custom maps.

"Randomly" or adaptive changing of the value of max jump heights pretty much just requires testing the values over and over again, and taking the first reasonable result that works, and you can do error checking and other code to get rid of unreasonable results.

I don't know if it's re-compiling a new object from scratch, or if it's just changing a limiting value in an existing object, the second is pretty easy to do and I've done similar things myself in Warcraft 3 maps. The first is a little harder to do, and the main reason I never successfully did this is I never had the training or context for it.

I was working on a self-editing PHP script, which would write new functions to itself. The problem I had was a matter of context.

What he's done is take generalized solutions of existing mechanics and the A.I. changes member functions or variable values.
Lurker2358
1.5 / 5 (8) Dec 17, 2012
I could actually do this in the script engine for Warcraft 3 in a custom map, and even though I haven't used that in like 5 years, and it could be done in a couple days work, most of which would be re-training myself in their system...

I made boss enemies who's custom attacks were run-time allocated, with custom handler scripts, because Blizzard's default abilities had none of the mechanics I wanted to work with.

My analogy to this is the "Mime" class character "Gogo" in Final Fantasy 5 and 6. The "Mime" is able to add or remove abilities from it's battle menu through the status screen. The difference I see here is the selection is being made by the A.I. at the time it's creating the levels, or after the human level maker has made the levels, and it's also interpreting the maximum and minimum variable values and similar things, to determine if they need adjusting, by trying them over and over again.

This has already been done by myself and countless hobbyists.
Lurker2358
1.5 / 5 (8) Dec 17, 2012
And no offense dude, but it's been done.

How to do this:

Have any employee at Square-enix modify the "confusion" status code for any of their video games by adding a random number generator to the mechanic's variable values.

Try it over and over again until the best mechanic for the job and the best variable value are selected. Takes a few seconds run time.

Save the name of the mechanic and the variable value. Have another function copy the C family code or the basic code, or just use a binary editor, and modify the variable values or the min/max values there. (easy).

Save a copy of the new "abilities" list.

If you want to get a little advanced you could have mechanics which call other mechanics as functions, but I didn't see anything anywhere near that advanced in the demo.

Random ability swap/modification has existed in Square games for 20 years, it's just never "on" unless the character has confusion or berserk. Adding a random number generator to internal variables is easy.
antialias_physorg
5 / 5 (7) Dec 17, 2012
Not necessarily. Properly organized code in a video game produces a chest full of "mechanics" sorted by abilities, weapons, equipment,whatever.

Please. Write a line of code before stating such nonsense. For components to work with each other you have to define very good interfaces. There can't be any 'whatever' whatsoever in them.

Writing a map or parametrizing a figure is not comparable to actually having something arbitrarily exchange code components in core game mechanics - and still getting something that works. That's pretty far out stuff. And the guy who programmed this for his thesis did a very good job of it.
mtrc
5 / 5 (3) Dec 17, 2012
Hey again 2358!

Your Warcraft 3 stuff sounds really interesting! Have you written about it anywhere? It sounds like the kind of thing the research community would be very interested in.

A few clarifications - there are no premade mechanics in the engine. It's just raw code. There are member fields as you say that govern things like a sprite's position on the screen. ANGELINA uses a programming language feature called Reflection to modify these properties and then simulates the game again to see their effects. This is not picking from a prescribed list, but the way the engine is coded leads it towards some mechanics rather than others - if we replaced the game engine with a different one, no doubt we would find different mechanics!

This is part of scientific research. This is by no means 'finished', but I wanted to share our progress so far (as I have previously - www.gamesbyangeli...mes!)... (continues)
mtrc
5 / 5 (3) Dec 17, 2012
I understand that it can be irritating to be presented with work that seems half-finished or uninteresting. The problem here is that we are trying to get computers to solve problems like game design independently, so the actual game itself is unimpressive - even though it took a lot of work to get it to discover these mechanics in the way it has done. Hopefully you can appreciate that we're working hard to make the technology even better, but I don't want to wait until 2070 to present my work to the public! I want everyone to enjoy what we can produce now, play with it, give feedback (as you're doing, thanks again!) and then we can talk about where we should go next. It's all part of doing science and having public discourse about it! Please do let me know if you've written up any of the Warcraft 3 stuff, and thanks to everyone else for commenting/reading/playing! EDIT - That link above should be: www.gamesbyangelina.org/games - some of our earlier playable work!

antialias_physorg
5 / 5 (2) Dec 18, 2012
I understand that it can be irritating to be presented with work that seems half-finished or uninteresting.

Research doesn't need to look neat. It's what's under the hood that counts.

I'd even argue that any research that looks polished isn't research anymore (at least I haven't come accross any that looked finished in my career).
You publish when you get sigificant results - but that never means you're finished (as if there were ever such a thing in research. Having more ideas than time to implement them is the norm).
scenage
5 / 5 (2) Dec 18, 2012
This is great work mtrc!
I can see huge potential in the work you are completing. I'm hoping one day, we can have the AI engine building new maps within the Valve engine (just as an example). I guess it all depends on what game mechanics libraries you have and whether the engine can adopt new types of game mechanics (like mechanics for a First person shooter compared to a real time strategy game)
DavidW
2.7 / 5 (7) Dec 18, 2012
Mike, thanks for the personal response and good luck on your PhD.
DavidW, go away moron.

Good luck? Then an outright lie?
Science is useless without the truth. Wow, the differences between the intelligent reasoning of people and our outright attempts to dismiss the truth as too complicated or too inconvenient to understand (when the understanding of the truth is simpler) always seems to amaze me.
FrankHerbert, the most important thing in life is life. This is what the truth says. The truth says I am important, not a moron. Calling me a moron is an attempt by you to place yourself above the real truth. That doesn't make you a liar. It just means you lied publicly right after wishing someone good. You are still important because the truth says you are, like everyone, and anything we do that has importance only occurs because the truth says we are important first.
The title is deceptive and attempts to deem others as not important enough for the truth.
FrankHerbert
1 / 5 (6) Dec 18, 2012
You definitely have Asperger's.
DavidW
2 / 5 (4) Dec 18, 2012
mtrc,
I have been coding AI over 10 years. I bridge that gap between the complicated mathematics already created by others and develop code to facilitate real world usage in practical context to solve problems. I have a patent dealing with spatial requirements and have several world firsts writing code that people were begging for. I highly suggest you don't ignore the choice of title and ask that it be corrected because the author's mind is thinking in conflict with the real truth of importance of others, which doesn't change as long as they are alive. The goal is to do the most good. Without proper direction, it matters not what code we write.
Noumenon
3.3 / 5 (12) Dec 18, 2012
W.f.t. are you talking about David? What specifically is wrong with the title here?
neutrino64
1 / 5 (1) Dec 18, 2012
mtrc, thanks so much for responding here. It's really interesting to hear about. Also, you have a fantastic attitude when dealing with criticism from the public. Best of luck to you.
mtrc
1 / 5 (1) Dec 21, 2012
Hey all! Thanks for your very kind replies - please do contact me at mike@gamesbyangelina.org if you ever want a chat.

DavidW - the only reason i haven't replied properly to you is that I'm not sure what you're asking. I didn't write the article so I don't know what title you're referring to. Do write back though and I'll reply if I can!