Suggested 2D Game Engine (not graphics libraries)

Started by
11 comments, last by DarkInsanePyro 14 years, 1 month ago
Quote:Original post by DarkInsanePyro
I 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.
Create-ivity - a game development blog Mouseover for more information.
Advertisement
+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.
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]

This topic is closed to new replies.

Advertisement