# Suggested 2D Game Engine (not graphics libraries)

## Recommended Posts

Before you post a comment saying I am being stupid and that there are many of these posts out there, I want to say what I am looking for. I understand there are plenty of threads out there, but what I been noticing are people suggesting SDL, Allegro, LOVE, HGE, and other libraries. I am not looking for a graphics library, I am looking for a list of game engines for a 2d environment. Why look for a pre-built engine?     I have been trying to design an engine or program a game and develop the engine as needed, but I am having issues creating a proper design for the engine (events, game states, logic/rendering isolation). I am just going to poke my nose out there and see if anyone suggests one before I go blurting the 101 questions on the best structure of the 'engine'. What am I looking for?     I am looking for something where I can focus on the logic of the game, rather than the back-end structure. The idea was to do proper isolation of systems (rendering, logic, physics), and only plug my objects in, and assign them the sprites necessary, where each sprite would be assigned a SpriteDef which defines the sprite. It is a bit more complicated than that, but does sound ideal. Here is a link to the mind42 diagram of what I have been considering: What I am not looking for?     I am not looking for an input/graphics library. When I was searching around here, I been noticing a lot of people suggesting SDL, Allegro, LOVE, HGE, etc, which are NOT game engines, but a event/graphics platform in development aid for such engine/game. --- I have tried to code my own, over and over, and I understand it isn't an easy thing to do. That is why I have nothing to show of now. I do want to make even small games, but I can't stand simple 'trash code'. Majority of open-source projects I have downloaded are hard-coded, and although it may work for them, for me it feels uncomfortable. I even made a simple click the box to get points game, and I ran into an issue with logic where game-states would have prevented such issues. Sounds silly, but when I ran into that issue, I felt my code to be very... dirty. Thanks. :)

##### Share on other sites
The closest thing I can think of to what you're describing would be something like Game Maker or Unity, either of which could be used to develop a 2-d game, I think. (Unity is a 3-d engine, but I imagine you could create a 2-d game with it.)

Have you looked at either of these? If so, does either seem like it might meet your needs?

##### Share on other sites
I have played with Game Maker, and actually many many years ago I used to be fluent in it. That being all drag-and-drop was amusing but I separated from it. Unity is questionable with the whole 3D part of it (though I notice there are 2D tutorial but still utilizes 3D aspects).

At the moment I am playing with Torque2D, but it seems very commercialized. All in all I believe I am being too specific. I mean, I wanted something robust, just a library which supports my needs, not a whole development platform (though maybe I need to learn to use something along those lines instead). An environment where I can code it to say object x is at point p with a sprite of s currently playing an infinite flip-flop animation. Well that was the ideal idea anyway.

Right now I want to make one of those side-scrolling helicopter games. The one were you go through a tunnel. The idea was to have better physics on the helicopter, have enemies, physics on stuff on the ground (boxes being push around), particle effects for fires. Basically a populated cave with items which can be blown up, etc, while firing at enemies. Thought it would be pretty cool. The one point I haven't determined was the map, though once I added the idea of having items and such a stored map sound more appropriate, rather than a procedurally generated one.... So basically something so I can make that. Lol.

The idea was to code my own engine, using SDL for events/opengl context, OpenGL for rendering, Box2D for physics. The issue was just putting it together in a nice fashion, than thought maybe I could find an alternate source rather than coding my own. :x

I have been coding in C++ for years, and Python for a year or so. I figure I know enough, it is just getting my mind past the whole design phase, which honestly makes me want to not to be interested. :x

##### Share on other sites
Quote:
 Original post by DarkInsanePyroI wanted something robust, just a library which supports my needs, not a whole development platform (though maybe I need to learn to use something along those lines instead). An environment where I can code it to say object x is at point p with a sprite of s currently playing an infinite flip-flop animation.I have been coding in C++ for years, and Python for a year or so.
have you considered pyglet, or pygame?

Both sound like a fairly close fit for your stated needs.

##### Share on other sites
Quote:
Original post by swiftcoder
Quote:
 Original post by DarkInsanePyroI wanted something robust, just a library which supports my needs, not a whole development platform (though maybe I need to learn to use something along those lines instead). An environment where I can code it to say object x is at point p with a sprite of s currently playing an infinite flip-flop animation.I have been coding in C++ for years, and Python for a year or so.
have you considered pyglet, or pygame?

Both sound like a fairly close fit for your stated needs.

I have messed with pygame, but at the same time it isn't properly designed for my needs, or even it is SDL with a couple is cheesy classes to 'help'. If I were to go even that route it would be the same, where I could still have to code the majority of the engine. Am I trying too hard to keep an organized project? I know the KISS format but I despise it now, after trying it myself.

##### Share on other sites
I know you said in the first post that the LOVE2D engine isn't what you are looking for, but it seems perfect for the type of game that you are making.

Its really a full game engine, not just a framework, with integrated Box2D physics and Lua scripting.

By default, It doesn't have an entity structure, but you can easily implement one with MiddleClass

##### Share on other sites
Alright well I suppose I might have only inquired about love because I don't remember attempting to use it. It does look interesting, though I will have to refresh myself with Lua scripting.

I suppose this means there really isn't anything that I need to the extent that I desire. Well that is okay. Though I still have the original issues then, the design of the code in a way which makes sense.

Well I will check LOVE out, though not completely sure. It basically is the same situation as all other cases (C++ with SDL, OpenGL, Box2D), just a few things I won't need to develop.

##### Share on other sites
Quote:
 Original post by DarkInsanePyroIt basically is the same situation as all other cases (C++ with SDL, OpenGL, Box2D), just a few things I won't need to develop.
To some extent, any engine/framework is just going to be "x, y & z that I don't have to write myself".

If your goal is to produce a finished game, I would recommend doing your damnedest to maximise the number and quality of those things - writing from scratch is not a good way to get things done [smile]

##### Share on other sites
Yes and that is what I am trying to accomplish here. But what would the advantage of using LOVE be, besides a (very) few extra features rather than using SDL/OpenGL/Box2D which I can setup in a mere 10 minutes? I would also have to become familiar with the language, where C++ I am completely fluent. You are right, find something where the most will already be covered so I don't have to do it, but I don't see that here. I am all open to doing so when I am given the sense of advantage, which right now I can see it is because of the lack of compilation, which is nice.

And should I be trying so hard to isolate each system (logic, physics, and rendering) or can they clash when the objective is to complete a project? :)

Really it sounds like I am trying to get a daily planner from you, but honestly, out of the years I have been programming I have outputted 0 programs (0 games, 0 apps), and it is annoying. :P Just looking for a new path to follow in hope to actually DO something. Lol.

PS: Seems LOVE has changed a bit and there are a lack of examples, though I haven't looked everywhere yet (about to look through forums)..

Edit: I am trying to get a hang of Lua, but it is weird! And no structures, just a bunch of tables pretending to be structures... gah! Lol.

[Edited by - DarkInsanePyro on February 17, 2010 10:14:18 PM]

##### Share on other sites
Quote:
 Original post by DarkInsanePyroEdit: I am trying to get a hang of Lua, but it is weird! And no structures, just a bunch of tables pretending to be structures... gah! Lol.

I think it's a pretty neat language once you get used to it.

Anyway, how about Panda3D? Despite its name, it can be used for 2D games too.

##### Share on other sites
Quote:
 Original post by DarkInsanePyroI do want to make even small games, but I can't stand simple 'trash code'.

"Sorry boss, I know we just invested two weeks into this game (that's a couple thousand dollars), but the code just feels hacky to me now, can we please start over from scratch?"

Trash code that works is better than neat design that doesn't actually do anything. Best practices are good, but if you've never gotten yourself to actually complete something, then you're lacking some vital experience. First get things done, messy as it may be. You'll learn things along the way to get things done in a less messy way - and at some point, perhaps even in a neat and shiny way. But learn to get things done first. That'll give you much better insight into what makes a good design.

You may find this story to be an interesting read. :)

EDIT: What I wanted to say is this: small games don't need full-blown engines and neat designs. Just build what you need. Of course, you should do something that's technically doable for your experience level, so if you've never built an actual game, doing something with physics and shaders and all that all at once is a bit overkill. Gradually build your way up. At some point, things will become natural, because you've done them over and over again and you just know what you should and shouldn't do to make something work.

##### Share on other sites
+1 for pyglet. Pygame just feels unwieldy and bloated. You'll get most of what you need with pyglet, and the capability to go lower level and 3D if you need to.

You really should give it a try if you enjoy programming in python at all.

##### Share on other sites
I am really sorry for the delay in reply, I have been distracted with some new stuff that came in the mail (lol).

Captain P: Well I think this idea of starting with some of an 'engine' type system came from when I was coding even the simplest of games, 'click the bouncing blocks to gain points'. I started to code it "trashy" but after several days of programming, I started to run into logic errors due to the unforeseen structure required by the game, which in this case the primary solution was to use a game-state type design, which would have helped heck of a lot.

AndrewBC: Overall it is another multimedia library, which none of those which I mentioned I hate, and actually even found pygame just fine (though ended up ignoring most of the lib and just used OpenGL bindings). For example, I know I WILL need Game-States no matter what. They are very useful for having multiple parts of a game (menus, ingame, paused, highscore, etc) rather than being hard-coded.

So I believe there isn't too much of an answer though it would have been nice. I know I should be starting simple, but why not just look out there to see if there are tools in which could aid me in development of a game? That was the idea of this thread.

PS: Just woke up, typos expected.

PSS: For example, I just re-coded my Sprite/SpriteDef system in LOVE. What it does is allow you to assign a Sprite 'object' to an Entity, which defines the visual characteristics of that Entity. The Sprite object contains information such as frame, scale, etc, but it also takes a object of SpriteDef which defines the sprite, such as where it is located in which texture, and how large the tile is in the texture, or where the origin is. All I have to do to render a animated sprite is do mySprite = CreateSprite(myAnimatedSpriteDef) and every update call mySprite:Update(dt) and it will advance the animation frames if necessary. That way if two objects are similar visually, they will share a similar data source (SpriteDef) but hold their own Sprite which just holds anim info.

It isn't complicated, but it is very useful... i've seen situations where the same sprite image was loaded from memory every time an entity is created, how can someone code something like that? x_x

... I think GameDev needs to add Lua as a source language... >_>
require("engine.lua")-- This would be in a datafile/(or in this case just another .lua file)-- ImageManager call will be changed, no need to do LOAD_IF_MISSING in this steptestPieceDef = DeepCopy(SpriteDef)testPieceDef.width = 64testPieceDef.height = 64testPieceDef.frames = 2testPieceDef.texture_info.image_name = ImageManager:CheckImage("MasterSheet", ImageManager.LOAD_IF_MISSING, "data/SpriteSheet.png")testPieceDef.texture_info.x = 0testPieceDef.texture_info.y = 0testPieceDef.texture_info.width = 128testPieceDef.texture_info.height = 128testPieceDef.texture_info.direction = SpriteDef.HORIZONTALtestPieceDef:BuildQuad(0)function love.load()	-- Configure Graphics	love.graphics.setBackgroundColor(255, 255, 255, 0)	-- Create Test Sprite	mySprite = CreateSprite(testPieceDef)	mySprite:SetAnimation(Sprite.ANIM_LOOP, Sprite.ANIM_FORWARD, 1.0)	-- 1 Frame-Per-Secondendfunction love.update(dt)	mySprite:Update(dt)endfunction love.draw()	-- DrawSprite(<Sprite>, <X>, <Y>, <Rotation>)	DrawSprite(mySprite, 0, 0, 0);end

[Edited by - DarkInsanePyro on February 23, 2010 9:43:02 AM]

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• ### Forum Statistics

• Total Topics
628277
• Total Posts
2981779

• 10
• 11
• 17
• 11
• 9