-1
我在Action Script 3和C++的某些遊戲引擎中擁有遊戲開發經驗。 但是,我想提高生產力,所以我想用Python,ruby或LUA開發一個新項目。 這是一個好主意嗎?如果是的話,你會建議哪一個?什麼是殺手遊戲開發工具集或引擎?Python,Ruby或LUA中的遊戲開發?
我在Action Script 3和C++的某些遊戲引擎中擁有遊戲開發經驗。 但是,我想提高生產力,所以我想用Python,ruby或LUA開發一個新項目。 這是一個好主意嗎?如果是的話,你會建議哪一個?什麼是殺手遊戲開發工具集或引擎?Python,Ruby或LUA中的遊戲開發?
如果您有什麼不滿,請聯繫Pyglet。
這是一個針對OpenGL的跨平臺Python版本獨立鉤子,具有出色的性能。這有點棘手,但它比Python世界中的其他任何東西都做得更好。
如果你是初學者,我會用Pygame去。
這對系統有點累贅,但是用現代計算機不是問題..另外,它爲遊戲開發提供了預打包的API(因此得名):)
「官方」列表Python的遊戲/圖形引擎: http://wiki.python.org/moin/PythonGames
一些好的:
#!/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()
你必須下載1.2alpha1否則它會抱怨你沒有安裝Python3.X:
Unity對Lua也有一些支持。 – Amicable 2013-04-09 08:07:49