I have experience in game development in some game engines in Action Script 3 and C++.
However, I would like to improve the productivity and so I want to develop a new project in Python, ruby or LUA.
Would it be a good idea? If yes, which one would you suggest? and what is the killer game development tool set or engine?
Answer
If you're any good, go with Pyglet.
It's a cross-platform Python version independent hook against OpenGL with outstanding performance. It's a bit tricky but it does the job better than anything else out there in the Python world.
If you're a beginner, i'd go with Pygame.
It's a bit taxing on the system but with a modern computer that isn't a issue.. also, it got pre-packaged API's for game development (hence the name) :)
A "official" list of Python gaming/graphic engines:
http://wiki.python.org/moin/PythonGames
Some good ones:
Panda3D
Pyglet
PyGame
Blender3D
Example Pyglet code:
#!/usr/bin/python
import pyglet
from time import time, sleepclass Window(pyglet.window.Window):def __init__(self, refreshrate):super(Window, self).__init__(vsync = False)self.frames = 0self.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 = 1self.refreshrate = refreshrateself.click = Noneself.drag = Falsedef on_draw(self):self.render()def on_mouse_press(self, x, y, button, modifiers):self.click = x,ydef on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):if self.click:self.drag = Trueprint '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 = Noneself.drag = Falsedef render(self):self.clear()if time() - self.last >= 1:self.framerate.text = str(self.frames)self.frames = 0self.last = time()else:self.frames += 1self.framerate.draw()self.flip()def on_close(self):self.alive = 0def 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()
Note on Pyglet with Python 3.X:
You'll have to download the 1.2alpha1 otherwise it will complain about you not having Python3.X installed :)
I got stuck with this error after running resize function line:
import cv2
import numpy as np
import matplotlib.pyplot as pltnet = cv2.dnn.readNetFromDarknet(yolov3_custom.cfg, yolov3_custom_last.weigh…
• Assume that you have an array (data=[]) containing 500,000 elements and that each element has been assigned a random value between 1 and 10 (random.randint(1,10)) .for i in range (500000):data[i]…
During copy/pasting code I often get null bytes in Python code. Python itself reports general error against module and doesnt specify location of null byte. IDE of my choice like PyCharm, doesnt have c…
Is it possible to split a string and to avoid the quotes(single)? I would like to remove the single quotes from a list(keep the list, strings and floats inside:l=[1,2,3,4.5]desired output:l=[1, 2, 3, …
I have this problem that I have been working on recently and I have kind of reached a dead end as I am not sure why the image saved when re opened it is loaded as black image. I have (original) as my b…
Firstly, sorry if I have used the wrong language to explain what Im operating on, Im pretty new to python and still far from being knowledgeable about it.Im currently trying to do operations on the len…
I am pretty sure that there is a function for this, but I been searching for a while, so decided to simply ask SO instead.I am writing a Python script that parses and analyzes text messages from an inp…
Im performing some data analysis for my own knowledge from nhl spread/betting odds information. Im able to pull some information, but Not the entire data set. I want to pull the list of games and the a…
I am trying to create a h5 file for storing a dataset for training a super resolution GAN. Where each training pair would be a Low resolution and a High resolution image. The dataset will contain the d…
I have following dataframeAnd I want to convert it into the following format:-To do so I have used the following code snippet:-df = pd.wide_to_long(df, stubnames=[manufacturing_unit_,outlet_,inventory,…