It was not so hard to leave my previous field, which I was bored of, but to get a chance to work on this new field. I got to do this by doing a slow transition, first doing work that was halfway between game development and different areas of AI, and every time pushing forward my objective. It took me a lot of time to do it but now I'm very happy with the results.
If I can give you my advice, investigate the many areas related to programming that exist, investigate what companies that you didn't even know that existed do, and find something that you really wish you could do too. Then start moving in that direction, one step at a time.
I'm not by far as successful in the new field as I was in my previous life. But hey, I'm having a lot of fun. And with time, you get your knowledge and experience back again.