Maidens of the Kaleidoscope

~Hakurei Shrine~ => Rika and Nitori's Garage Experiments => Touhou Projects => Topic started by: Gandalph on April 12, 2010, 04:15:31 AM

Title: Touhou AI
Post by: Gandalph on April 12, 2010, 04:15:31 AM
Well, I'm not sure if this is the right place to put this, but I've conned a professor of mine into letting me make an AI that plays Touhou for a final project in Image Processing. The goal is to make an AI that can at least complete Stage 1 of IN on Normal and does not access the virtual memory space of the game at all. It can only use the screen outputs from the game and a virtual keyboard. So far I've been able to get a simple algorithm working where I find the character's sprite, then the nearest bullet, and move directly away from it, but more work will hopefully produce better results than dying against Wriggle. I hope to record a video for YouTube soon, but I want to get something better working before I do.
Title: Re: Touhou AI
Post by: Drake on April 12, 2010, 04:29:22 AM
So like 3 and 9, but for the main games and separate? Godspeed to you, sir.
Title: Re: Touhou AI
Post by: Dizzy H. "Muffin" Muffin on April 12, 2010, 04:30:52 AM
Whaddaya mean "conned"? This seems like a perfectly legitimate use of your resources to me. ;)

That said, good luck! Hope you get an awesome grade!
Title: Re: Touhou AI
Post by: ChaoStar on April 12, 2010, 04:32:23 AM
Danmaku and school mesh perfectly, don't they? (*does danmaku for school*)

Honestly, I feel this would be a bit easier to do this in danmakufu, because you can have a custom player script that helps you dodge bullets and stuff. Hey, an auto-pilot player would be pretty damn cool...

Ahahah. Anyway, I can't really help you here. I wish you best of luck, though.
Title: Re: Touhou AI
Post by: Blargel on April 12, 2010, 06:29:55 AM
Sounds like an interesting project. Image processing only though? Wow, that'll probably be tough.

Honestly, I feel this would be a bit easier to do this in danmakufu, because you can have a custom player script that helps you dodge bullets and stuff. Hey, an auto-pilot player would be pretty damn cool...
Danmakufu doesn't do image processing... and an auto-pilot player in Danmakufu would be impossible to make (though fucking hilarious) because of the impossibility of detecting non-object shot positions. The best you can do is auto-bombing.
Title: Re: Touhou AI
Post by: Helepolis on April 12, 2010, 06:37:27 AM
Moved thread to Project Section, as it is a mod / tool / dev for the original Touhou games.
Title: Re: Touhou AI
Post by: Dizzy H. "Muffin" Muffin on April 12, 2010, 05:32:02 PM
But still awesome.
Title: Re: Touhou AI
Post by: CK Crash on April 12, 2010, 10:18:55 PM
I would be especially impressed if you could make it stream stuff and figure out when focused/unfocused fire is best. Try and go beyond PoFV's "move away if it's x pixels away" type dodging.
Title: Re: Touhou AI
Post by: Serela on April 12, 2010, 11:18:02 PM
I would be especially impressed if you could make it stream stuff and figure out when focused/unfocused fire is best. Try and go beyond PoFV's "move away if it's x pixels away" type dodging.
Although I must admit, seeing PoFV AI go up against Lunatic and Extra/Phantasm stages would be pretty fun. Maze of Love hurrr

But yeah, I can't wait to see how this goes.
Title: Re: Touhou AI
Post by: Gandalph on April 26, 2010, 08:58:40 PM
OK, it still sucks, but now it can reliably beat Wriggle. I'll make a vidya and upload it to youtube this weekend.
Title: Re: Touhou AI
Post by: チソウ タイゼン on April 27, 2010, 12:51:33 AM
This sounds exciting.. That can be used to create a boss-player swapped version of the Touhou games..
Title: Re: Touhou AI
Post by: Gandalph on May 03, 2010, 03:50:20 AM
Well, if there were to be a boss-player reversed version, it would probably not use an AI based on Image Processing and Computer Vision, those aren't reliable enough... You'd probably just give the AI the locations of all the bullets and the character so that it could do some kind of path planning without having to worry about whether it really saw a bullet or if it was just Yukari's hat.

In any case, I derp'd, and posted the video to youtube, but forgot to link it here. The AI fails pretty badly, but it passes Wriggle. this is not its best run, I probably should have done another run to see if it fared any better the second time around.

http://www.youtube.com/watch?v=4wKmtWpcHnA (http://www.youtube.com/watch?v=4wKmtWpcHnA)
Title: Re: Touhou AI
Post by: Bitz on May 03, 2010, 03:54:35 AM
I like how it bombs every ten seconds. :V
Title: Re: Touhou AI
Post by: Serela on May 03, 2010, 04:43:33 AM
Also, how when it DOES move, half the time it moves right into bullets that weren't going to come near it anyway :V
Title: Re: Touhou AI
Post by: Gandalph on May 03, 2010, 06:06:00 PM
Yeah, it's pretty trashey at the moment. It has no tracking whatsoever. The next step would be to implement some kind of tracking so that it can see where bullets are moving and have some notion of safe and unsafe spots.
Title: Re: Touhou AI
Post by: チソウ タイゼン on May 05, 2010, 01:10:24 AM
Not bad!
You should probably program it to
?See which side of the screen it's on and choose accordingly to avoid entrapment
?Shift out of focus mode to make last ditch dodges
?Move the X values towards that of the enemy highest on a priority heierarchy (sp?)
(IE The closest enemy vs the newest enemy vs the strongest enemy, whichever being the best choice)
?Collect power upgrades
?Forsee laser pointers and wedge self between bullets for maximum graze

But all that sounds so complicated..