Jump to content

  • Log In with Google      Sign In   
  • Create Account

Some Basic Tips


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Wardead   Members   -  Reputation: 102

Like
1Likes
Like

Posted 31 July 2011 - 02:48 PM

Hello everyone! I'm new here so would first like to say hello and thank you for providing such a sweet resource for us budding game developers - So hello and thanks!:D Secondly I just want to warn that I am a massive noob (probably in way over my head) but I am trying my best and any help is greatly appreciated.

So I recently started working on my first 2D (side-scrolling) game engine written in C++ with SDL. I used the awesome tutorials over at sdltutorials.com to get started and all was great. I did find a few areas however in which I had no clarification on and so had to kinda guess on how to achieve it. The first was depth. I wanted the foreground and background to appear closer and further away respectively. I did a little research and ended up blitting large surfaces which moved at different speeds relative to the viewport, which I believe is called 'parallaxing'. This worked fine so I was pretty happy with the result and ease! I then wasn't sure about the screen size and resizing everything if needed. I found that SDL had no native support for this and that if I wanted to re-size everything I would either have to create sprites of different sizes, or use OpenGL with SDL. I thought that using OpenGL would be the best option as I wanted to learn this eventually anyway.

So I left my SDL version and started to implement a new version with OpenGL. Here's where the trouble started. Firstly I found that I wasn't sure how to achieve the depth effects. At first I just created a textured quad which I moved much like the SDL version. But I then tried using perspective so that I could use the Z axis to move it further away and achieve the same effect 'for free'. This meant have a much larger quad with the background image textured to it and effectively stretched so that it appeared at the correct size. But is this the best way to do it? It seems simpler because I don't have to worry about placing it relative to anything; I just draw it at a fixed point and let the perspective take care of the rest. I've tried searching the internet for anything on this but I failed to find anything relevant. Currently I've left it in orthographic mode with 'parallaxing'.

My second problem was screen size and resolution. Is it the norm to scale everything depending on the users screen resolution as I thought? I thought that if I just made all my art assets at a high resolution, I could then use OpenGL to scale everything down for lower resolution settings, and recalculate positions and such. It sounds easier when written down :P Currently I've just left it fixed at a resolution.

So in summary my questions are:

  • For a 2D side scroller (with OpenGL in this case), is it better to use perspective with the depth buffer or an orthographic view with 'parallaxing' to achieve the perception of depth?
  • What's the best way to deal with different screen/window sizes? It is plausible to scale images down as long as they keep their aspect ratio, or is there a better way of handling this?
I had more questions but at the moment I'm a bit overwhelmed. If anyone would be kind enough to answer these for me it'd be greatly appreciated. Please excuse my being a noob and I'm sorry if what I've written is total rubbish. Thanks for taking the time to read.

(Mods: I wasn't quite sure where to post this as my questions seemed relevant to a number of sections. I posted here because I figured my problems are down to me being a beginner - Sorry if it's the incorrect place)
Shouldn't have let me out the cage...

Sponsor:

#2 Wardead   Members   -  Reputation: 102

Like
0Likes
Like

Posted 02 August 2011 - 07:35 AM

Sorry for the double post, but on account of the lack of interest in this thread can this be moved to OpenGL or perhaps Game Programming please?

(Also I've noticed it has 0 views and yet 3 votes...)
Shouldn't have let me out the cage...

#3 KazenoZ   Members   -  Reputation: 152

Like
1Likes
Like

Posted 02 August 2011 - 10:02 AM

Well, I'm not really knowledgable on OpenGL, but I can tell you that resizing IS in fact possible with SDL, you just need the SDL_rotozoom header included as well, it has a function called rotozoomSurface() that does exactly what you wanted.

If you're happy with OpenGL, then forget about this, but if you'd still rather work with SDL, just letting you know that it's possible =)

#4 Wardead   Members   -  Reputation: 102

Like
0Likes
Like

Posted 02 August 2011 - 10:15 AM

Well, I'm not really knowledgable on OpenGL, but I can tell you that resizing IS in fact possible with SDL, you just need the SDL_rotozoom header included as well, it has a function called rotozoomSurface() that does exactly what you wanted.

If you're happy with OpenGL, then forget about this, but if you'd still rather work with SDL, just letting you know that it's possible =)


Thank you, I'll look into this :)
Shouldn't have let me out the cage...

#5 Serapth   Crossbones+   -  Reputation: 5451

Like
1Likes
Like

Posted 02 August 2011 - 11:25 AM

FYI, the forum is bugged and views dont show up until there is at least one reply.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS