Jump to content
  • Advertisement
Sign in to follow this  
blanky

2D Game Engine Creation

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

Hey guys, I'm in the process of making a 2D engine for my game. The game will be either an RPG (in which most likely tiling will be used) or a game such as the worms series or gunbound (which I dislike). My question is general, just to get an idea. I'm using C++ and OpenGL. What stuff should I keep in mind? I'm also planning on using OpenAL although I think FMOD is easier (Edit: I chose OpenAL due to licensing issues), and DevIL for image handling and SDL for input/window/etc. handling, Squirrel for scripting. Any other things I should keep in mind? Also, I'm going to make the engine with classes obviously as I'm using C++, so I'll have an Engine Class that contains all other subsystems and stuff, my question is, what stuff should I have? A Window Class? An Engine Class of course, a Sound Class? Input Class? Sorry, it's just that I'm new to this engine creation scheme. It might sound like I'm getting ahead of myself with all these things I plan on using, but they're just nominies for if I must use any at all. I know I should have an Engine class for sure haha, anyways, any help would be nice. Basically to get the idea on how to get started on 2D game engine design. Sprites, maps, tiling, etc., thanks guys. [Edited by - blankdev on January 19, 2006 8:51:11 PM]

Share this post


Link to post
Share on other sites
Advertisement
I would chooose GLFW over SDL if you are using OpenGL for rendering.

FMOD is nice and easy, just keep the license in mind.

Take a look at Photon for some ideas. http://photon.sourceforge.net

Share this post


Link to post
Share on other sites
I created my own using VC++ and DirectX with DirectDraw. First, some general comments. FMOD and the like will limit your ability to sell your title if you are considering it. The last time I read the license agreement to FMOD ( which I confess has been some time ) it had restrictions on selling your title. In general while open source libraries and solutions are great things they also will complicate your distribution. Again I am assuming that you will either sell or share your title with someone.

As for your implementation ideas I think your on the right track. I have a GraphicsEngine class a SoundEngine class and two classes for Keyboard and Mouse input. I also have a sprite class that does a lot of work. As for windowing I have a Game class that deals with the specifics of windowing or full screen.

If there is anything I have overlooked it is custom GUI related components in a full screen mode type of game.

I would also suggest that you start small with just a few classes and then build on that.

If you intend to release your engine to the community this will impact your design decisions compared to if your just building reusable classes for your own needs.

A GameWorld class can manage tiles and scrolling so consider that abstraction.

Share this post


Link to post
Share on other sites
Yes the license scares me, but I just haven't found much information on OpenAL, I'll try to use OpenAL then. Oh yeah and is a physics library necessary in a 2D engine or should I implement my own simple one. I know it depends on what I need, but what do you guys suggest? I was looking at novodex from aegia, since they're starting to make physics cards (not necessarily that my engine would take advantage of it)

I agree with you about the GLFW over SDL, I think GLFW is a lot more lightweight, but is it reliable? I used to use it and loved it, more than SDL, but is GLFW able to compete with it? if I'm just doing windowhandling/inputhandling/multithreading/etc. ? I'd choose it over SDL, but I think SDL is a lot more professional?

About photon, thanks. Although I'd like to build my own engine to learn myself and therefore know the engine thoroughly, I know you probably gave it to me to get that information as well, so thanks anyways.

Edit: Thanks joutlaw, I forgot about that, the GUI. Although I will probably use JavaCoolDude's, is that suggestable? For a 2D Engine? Anyways, thanks for the help so far.

Share this post


Link to post
Share on other sites
OpenAL is extremely easy and should be easy for you to use since it is structured on the OpenGL framework. I had no OpenAL experience and was able to play all sounds and even stream OggVorbis files in just a short time.

These OpenAL tutorials are very helpful. They're not perfect but you can easily master the basics with these.
http://www.devmaster.net/articles.php?catID=6

Share this post


Link to post
Share on other sites
Thanks Gellin. Now, I'd like to know what you guys think I should have for my classes (as I'm not a good UML sculpter :P ). Someone already mentioned World for the map handling and stuff, Input for input obviously, Sound for sound, Engine to encapsulate everything. I know there's still tons more, so do you guys have any hints?

Some classes I should have are:

Engine
World
Image/Sprite
Sound
Input

The things I should focus on for building a 2D engine are:

Collision Detection (Possibly rectangular as I'm using images/sprites)
Tiling/Map Format
Animation
Effects (Alpha Blending, Texture Mapping)
GUI (Possibly JavaCoolDude's)

Anyways, what do you guys suggest I do, just texture map to quads? Alpha blend 'to be' transparent parts? Orthographic projection I believe (Could anyone please point me to the thread (pretty old) about Drew_benton I believe explaining 'for the last time' how to create orthographic projection in opengl? Thanks)

I just need the basics (obvious) things and I'll start from there, thanks guys.

Share this post


Link to post
Share on other sites
Again, take a look at Photon. It will show you exactly how to setup Orthographic Projection, use OpenAL, and has a very cool templated resource manager.

Photon uses GLFW, OpenGL, OpenAL, Corona, PhysicsFS, Freetype2, and Boost.

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!