推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Hawstein
V2EX  ›  Python

Python写的Minecraft游戏

  •  
  •   Hawstein ·
    Hawstein · Apr 1, 2013 · 8675 views
    This topic created in 4790 days ago, the information mentioned may be changed or developed.
    Writing programs in Python is fun.
    Writing games is fun.
    Writing games in Python is fun!
    ——引自一篇Pyglet教程

    最近在看Pyglet,然后在github上看到有人用Python和Pyglet写了个简单的Minecraft游戏, fork过来, 一共只有几百行代码,麻雀虽小,五脏俱全,觉得挺有意思的, 于是把源码读了一遍,并做了详细的注释。 通过这个例子学习Pyglet和Python游戏编程还是不错的,推荐。

    地址:
    https://github.com/Hawstein/PyMinecraft
    18 replies    1970-01-01 08:00:00 +08:00
    wenLiangcan
        1
    wenLiangcan  
       Apr 1, 2013
    有意思
    wissen
        2
    wissen  
       Apr 1, 2013
    尽管使用了楼主提供的方法,但在 MacBook Pro 上还是无法运行。
    nichan
        3
    nichan  
       Apr 1, 2013
    不知道用python写的话性能怎么样,被原版的java弄的欲仙欲死……
    Hawstein
        4
    Hawstein  
    OP
       Apr 1, 2013   ❤️ 1
    @wissen 我用的是Linux,不知MacBook报的什么错?
    wenLiangcan
        5
    wenLiangcan  
       Apr 1, 2013
    那个,请问是不是不支持Windows?( ̄_ ̄|||)
    Hawstein
        6
    Hawstein  
    OP
       Apr 1, 2013
    @nichan 目前只是单机版,性能的话没做过测试。用python写游戏是OK的,一款web game在人数没有达到一定数量前,性能都不是主要问题,我觉得。
    ihao
        7
    ihao  
       Apr 1, 2013
    @wissen
    不知道是不是报的Quicktime包的错误。查了下是因为默认运行了64位的python的原因。
    见:http://code.google.com/p/pyglet/issues/detail?id=438

    在air上跑了下,amazing。。
    ihao
        8
    ihao  
       Apr 1, 2013   ❤️ 1
    export VERSIONER_PYTHON_PREFER_32_BIT=yes
    之后
    arch -i386 python main.py
    能在os10.8.2 python2.7.2 pyglet1.1.4下跑起来
    Hawstein
        9
    Hawstein  
    OP
       Apr 2, 2013
    @wenLiangcan 你是不是用的64位的windows?在windows和mac下,pyglet还不支持64 python,所以你把python版本换成32位的应该就没问题的了。
    thedevil5032
        10
    thedevil5032  
       Apr 2, 2013 via iPad
    爬出墙外居然可以跳下去...
    Hawstein
        11
    Hawstein  
    OP
       Apr 2, 2013
    @thedevil5032 哈哈。。。还有很多地方要完善。XD
    wenLiangcan
        12
    wenLiangcan  
       Apr 2, 2013
    @Hawstein 嗯,我的是64位,原来是这个原因啊。。。
    run2
        13
    run2  
       Apr 2, 2013   ❤️ 1
    原repo里有这个提示

    Or, try Pyglet 1.2 which supports 64-bit mode.

    pip install https://pyglet.googlecode.com/files/pyglet-1.2alpha1.tar.gz

    @wenLiangcan
    jsz
        14
    jsz  
       Apr 2, 2013
    不错
    wenLiangcan
        15
    wenLiangcan  
       Apr 2, 2013
    @sobigfish 谢谢,这个方法有效
    zhujinliang
        16
    zhujinliang  
       Apr 3, 2013
    求有没有Javascript写的,或者有没有人想开发一个?使用浏览器,web3d,websocket,服务器端用nodejs。
    sunner
        17
    sunner  
       Apr 3, 2013
    D:\Python27\lib\site-packages\pyglet\window\win32\__init__.py:552: UserWarning:
    unsupported extension.
    warnings.warn('Could not set vsync; unsupported extension.')
    Hawstein
        18
    Hawstein  
    OP
       Apr 3, 2013   ❤️ 1
    @zhujinliang 已经有人做了:http://voxeljs.com/
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5518 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 07:42 · PVG 15:42 · LAX 00:42 · JFK 03:42
    ♥ Do have faith in what you're doing.