Jump to content
  • Advertisement
Sign in to follow this  
SaltyDev

Confusion with insides of 2D games

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

Hello, I am new to gamedev!

I know C++ pretty well and decided to dedicate part of my life for indie game development.

I already learned some basics (like what is a game loop, how to write a text adventure etc).

As a next step I decided to learn how to use a development library (i chose SDL) to create a simple, let's say, space shooter game. When I say simple I really mean simple - simple physics, simple collisions etc. Not more than 1 player and 1 enemy just to learn some new features.

But here is where confusion comes in.
I am now reading about basic game engine features and met a new term - scene graph. I understand how it works speaking about code, but i don't understand it regarding to game itself. I tried to look into various sources and seems like scene graph is a sort of scene management.

1. Can you explain me what is the difference between scene graph and scene management? Does scene graph represent only entites that can be drawn or it includes everything about entity (for example sound)?

2. What are scene graph alternatives?

3. How OOP is implemented in SDL? Or do I have to manually create classes like SceneGraph/SceneNode using SDL functions?

 

4. What are the best books/tutorials for reading when you know enough to write complex text adventures but totally new to 2d game creation?

Sources that I read now either using terminology that I do not understand or have target audience of experienced game developers.

 

Thanks in advance!

Edited by SaltyDev

Share this post


Link to post
Share on other sites
Advertisement

3. How OOP is implemented in SDL? Or do I have to manually create classes like SceneGraph/SceneNode using SDL functions?

 

4. What are the best books/tutorials for reading when you know enough to write complex text adventures but totally new to 2d game creation?

Sources that I read now either using terminology that I do not understand or have target audience of experienced game developers.

 

Thanks in advance!

 

Just going to leave the first two for other people since I have no idea honestly. Regarding the last two tho:

 

3.) SDL isn't going to effect the way you use OOP patterns. You'll still be making classes the same way you did with your text based adventures using C++, everything is going to be the same OOP-wise.

 

4.) https://www.youtube.com/user/makinggameswithben/playlists  The advanced Playlist, he teaches SDL/OpenGL, he pretty much makes an engine and then makes a little 2D shooter, pretty similar. Granted you don't really need everything he uses to make a basic game, for instance you don't really need to utilize OpenGL, you could make a basic game with just SDL, but if he's explaining everything , hell why not.

Share this post


Link to post
Share on other sites

Sometimes people like to make things sound more complex than it actually is.  I never knew what a scene graph is when I first made my own video game.

 

Video game programming, in a nutshel, is really just handling logic for each object you have in the game, and draw them to the screen in the order you want them to be drawn.  At its simplest form:

for (int i = 0; i < gameObjects.length; ++i) {
    // handle logic for gameObjects[i]
}

for (int i = 0; i < gameObjects.length; ++i) {
    // draw gameObjects[i]
}

Done.  That's your game loop.  The only thing important is to separate the logic code and drawing code, and that's why I wrote two separate loops.

 

Then games become complicated, scrolling map, parallax scrolling, 3D, particle systems, objects attached to other objects and so on.  Some objects drawn completely, some others partially on the screen, and some others are completely out of the screen.  So people start handling these game objects into a complex tree structure which they call a scene graph.  You do not need a scene graph structure to make a game.  However, once your game start getting more complicated, and you have had solid programming background, you would naturally solve that complexity with a scene graph anyway.

Edited by alnite

Share this post


Link to post
Share on other sites
A scene graph is one of those things where a picture really is worth a thousand words.  In layman's terms, a scene graph is a data structure for logically arranging a scene.  The gist of it is that "Nodes" reside in a hierarchical tree.  These nodes can have parents, but generally only have one.  This is a solid article on the subject http://archive.gamedev.net/archive/reference/programming/features/scenegraph/index.html
 
SceneGraph.png
Edited by ByteTroll

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!