用Python、ruby或LUA进行游戏开发? 我在游戏脚本3和C++的游戏引擎中有游戏开发经验。 但是,我想提高生产率,因此我想用Python、ruby或LUA开发一个新项目。 这是个好主意吗?如果是,你会建议哪一个?什么是杀手级游戏开发工具集或引擎?

用Python、ruby或LUA进行游戏开发? 我在游戏脚本3和C++的游戏引擎中有游戏开发经验。 但是,我想提高生产率,因此我想用Python、ruby或LUA开发一个新项目。 这是个好主意吗?如果是,你会建议哪一个?什么是杀手级游戏开发工具集或引擎?,python,ruby,lua,game-engine,Python,Ruby,Lua,Game Engine,如果你有什么好的,就用它。 它是一个针对OpenGL的跨平台Python版本独立钩子,具有出色的性能。这有点棘手,但它比Python世界中的其他任何东西都做得好 如果你是初学者,我会和你一起去。 这对系统来说有点费劲,但对于现代计算机来说,这不是一个问题。。此外,它还获得了用于游戏开发的预打包API(因此得名):) Python游戏/图形引擎的“官方”列表: 一些好的: 潘达3d 皮格莱特 皮加梅 Blender3D Pyglet代码示例: #/usr/bin/python 导入pygle

如果你有什么好的,就用它。
它是一个针对OpenGL的跨平台Python版本独立钩子,具有出色的性能。这有点棘手,但它比Python世界中的其他任何东西都做得好

如果你是初学者,我会和你一起去。
这对系统来说有点费劲,但对于现代计算机来说,这不是一个问题。。此外,它还获得了用于游戏开发的预打包API(因此得名):)

Python游戏/图形引擎的“官方”列表:

一些好的:

  • 潘达3d
  • 皮格莱特
  • 皮加梅
  • Blender3D
Pyglet代码示例:
#/usr/bin/python
导入pyglet
从时间导入时间,睡眠
类窗口(pyglet.Window.Window):
定义初始化(自我,刷新率):
超级(窗口,自我)。\uuuu初始化(vsync=False)
self.frames=0
self.framerate=pyglet.text.Label(text='Unknown',font\u name='Verdana',font\u size=8,x=10,y=10,color=(255255))
self.last=时间()
self.alive=1
self.refreshrate=刷新速率
self.click=无
self.drag=False
def on_牵引(自):
self.render()
按鼠标上的def键(自身、x、y、按钮、修改器):
self.click=x,y
鼠标拖动时的def(自身、x、y、dx、dy、按钮、修改器):
如果self.click:
self.drag=True
打印“拖动偏移:”,(dx,dy)
鼠标释放时的def(自身、x、y、按钮、修改器):
如果不是self.drag并单击self.click:
打印“您单击此处”,单击“释放点:”,(x,y)
其他:
打印“您从中拖动”,单击“到:”,(x,y)
self.click=无
self.drag=False
def渲染(自):
self.clear()
如果time()-self.last>=1:
self.framerate.text=str(self.frames)
self.frames=0
self.last=时间()
其他:
self.frames+=1
self.framerate.draw()
self.flip()
def on_关闭(自身):
self.alive=0
def运行(自):
在自我活着的时候:
self.render()

#----->注意:Unity也支持Lua。
#!/usr/bin/python
import pyglet
from time import time, sleep

class Window(pyglet.window.Window):
    def __init__(self, refreshrate):
        super(Window, self).__init__(vsync = False)
        self.frames = 0
        self.framerate = pyglet.text.Label(text='Unknown', font_name='Verdana', font_size=8, x=10, y=10, color=(255,255,255,255))
        self.last = time()
        self.alive = 1
        self.refreshrate = refreshrate
        self.click = None
        self.drag = False

    def on_draw(self):
        self.render()

    def on_mouse_press(self, x, y, button, modifiers):
        self.click = x,y

    def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
        if self.click:
            self.drag = True
            print 'Drag offset:',(dx,dy)

    def on_mouse_release(self, x, y, button, modifiers):
        if not self.drag and self.click:
            print 'You clicked here', self.click, 'Relese point:',(x,y)
        else:
            print 'You draged from', self.click, 'to:',(x,y)
        self.click = None
        self.drag = False

    def render(self):
        self.clear()
        if time() - self.last >= 1:
            self.framerate.text = str(self.frames)
            self.frames = 0
            self.last = time()
        else:
            self.frames += 1
        self.framerate.draw()
        self.flip()

    def on_close(self):
        self.alive = 0

    def run(self):
        while self.alive:
            self.render()
            # ----> Note: <----
            #  Without self.dispatc_events() the screen will freeze
            #  due to the fact that i don't call pyglet.app.run(),
            #  because i like to have the control when and what locks
            #  the application, since pyglet.app.run() is a locking call.
            event = self.dispatch_events()
            sleep(1.0/self.refreshrate)

win = Window(23) # set the fps
win.run()