• Advertisement
Sign in to follow this  

Build a 2D Engine?

This topic is 4479 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
[quote]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
Ok, thanks everyone for your replies!



After much consideration, we have decided just to get going on writting the game. Does anyone else think that this idea would help us? I kinda feel like it would. It would keep it simple for us(even though we know SDL)and we wouldn't have to waste the un-wanted time to develop an egine. So I guess just build the game alone is best.



Thanks,
Chad!

Share this post


Link to post
Share on other sites
Quote:
Original post by Chad Smith
[...]After much consideration, we have decided just to get going on writting the game. Does anyone else think that this idea would help us? I kinda feel like it would. It would keep it simple for us(even though we know SDL)and we wouldn't have to waste the un-wanted time to develop an egine. So I guess just build the game alone is best.[...]
The problem with engines is that proper design isn't really an option - poor design will make it difficult or impossible to make a game in the engine.
When you're coding a game, you probably should have a good design, but if you don't it doesn't matter much at all.

I started out coding games and I made tons of them. Then I decided to make an engine, and I haven't made a game since. It's been 5+ years since I've made a game, but I've become a much strong programmer by being forced to think about proper software engineering.

Share this post


Link to post
Share on other sites
I've used SDL quite a bit and I am currently rolling a bunch of stuff together into what could be called in 'Engine'. My approach to the whole thing was what are the basics? In the end it all comes down to putting sprites on the screen. So I started out making classes for these things, application class, tile class, world class, etc... I then used these classes to make small arcade style games out of (tetris, pong, breakout) and anything else I could think of, to test these classes. That way if a class wasn't designed right, I would know it before I got too far along and I also had something to show for my work.

Just the way I went about these things. Good luck.

Share this post


Link to post
Share on other sites
look at any commercial engines out there... all they really are (the non drag-drop game creation engines, but the programming engines), are just a bunch of files that are used to set up the basics of a game.

Not game basics, but basics of a game.
There is a difference.

It's just like writing a class. For example, I'm writing my own 2D RPG, and I've made a graphics class, a sprite class, and so on, because I needed it in my project anyway.

Now, in the future, I could easily re-use all my classes because they're already done.

I think the main thing people think about when they hear the word engine is that it's a program that allows you to create games.

What they don't realize is that a game engine is really just another term for foundation, which is just basically source files interacting with their API and it's function calls.

Get it?

~Massive-war

Share this post


Link to post
Share on other sites
One thing to take into note when thinking about creating something to that scale is the amount of knowledge and experience you currently have and what you will be required to learn before you make your step forward. If you've just jumped into programming and the C++ world, you're going to have a massive amount of troubles not only learning the language, but the API you plan on using as well.

Also, are you trying to create a game, or an engine. These two things are completely different and keeping them seperate is a good thing. I generally go on the basis that the game is the content of your application, while the engine is what is used to power the game. If you're planning to just create an engine, you're going to be working on it forever. However, if you're making a game, you have a specific set of goals you want to achieve before saying it's "done" (5 different levels, a playable character, etc).

As for using a 3D engine/API for the development of a 2D game, I think it would be a great idea. This would require a whole new level of dedication though: learning the concepts behind 3D programming, the API you're going to use, what is needed to use the API to the full extent, etc. A pre-made engine comes with all of these features already embedded into it.

All in all, it doesn't really matter which you choose to do. Keep your goals set and every once in a while take a look at them and see if you're actually working on something that will help you accomplish your goal. If you say "build a simple 2D platform game engine", what do you mean? What's required in a simple 2D platform game engine? List out all that is required and take it one by one. Good luck!

Share this post


Link to post
Share on other sites
Everyone, I thank you VERY much for your replies. They have helped me out temendous!

Though, we wanted to build an engine to get the expierence, we think that we should just start building the game. We have thought about the pros and cons of each of them, but I think just building a game would be better. Their is just to much of a risk factor when develop an engine it sounds like. You might get to envolved in develop the engine, you forget about the game. We are looking to develop a game that other people would like to play. I mean....the players are not going to be looking at the engine the whole time. Sure an engine would be nice for a big game, but just for a Platform Game? I just don't think that would greatly benifit us. So we are going to just develop the game. We are going to get started on it soon also. We are just finishing up the design stuff for it.


Again everyone...THANKS VERY much for your support and replies. They were ALL taken into GREAT consideration, and we appreciate your help!


Thanks,
Chad.

Share this post


Link to post
Share on other sites
Hi, i would be interested in joining the project, i know basic c++ quite well, but not much about any libs though, is this going to be multiplatform?

ps would you be able to take my friend aswell, but he has only just learnt inhertiance

thanks

Share this post


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

  • Advertisement