I'm a somewhat experienced programmer (Junior CS major in college) and when I was younger I used to be EXTREMELY into game development. However, my engine of choice was GameMaker, and as we all know that's a bit limited. After becoming a better programmer, I decided I wanted to come back and make some simple 2D games using a real language. However, I haven't been able to find a good 2D engine that lets me develop in my own environment; almost all of them require me to use their own special scripting language or require me programming most of the engine myself. What I would like in a engine is:
- Programming is done in my own environment (emacs, vim) in an established language (like C++ or Python)
- I can quickly program objects (engine handles things like collision, creation and destruction of objects and scenes, etc)
- I can quickly place objects and design levels (I would really like to be able to use tiled to design my levels)
- It handles input and is easy to integrate in objects
- Built-in collision detection
Bonus points for:
- Physics
- Android/iOS/HTML5 support
The closest I have found to something I would like is melonjs, however I really don't like programming in javascript and it doesn't compile to native code (not that I would expect it to).
In an ideal world, I would like to make a simple pong game with something like this:
import engine
import sprites
import scenes
class PlayerPaddle(engine.GameObject):
sprite = sprites.PaddleSprite
game = 0;
def __init__(self, game):
self.game = game
game.add_object(self, 'PlayerPaddle') # could be handled by parent
self.x = 0
self.y = 0
super(PlayerPaddle, self)
def update(self):
if (self.game.input.keyboard.up):
self.y -= 2
if (self.game.input.keyboard.down):
self.y += 2
super(PlayerPaddle, self)
def draw(self):
engine.draw_sprite(self.x, self.y, self.sprite)
super(PlayerPaddle, self)
class ComputerPaddle(engine.GameObject):
sprite = sprites.PaddleSprite
game = 0
def __init__(self, game):
self.game = game
game.add_object(self, 'ComputerPaddle') # could be handled by parent
self.x = game.current_scene.width-32
self.y = 0
super(ComputerPaddle, self)
def update(self):
if (self.game.objects['ball'][0].y > y)
self.y -= 2
if (self.game.objects['ball'][0].y < y)
self.y += 2
super(ComputerPaddle, self)
def draw(self):
engine.draw_sprite(self.x, self.y, self.sprite)
super(ComputerPaddle, self)
class Ball(engine.GameObject):
sprite = sprites.BallSprite
game = 0
def __init__(self, game):
self.game = game
self.hspeed = 5
self.vspeed = 5
self.x = game.scene.width/2
self.y = game.scene.height/2
game.add_object(self, 'ball') # could be handled by parent
super(Ball, self)
def update(self):
if (engine.collides(self, game.objects['PlayerPaddle'] or
engine.collides(self, game.objects['ComputerPaddle']):
hspeed = -hspeed
if (y < 0 or y > game.current_scene.height):
vspeed = -vspeed
super(Ball, self)
def draw(self):
engine.draw_sprite(self.x, self.y, self.sprite)
super(Ball, self)
game = engine.Game()
game.set_scene( scenes.scenes['pong'] )
while (game.is_running):
game.update()
game.sleep_off_frame()
I REALLY rushed through this so the python is definately wrong (and I'm not spectacular at it), but I think you get the general idea. 90% of the code is defining the behaviour of the objects, and the engine itself handles things like drawing the sprites, view locations, collisions, input, object movement, etc.
What I have tried so far:
- GameMaker
Pros: Easy to get a basic game down, handles resources for me
Cons: I have to program in their limited language, not open source, stores projects in a way that I can only really use gamemaker with it, can't develop on linux - MelonJS
Pros: Does about what I want
Cons: I have to program in javascript which I really don't like, web only - Roll my own with SFML (I am actually decently far into my own game engine, but I want to actually make games now)
Pros: Does exacly what I want
Cons: Extremely hard, buggy, takes forever, I have to write my own algorithms for everything and develop my own tools, unfeasible - Unity
Pros: Established community, good engine, compiles for everything I could want
Cons: Can't develop on linux, basic 2D support, I have to learn how to use the entire program
I know this is a really really common question, but I still haven't found a good engine for what I want, even after reading FAQs, etc. I would really appreciate some help.