Insufficient understanding of 2D Viewports

  • (2 Pages)
  • +
  • 1
  • 2

24 Replies - 2257 Views - Last Post: 15 December 2012 - 07:13 AM Rate Topic: -----

#16 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Insufficient understanding of 2D Viewports

Posted 13 December 2012 - 06:08 AM

Pictures FTW

Attached Image

So here's my map that I want to scroll, it's twice the width of the screen.

Here's my window, with the drawing surface within the red rectangle

Attached Image

And here is the image with the source rectangle defining the data that will be copied across to the destination rectangle.

Attached Image

To scroll I can simple move the coordinates of the source rectangle and copy its data into the destination rectangle. This is just to clarify what I mean and maybe the draw surface is not the correct terminology but this is how I see it and what I was getting at :).
Was This Post Helpful? 0
  • +
  • -

#17 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Insufficient understanding of 2D Viewports

Posted 13 December 2012 - 08:58 AM

You guys are going by textbook examples that explain basic implementations and interpreting that as general fact. It certainly is not true that every single 2D game has a draw surface that is the same size as the the conceptual viewport. There are a number of reasons why this would be impractical:

1. For a sufficiently large map on a speed-constrained device it may be beneficial to preload the next map at some point during gameplay on a sufficiently large draw surface, or prior to gameplay to reduce loading times.

2. For old games (Street Fighter II comes to mind), you were clearly playing a 2D game where you where able to scroll left and right as the fighters moved around. This very clearly states that more of the environment was loaded than displayed in the conceptual 2D viewport. Please don't mention parallax scrolling, even so it holds true.

I completely get what is being said about just loading everything as and when needed on a surface that is the same size as the screen, effectively making the surface the 'viewport'. But that is simply a variation in implementation, not definition.

About the viewport being a 3D concept or entity only, this is another common misconception. If splitting hairs, when talking about viewports in 3D then very specifically we should use the phrase 'view volume' for obvious reasons. Viewport is certainly valid for 2D.

[edit]

Stayscrisp, just looked over your images. That is essentially what I am trying to get at too, but do not understand how you got to your interpretation.

This post has been edited by ButchDean: 13 December 2012 - 09:08 AM

Was This Post Helpful? 0
  • +
  • -

#18 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Insufficient understanding of 2D Viewports

Posted 13 December 2012 - 09:22 AM

View PostButchDean, on 13 December 2012 - 03:58 PM, said:

You guys are going by textbook examples that explain basic implementations and interpreting that as general fact. It certainly is not true that every single 2D game has a draw surface that is the same size as the the conceptual viewport. There are a number of reasons why this would be impractical


I did not state anything as "general fact", I gave the OP my view on things and my advice. A way that I have used in many games I have made. You have simply been disagreeing with me every step of the way, mostly about wording of concepts.

You know how I know it works? And how I know it works well? Because I have implemented it myself.
Was This Post Helpful? 0
  • +
  • -

#19 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Insufficient understanding of 2D Viewports

Posted 13 December 2012 - 09:54 AM

I work on projects with 2D elements, but work solely on 3D projects in my own time. So I too am well versed in 2D, but from how it's implemented in real, shipped titles.

I'm not disagreeing to be a dick, just to make sure that definitions are clear to ensure that correct information is conveyed to people asking for help. That is why we're here, right?
Was This Post Helpful? 0
  • +
  • -

#20 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5780
  • View blog
  • Posts: 12,595
  • Joined: 16-October 07

Re: Insufficient understanding of 2D Viewports

Posted 13 December 2012 - 10:19 AM

View PostButchDean, on 13 December 2012 - 10:58 AM, said:

About the viewport being a 3D concept or entity only


Well, I said the viewport makes sense in 3D. In 2D it looses a something, maybe more than just a D. You can go on about orthogonal projections, but you're really just trying unify a concept between two different domains.

You can use the idea of a viewport in 2D, but you can also ignore it. Your view is flat. That's 2D. It's not going to change. The concept helps you about as much as... honestly, I'm not sure where it helps.
Was This Post Helpful? 0
  • +
  • -

#21 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Insufficient understanding of 2D Viewports

Posted 13 December 2012 - 10:53 AM

Well, it does make sense in 2D because you need something that defines a region where content is displayed. What else can it be?
Was This Post Helpful? 0
  • +
  • -

#22 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5780
  • View blog
  • Posts: 12,595
  • Joined: 16-October 07

Re: Insufficient understanding of 2D Viewports

Posted 13 December 2012 - 11:38 AM

Screen? Canvas? Display? Graphics Context?

You're ultimately bitblting your current 2D buffer into the displayed screen buffer. There are many possible terms.

And that's were viewport comes in. In means something very specific in 3D, which isn't the display. In 2D, it becomes a confusing synonym for things that it isn't.
Was This Post Helpful? 0
  • +
  • -

#23 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Insufficient understanding of 2D Viewports

Posted 13 December 2012 - 12:05 PM

All the things you mentioned have very specific implementations in code that define them; they're totally different! I just cannot see what your point is.

Please find a source anywhere that says those are interchangeable even in a 2D, or else that makes no sense.
Was This Post Helpful? 0
  • +
  • -

#24 Olebendz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 12-December 12

Re: Insufficient understanding of 2D Viewports

Posted 15 December 2012 - 05:22 AM

Just to let people know, I managed to create the 2D viewport grid area as a DrawGraphics. This is my project so far (I changed the UI).

Posted Image

Thank you everyone for your help :)
Was This Post Helpful? 0
  • +
  • -

#25 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Insufficient understanding of 2D Viewports

Posted 15 December 2012 - 07:13 AM

Awesome. :)
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2