Jump to content
  • Advertisement
Sign in to follow this  
jwezorek

A Lightweight 2D Game Framework Doesn't Seem To Exist

This topic is 701 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Wanted to throw something out there ... as in does anyone else want this?

 

I've been looking at finishing the M.C.Escher tesselation-like game I was working on a year ago but want to do it for Windows/Steam as well as for iPads because the iPad-only game market just seems bad to me. I have thus been looking at 2D game frameworks for C++ that support at least Windows and iOS. There is surprisingly little that is free: 
 
  1. Cocos2d-x: I used this the last time I wrote a game but it has gotten soooo bloated and soooo poorly documented and just soooo gross
  2. a new one, Oxygine, which looks good but is just by literally one guy and is super-duper immature -- I posted a question in its forums asking for pros/cons of Oxygine vs. cocos2d-x and it took three days to get a superficial response, etc. 
  3. Torque2D: I never used it. Someone at work said "he didn't recommend it" and it does seem super heavyweight and geared toward a workflow in which you make a platformer  using a GUI level editor. My games tend to have weird constraints and don't conform to genres like "platformer" or whatever so I am philosopically opposed.
  4. Marmalade: looks great but is a commercial product if you want to support Windows desktop and has to be ad ware otherwise. Not willing to pay $500 for an indie license for a game that will probably make approximately 0 dollars.
 
Now I am not including SDL, Allegro or SFML in the above because I don't consider them frameworks; I consider them hardware abstraction layers. I might have missed one but there doesn't seem to be something really lightweight and simple that doesn't do much but what it does it does right.
 
I've been thinking of rolling my own which would do the following:
  1. expose a hardware abstrction layer for user input, sound/music, and graphics.
  2. implement a simple sprite hierarchy and expose a stage/scene graph, basically a tree of sprite base class things that get drawn every iteration of the game loop.
  3. expose loading of sprites from sprite sheets w/ batched sprite rendering. 
  4. manage memory via std::shared_ptr<T> et. al. rather than some adhoc leaky looking crap that no one understands like Cocos2d-x.
  5. possibly expose an (optional) actions/transitions mechanism via C++ std::function<T>'s / lambdas.
 
And that is it. Basically slightly higher-level than the level of SDL/Allegro/SFML but lighter than Cocos2d-x and lower level than Torque et. al.
 
I don't want to write the hardware abstraction layer myself though -- I know nothing about sound SDKs and am not an OpenGl master. If I do my ultra lightweight "engine" I am looking at doing it on top of SFML which has experimental ports to iOS. I'd just use SDL 2.0 for hardware abstraction but no subpixel accuracy when placing sprites is a deal breaker for me e.g. my escher game requires placing sprites at floating point locations and letting the graphics card do its thing to look good, tried it with integers coordinates and it was a mess.
 
Anyway, does anyone want this besides me? Curious because if there is interest I could try to set it up like an actual cross-platform framework.
 

Share this post


Link to post
Share on other sites
Advertisement

Yeah, and Oxygine does seem to support what I want except for managing memory via standard library smart pointers. ( I know that cocos2d-x 3.0 didnt manage memory with standard library smart pointers specifically because its main developers were concerned about performance. I argued the other side at the time: basically mobile devices are only going to get faster and they were junking up the codebase for optimizations that don't matter for 99% of 2D games ... but that side lost)

 

Oxygine seems to be a C++ version of an actionscript framework called Starling. It seems to place heavy emphasis on an actions/tweening system which I am predisposed to not like  but will try to use and see what happens. If there is no way to break out of the actions system and just do a normal update/render loop that will be a deal breaker for me.

Edited by jwezorek

Share this post


Link to post
Share on other sites
I'll be honest and say that if I wanted to make a multi-platform 2D game these days I'd just go straight for Unity. C++ for 2D games is a sledgehammer to crack a nut, and as you say yourself, "mobile devices are only going to get faster" and there's no need to worry about "optimizations that don't matter for 99% of 2D games".

Share this post


Link to post
Share on other sites

RE: Unity, maybe you are rigth.

 

For me it's basically just a matter of preference.I write C# all day at work so like to do C++ on the side, but to be honest I don't know a lot about Unity,

 

Is Unity totally free?

Share this post


Link to post
Share on other sites

Unity is free, however the product will contain a "Powered by unity" intro.

 

I'm not really aware of any "lightweight" game frameworks. Usually games aren't that lightweight.

SDL is pretty lightweight to me, blend it with OpenGL and you'll have a nice solution.

 

There are 2D engines that could suit you like GameMaker and Love,

Other engines that you should try are Unity, Unreal and NeoAxis. ("Heavyweight").

Share this post


Link to post
Share on other sites

Cocos2d-x: I used this the last time I wrote a game but it has gotten soooo bloated and soooo poorly documented and just soooo gross

 

Yes Cocos2D-x is bloated, but it has every thing you need to make a good 2D game. My engine of choice when I do 2D.

 

Game maker is the lightest good engine I know.

There are hundreds of smaller free 2D engines, however it means you will need to learn to do some of the more technical stuff yourself as the reason they are simpler is because they don't have every thing needed to make a large scale 2D game.

Share this post


Link to post
Share on other sites

My problem with Cocos2d-x is philoshophical and religious. I don't want to support it again because it makes my eyes bleed.

 

I actually think I'm just going to take Kylotan's advice and try Unity. Basically I never considered Unity because (1) I like C++ and (2) didnt realize Unity was totally free if you make less than $100k. I thought you had to pay $500 for some reason. The nice thing is my prototype is already written to monogame so I'll be able to reuse a lot of that code. I mean, to be honest, I  don't like the the idea of having to have a "powered by Unity" splash screen or whatever but it isnt the end of the world.

Edited by jwezorek

Share this post


Link to post
Share on other sites
I like your idea but i dont like the "managed memory with smart pointers". I mean - do whatever you want to do internally but please let me have just a good old fashioned pointer when i want one.

Though this may cost me some down-votage - I dont care - I think the std smart pointers are way overrated.

I also dont like Unity, it feels less like coding and more like web design or something to me. Yeah, you can definitely make 2d platformer games with it faster than anything else - but there is definitely a crowd of us still in the world who enjoy coding at a lower level.

The question is though, since this would seem to be more of your target audience for such a library, why would we rather use your lib than something like sdl or sfml?

I think the answer to this question is probably why there arent too many options out there.

However, i could definitely see it being useful for us when we are looking to pump out a game very quickly (for a week game contest for example) and dont want to open the Unity box. It better be transparent and well documented though!

Share this post


Link to post
Share on other sites

RE: The question is though, since this would seem to be more of your target audience for such a library, why would we rather use your lib than something like sdl or sfml?

 

I would write my thing on top of SFML if I did it.

 

SDL and SFML are hardware abstraction layers which is one part of what I want. The other part is basically an implementation of sprites:

  • a sprite can be created from a sprite atlas texture or a standlone texture/image
  • it can be displayed or not displayed by inserting or removing it from a hierarchical tree of nodes that the game loop knows about
  • it can contain other sprites as chidlren
  • it has an alpha value, a rotation, a position and a scale
  • its properites are relative to its parent's properties in the sprite tree stage thingy.

SDL/SFML/Allegro do not implement (all of) the above and SDL doesnt support subpixel placement of images without doing it yourself via OpenGL calls. An implementation of the above is a minimal 2D game framework ( along with background images, some kind of game scene or game phase abstraction and hardware abstraction of sound, music, and user input.)

Edited by jwezorek

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!