Jump to content
  • Advertisement
Sign in to follow this  
Chad Smith

Build a 2D Engine?

This topic is 4663 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

Alright, here is the deal. Me and my team are looking to write a 2D Platform Game. Ok...what a big deal you ask. Well...we are un-sure if we should write our OWN 2D Game Engine for it or now. I know your saying their is a thread basically just like this in the same forum. The thing is though, I actually don't really know what goes into a 2D Engine excatly. The thing is though...I have basically decided it would be good for us to write our own engine. We have the time to do it also. Now the thing is, we would like some links on designing a 2D Engine in C++ using the SDL lib., and the Dev-CPP IDE. So I was wondering if someone could give me some links that would really get us off to a good start so that we could almost know how/what goes into a simple 2D Platform Game Engine. If not, that is ok...atleast you tried! Maybe y'all could also give us some advice on stuff not to do or whatever. Anyhelp is appreciated! Thanks, Chad.

Share this post


Link to post
Share on other sites
Advertisement
I'll try to offer a little help. A 2D engine wouldn't be too hard if it was well planned. I would say opting to use SDL is a good idea if you are going to code the engine in c++. Here is a series of tutorials on making games with SDL. The final tutoral covers making a side scrolling shooter. I think that's one thing you would def. need to know. How to have a scrolling background. Also SDL_mixer could be used to access any sound files you need for your game. So you would want:

* The part about the scrolling background.
* Using SDL_mixer to load and play sounds.
* How to load sprites.
* Handling input and displaying fonts on the screen.

That's what I would go for out of the 6 tutorials found there. With that you can have a pretty basic engine going. You would just have to have a way to load in new levels for your game. Hope that helps and good luck.

Share this post


Link to post
Share on other sites
My personal recommendation is to base your '2D engine' on a 3D API such as Direct3D or OpenGL. Traditional surface-based 2D systems are pretty much a thing of the past, and you will get better performance and far greater flexibility with a 3D API foundation. It opens up all sorts of cool tricks.

With that in mind, the design of your engine (I actually don't like to use that word much, because it has gained such an ambiguous definition) will need to take into account the sorts of things you want to do with it.

Share this post


Link to post
Share on other sites
Ok, thank you.


We think we could build a good 2D Engine, we really just need to know what certain things go into making an engine. I don't want to a tutorial showing you how to make a engine, I just want something that would really exlpain greatly what goes into an engine, and maybe one tutoril or two on getting things implented.


Also...thanks for the tutorials for Cone3D. I have read over those already actually, but we are going to read over lots of tutorials, so that way we know that we know that certain part.




We would base it off a 3D API, but for somereason....we really don't want to. Would we greatly suffer from that in the future?



Chad.

Share this post


Link to post
Share on other sites
Quote:
I just want something that would really exlpain greatly what goes into an engine, and maybe one tutoril or two on getting things implented.


There isn't really a list of features that every engine must have. What you put in it depends upon what you need. If you don't know what you need then write a design document for your game and work it out.

Personally I'd recomend forgetting about the engine and just get on with your game. You want to write a game, not an engine and if you start developing an engine you'll end up spending ages developing something that will probably turn out to be pretty useless when you actually start implementing a game with it. So just start writing the game. You will need to write code that could be considered an engine just don't make that your focus, focus on the game. For your next project you'll be able to reuse code from this project and then again for the next and so on. This code which you keep reusing is as good as an engine, even if you don't explicitly call it as such.

Quote:
We would base it off a 3D API, but for somereason....we really don't want to. Would we greatly suffer from that in the future?


Utilizing graphics hardware by using an API such as OpenGL or DirectX is very useful for 2D games as things such as alpha blending, rotation and scaling are trivial to implement and don't really incur extra performance costs. You'll probably also be able to put a lot more stuff on screen.

Share this post


Link to post
Share on other sites
a 2d engine is indeed quite simple but ike someone said i advise you to use a 3d api such as opengl or directx . . opengl is often said to be the easier of the two

so, for this engine you are basically going to need

a windows window
a 2d surface class
input
sound

then you can build ur objects

sounds simple but i can say that i find it reqlly really hard to do this stuff

Share this post


Link to post
Share on other sites
Original post by Monder
Personally I'd recomend forgetting about the engine and just get on with your game. You want to write a game, not an engine and if you start developing an engine you'll end up spending ages developing something that will probably turn out to be pretty useless when you actually start implementing a game with it. So just start writing the game.quote]

i totally agree with that thought; i know someone who somewhat gave up on writing a game b/c they took the "engine" approach, just get in there and get your hands dirty, build a few games, and when you feel ready, tackle an engine; however, if you REALLY want to build an engine, then, feel free but i for one would wait after you did some other stuff :)

Share this post


Link to post
Share on other sites
An additional point to be made is that unless you've already written some games, you won't really know what an engine needs to do anyway (hence the comment about spending ages on an engine that is actually useless). Jumping in and building some games is almost certainly going to get you where you want to go faster.

Share this post


Link to post
Share on other sites
Hmmmmmmmm. Not too sure if I would completely agree with some of the posts regarding basic design.

Sure...you want to get in there and code your sprites/AI/explosions et all. But if you have the baisc infrastructure (a decent engine) then you'll learn much more about what goes into a game, IMHO that is, and it'll be there forever.

I would suggest taking a look at Superpigs' Enginuity articles on Gamedev and maybe taking some of those ideas..well the basic structure for tasks. Personally I wouldn't implement the memory management but look into boost smart pointers. Superpigs' articles also give a very brief showing of SDL and openGL..which might be of interest and topics like serialisation and triggers. Also some of the C++ design patterns used within the articles are quite illuminating...all in all an excellent set of articles.

I would also suggest looking into event handling for systems intergration. That way each "sub-system" of you game doesn't have to know about another...they just pass event messages to the event manager and bobs your mothers brother!!! By that I mean your rastering system doesn't have any concept of your user input system, messages are passed between them via the event manager...makes things very nice and clean. Personally I am implementing the design from game coding complete (2nd edition).

Anyhow...whichever way you decide to go then I wish you the best of luck.

Share this post


Link to post
Share on other sites
You will want to learn & master the famious SDL or allegro libs. The cone3d site SKATIN_HARD posted will be useful.

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!