跟随Deepmind使用AI玩《星际争霸2》

近来人工智能的火爆,deepmind已经开始研究玩《星际争霸2》了,这个游戏比较复杂,是否可以像围棋一样超越人类呢?

要想学习这个,可以到DM的开源网站下载源码:

https://github.com/deepmind/pysc2


我这里介绍一下在win10下怎么安装,在CMD窗口里使用:

pip3 install pysc2

在这之前你应该安装libsdl和pygame。这个安装目录如下:

AppData\Local\Programs\Python\Python36\Lib\site-packages\pysc2

然后就可以到网易上下载《星际争霸2》,这个安装目录如下:

F:\game\StarCraft II\Versions\Base56787


然后再下载地图:

https://github.com/deepmind/pysc2/releases/download/v1.0/mini_games.zip

和到网站

https://github.com/Blizzard/s2client-proto#downloads

里下载相关的地图。


由于在windows上运行,原来的源码有些不能运行,需要作一些修改:

找到文件Python36\Lib\site-packages\pysc2\run_configs\platforms.py, 作如下修改:

class Windows(LocalBase):
  """Run on Windows."""

  def __init__(self):
    super(Windows, self).__init__(
        "F:/game/StarCraft II/"#os.environ.get("SC2PATH", "F:/game/StarCraft II"),
        "Versions/Base56787/",
        "SC2_x64.exe")
然后再修改文件lib.py:

 

  def map_data(self, map_name):
    """Return the map data for a map by name or path."""
    temp_name = map_name.split('\\')
    map_name = '/' + temp_name[0] + '/' + temp_name[1]
    filePath = self.data_dir + 'Maps' + map_name
    print(filePath)
    
    with gfile.Open(filePath, "rb") as f:
    #with gfile.Open(os.path.join(self.data_dir, "Maps", map_name), "rb") as f:
    #with gfile.Open('F:/game/StarCraft II/Maps/DefeatRoaches.SC2Map', "rb") as f:
      return f.read()

 就可以打开地图文件了。

地图解压放在目录:
F:\game\StarCraft II\Versions\Base56787\maps\mini_games


接着在CMD窗口下就可以运行:

python -m pysc2.bin.agent --map Simple64

运行结果如下:



Python游戏开发入门

你也能动手修改C编译器

纸牌游戏开发

http://edu.csdn.net/course/detail/5538 

五子棋游戏开发

http://edu.csdn.net/course/detail/5487
RPG游戏从入门到精通
http://edu.csdn.net/course/detail/5246
WiX安装工具的使用
http://edu.csdn.net/course/detail/5207
俄罗斯方块游戏开发
http://edu.csdn.net/course/detail/5110
boost库入门基础
http://edu.csdn.net/course/detail/5029
Arduino入门基础
http://edu.csdn.net/course/detail/4931
Unity5.x游戏基础入门
http://edu.csdn.net/course/detail/4810
TensorFlow API攻略
http://edu.csdn.net/course/detail/4495
TensorFlow入门基本教程
http://edu.csdn.net/course/detail/4369
C++标准模板库从入门到精通 
http://edu.csdn.net/course/detail/3324
跟老菜鸟学C++
http://edu.csdn.net/course/detail/2901
跟老菜鸟学python
http://edu.csdn.net/course/detail/2592
在VC2015里学会使用tinyxml库
http://edu.csdn.net/course/detail/2590
在Windows下SVN的版本管理与实战 
http://edu.csdn.net/course/detail/2579
Visual Studio 2015开发C++程序的基本使用 
http://edu.csdn.net/course/detail/2570
在VC2015里使用protobuf协议
http://edu.csdn.net/course/detail/2582
在VC2015里学会使用MySQL数据库
http://edu.csdn.net/course/detail/2672



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

caimouse

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值