[模拟炉石]开坑

国外有很多玩家做的模拟炉石的东西,都非常棒。

浏览了一些项目之后,觉得fireplace这个引擎不错。

使用fireplace来作为游戏的驱动,还需要一个不错的gui才行。我考虑使用网页或者桌面程序。网页的话有很多H5的游戏框架可以用;桌面程序的话python也有很多不错的。

这里我打算使用cocos2d。

使用fireplace+cocos2d制作一个模拟炉石的游戏。因为自己对python 以及 cocos2d不熟,所以进度可能会比较慢。

fireplace 使用了https://github.com/HearthSim/python-hearthstone这个项目提供的卡牌信息。

这个项目代码放到了https://github.com/htwenning/mystone.git这里。

初始环境搭建:

1.fireplace

git clone https://github.com/jleclanche/fireplace

cd fireplace

sudo ./bootstrap

sudo pip install -r requirements.txt

sudo ./setup.py install

装完后,进入fireplace/tests

./full_game.py

看到游戏整个过程就成功了。

2.cocos2d

sudo pip install cocos2d

一个helloworld程序:

import cocos
from cocos.director import director
class HelloWorld(cocos.layer.Layer):
    def __init__(self):
        super(HelloWorld, self).__init__()
        label = cocos.text.Label('hello, world!', font_name = "Times New Roman", font_size = 32, anchor_x ='center', anchor_y = 'center')
        label.position = 320, 240
        self.add(label)

if __name__ == "__main__":
    director.init()
    director.run(cocos.scene.Scene(HelloWorld()))

后面我将在这两个程序的基础上添加更多的东西来实现对炉石的模拟。

具体代码可见https://github.com/htwenning/mystone

原文地址:https://www.cnblogs.com/wenning/p/5068429.html