Ask HN: Building a game for AI Research
31–38 of 38 posts
Re: Ask HN: Building a game for AI Research
#32>"I tried reading TF/PyTorch docs but couldn't find a guide on how to make my game a friendly environment" Are you aware of 'Elf' and 'TorchCraft' by Facebook (creators of Pytorch)? From https://facebook.ai/developers/tools/elf : "ELF provides an end-to-end solution for game research. It includes miniature real-time strategy game environments, concurrent simulation, distributed training over thousands of machines, in…
I started exploring this after seeing TorchCraft on HN yesterday (https://news.ycombinator.com/item?id=16979136) and I worked on a BWAPI AI back in college myself (2009).
I took a look at ELF hoping it was a library or module I could integrate into my project to make it applicable with PyTorch, but it was its own gym complete with full game examples.
Re: Ask HN: Building a game for AI Research
#33-complete game state should be compactly represented, ultimately it will need to be in a form that can be inputted to an NN - player actions should be enumerable (if there are discrete actions) - score is reward, it should be easy to access directly - game will be much easier to learn of there are shorter goals with more score feedback. long puzzles with very sparse reward is still challenging for RL
While I'm sure I miss some knowledge on optimizing the design, what I'm more interested in learning about are pointers to technical frameworks/API implementation details needed to be friendly to tools like TF/PyTorch for developers to train with the game.
Re: Ask HN: Building a game for AI Research
#34If you're using Unity, I would recommend that you check out Unity Machine-Learning Agents! https://github.com/Unity-Technologies/ml-agents It makes it really easy to make games for reinforcement learning. I worked on it a bit over summer, so if you have any questions, feel free to reach out to me.
And here I was thinking I would need to write a native dll wrapper or wait till my next game project to include necessary bits from the outside.
Re: Ask HN: Building a game for AI Research
#35By fun coincidence one of my personal projects has been the opposite; trying to build AIs that can experiment with generalized games. The needs of a project like mine are going to deviate from other suggestions on here because I'm explicitly not working with neural networks or genetic algorithms. The lists other people have put up (esp nrmm) are really good for those, which is not to say mine won't have any overlap.…
What I'm trying to gain more information on though right now are the technical details on how to go about modifying an existing game project to provide this, without building a game from scratch entirely inside of a proprietary AI game-gym framework.
A note on recordable output: It actually runs slower than playing a game because usually you have to do video encoding and file io in realtime which is slower than the RAM -> graphics card -> display pipe.
Re: Ask HN: Building a game for AI Research
#36Something perfect here is OpenAI's Universe [1] enabling you to strap on a uniform AI interface to your project. Here [2] is there systems page for further information/support. [1] https://github.com/openai/universe [2] https://openai.com/systems/
Re: Ask HN: Building a game for AI Research
#37-complete game state should be compactly represented, ultimately it will need to be in a form that can be inputted to an NN - player actions should be enumerable (if there are discrete actions) - score is reward, it should be easy to access directly - game will be much easier to learn of there are shorter goals with more score feedback. long puzzles with very sparse reward is still challenging for RL
Funnily enough, our game has these properties as part of its core game design, independent of the AI-friendly aspirations. It's a puzzle-based anti-grav racing game where you try to complete N laps in the fastest time possible. When I was playtesting it I realized "huh there are only 2 buttons involved, the game state exists as a 2D bitmap + a few vectors we can serialize to disk, there are predefined deterministic v…
I found if you structure the human controller in the exact same way as the AI controllers, you can swap them easily. So I have Agent (abstract), HumanAgent (takes keyboard input), and DqnAgent (DQN learning agent) as the different controllers, the rest of the code is agnostic to the controller. With this setup you can also do things like record your own gameplay.
If your goal is running the track in minimal time, you could reward it at the end (reward = -1* elapsed_time), or as you go (reward=current_speed), or once each lap, etc. These sound similar but may have different training properties. So maybe plan to explore your reward shaping space a bit.
Re: Ask HN: Building a game for AI Research
#38From my viewpoint, as both a researcher and someone who has built frameworks around environments/games: - Each step within the game has to be extremely fast. I.e the game should be able to be run as fast as the machine allows while keeping physics etc. consistent. - Runnable via library import such that there is no drawing to the screen. - Should be easy to reset the environment to an initial state. - RNG state shoul…
> - Configurable screen resolution would be great (eg. output 120x100)
I think both of these things assume you are going to be doing RL from pixels. I think to support a wider variety of RL/control research, you should be able to get the game state in a structured form and not just a flat vector the way gym does it.
But even then, that's still just one branch of AI research. I've seen people optimize how games behave to optimize engagement with the game, and in that setting just controlling the player is not enough. The work I saw looked at controlling level progression to increase engagement, but you could imagine controlling other bits of the game, particularly relevant if your game is not symmetric and the metric you care about is not just making the best AI.
Maybe not AI, but people also do research on how to replace components of games with ML components and the results can be pretty cool, e.g. https://www.youtube.com/watch?v=Ul0Gilv5wvY
Which is just to say that there is not one size fits all approach here.