Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I begun writing a very simple game engine so that I can learn OpenGL 3.x better but since my inexperience and my sparse knowledge of how a 3D game should be designed, I usually get into problems where I realize that I should have designed my classes differently. Other problems I'm facing is how to keep track of time in a concise manner in the game and update movement as needed and how to tell the renderer that it needs to redraw. Also I keep needing to make Get and Set functions for passing various flags from one object to another, is that a bad practice?

So, as the title says, I'm interested in any books or articles/tutorials and source which could help me out and would explain some common design patterns in game design (i.e. game state handlers, fonts etc).

Btw, I'm still using freeglut, would you recommend I move to a better windowing system before progressing or after I get a better grasp of OpenGL?

share|improve this question
11  
Standard "I'm writing an engine" response = Write Games, Not Engines. Engines are a deep rabbit hole to fall into. What research have you done so far? Here you will get best results by picking a single, focused issue and searching for past questions. Keep searching on new issues as they come up while writing your game, one at a time. As a side note, realizing that classes need redesign is common and the process of doing that is called "refactoring," it means that you're learning as you go and that's a good thing. –  Patrick Hughes May 14 '12 at 22:25
1  
Thanks for your response. Sorry if I was not clear, I don't really want to build a full-fledged game engine but I'd like to learn some basic design patterns used in game design so that I design my classes better. I guess there should be some common solutions to common problems. The deeper I go into the design, the more problems keep arising and the more difficult it is to find answers. My research so far hasn't been too fruitful, a nice tutorial I found which goes deeper into the makings of a game is codeproject.com/Articles/27219/… . –  Grieverheart May 14 '12 at 22:49
1  
I see, putting "game engine common methods" in the heading tends to steer discussion towards... engines =) In any case, the reason you're finding it difficult to get what you're looking for is that there are as many different types of games as there are years in a Mayan calendar and each type has its own needs. You may have better results if you look for a specific type of game, first person shooter is very common, to give search engines some traction. –  Patrick Hughes May 14 '12 at 23:10
    
An FPS style or free-roaming would be what I'm looking for. In essence I'd like to create a world where I can experiment with various graphics and animation techniques. I already have a basic camera and movement like jumping and strafing and model loading but it doesn't quite feel right e.g. I put the walking animation inside the camera class and I use an internal variable to count frames. I'm mostly patching the holes and not producing anything robust. I guess that's part of the process of learning and maybe I'm trying to move too fast. –  Grieverheart May 14 '12 at 23:33
3  
game coding complete, game engine architecture are two books about coding games, you'll get a general overview of the development pipeline and the underlying technology, they touch on a little bit of everything –  dreta May 15 '12 at 6:23
show 3 more comments

1 Answer

up vote 11 down vote accepted

I'll write a proper answer since i was at your stage about 2 months ago.

I begun writing a very simple game engine so that I can learn OpenGL 3.x better but since my inexperience and my sparse knowledge of how a 3D game should be designed, I usually get into problems where I realize that I should have designed my classes differently.

Don't worry about it. With your lack of experience, you'll never be able to think about all of the possibilities and ways a given class will be used in your engine. It's best if you consider the main features of the class, implement it and restructurize later. Don't try to overthink things, you'll be wasting your time at this stage. My first game was a complete mess, i'm sure it was the case for most people.

Other problems I'm facing is how to keep track of time in a concise manner in the game and update movement as needed and how to tell the renderer that it needs to redraw.

What you need is the knowledge on what a game loop is. This is a good place to start. Once you start writing more complex code like handling physics then you might want to consider loops with variable frame times, but start small. A simple fixed frame game loop should suffice you for now.

Also I keep needing to make Get and Set functions for passing various flags from one object to another, is that a bad practice?

This is more of a software engineering question. With time you'll see which data you need to protect and which is safe. It's probably best if you just implement a feature and then see what's not exposed outside of it and can be treated as public data.

It's all a matter of experience. You'll write a camera class, then you'll see what functionality you want from it beside the transform matrices. If you want any immediate tips, i'd have to say, implement bare bones, extend later.

Articles and Books:

  • Game engine development

These books talk about the architecture of modern game engines and pipelines. They'll give you a good overview on the underlying technology. I recommend the first book if you have to choose, it's less "biased" towards certain technologies, though in the end you proably want to get through both since they're great sources of knowledge.

http://www.amazon.com/Game-Engine-Architecture-Jason-Gregory/dp/1568814135

http://www.amazon.com/Game-Coding-Complete-Third-Edition/dp/1584506806

  • OpenGL

http://ogldev.atspace.co.uk/index.html

http://www.arcsynthesis.org/gltut/index.html

http://www.opengl.org/sdk/docs/man3/

  • GLSL

http://www.lighthouse3d.com/tutorials/glsl-core-tutorial/glsl-core-tutorial-index/

http://www.opengl.org/sdk/docs/manglsl/

  • Collision Detection

http://www.peroxide.dk/papers/collision/collision.pdf

(I'm linking this because i found it hard to find articles on how proper 3D collision detection is done.)

There's more books, but by the time you're done with this (especially Game Engine Architecture), you'll know better what you want.

Btw, I'm still using freeglut, would you recommend I move to a better windowing system before progressing or after I get a better grasp of OpenGL?

WinAPI, if you feel that you have time and will to learn Windows programming (if you're developing for Windows). FreeGLUT is fine for learning, but eventualy you'll want more functionality. Though, if you want to go the completely other route you can launch OpenGL with libraries like SFML or SDL. Stick with FreeGLUT, unless you're stubborn like me. I went straight for WinAPI.

share|improve this answer
    
Hey dreta, thanks alot for your very nice answer I was waiting for it :P ! Fortunately, I already know how to do collision detection since I have already implemented some algorithms for physics simulations :). –  Grieverheart May 17 '12 at 13:10
    
@user1294203 awesome, i was lost when starting out, so just posted it in case –  dreta May 17 '12 at 13:51
    
I vote for SFML, if you don't want to mess too much with platform specific code. It's small, easy, clean, and you can easily dive into code to understand how it wraps WINAPI for example. –  Edin M. Jul 9 '12 at 20:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.