11 Replies - 978 Views - Last Post: 02 August 2012 - 10:19 AM Rate Topic: -----

#1 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 365
  • Joined: 11-July 12

Game camera

Posted 27 July 2012 - 12:28 PM

I'm looking for useful information about creating games, when user don't see all game window. Only part of it, and when it walks for example, only then, he can discover new places. It such as Mario, when you need to walk to right direction to see what is next. Thank you.
Is This A Good Question/Topic? 0
  • +

Replies To: Game camera

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10783
  • View blog
  • Posts: 40,158
  • Joined: 27-December 08

Re: Game camera

Posted 27 July 2012 - 12:38 PM

You'll probably get better replies in the Game Programming forum. I'll move this over there.
Was This Post Helpful? 0
  • +
  • -

#3 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 365
  • Joined: 11-July 12

Re: Game camera

Posted 27 July 2012 - 12:39 PM

View Postmacosxnerd101, on 27 July 2012 - 12:38 PM, said:

You'll probably get better replies in the Game Programming forum. I'll move this over there.

Then I need to add, that I'm talking about JAVA.
Was This Post Helpful? 0
  • +
  • -

#4 Tayacan  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 145
  • View blog
  • Posts: 275
  • Joined: 18-January 11

Re: Game camera

Posted 27 July 2012 - 01:16 PM

Uhm.. Well.. You'd need to learn a graphics library, probably 2D if you want to make something like Mario. I have no idea what libraries exist for Java, but try googling a bit. Once you figure out how to put some graphics on the screen, the rest is more or less just math.
Was This Post Helpful? 0
  • +
  • -

#5 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1184
  • View blog
  • Posts: 7,254
  • Joined: 07-September 06

Re: Game camera

Posted 27 July 2012 - 02:17 PM

There is a java version of OpenGL, which can be used to do 2D graphics (when disabling depth buffering and testing, and changing the view to Orthogonal). It has a bit of a learning curve, but it is powerful, nice, and pretty easy once you get used to it.
Was This Post Helpful? 0
  • +
  • -

#6 Tayacan  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 145
  • View blog
  • Posts: 275
  • Joined: 18-January 11

Re: Game camera

Posted 27 July 2012 - 02:38 PM

No. No, no, no. I can't really judge how much you know from one post, but you don't seem super experienced. I'd recommend learning a high level graphics library, something that allows you to just say "put this image on the screen at these coordinates", rather than OpenGL, where there's a lot of extra... stuff. Like disabling depth buffering and testing, and changing the view to Orthogonal. You don't want to deal with that if you're just starting out.

Not that I don't like OpenGL (I'm currently learning it), but it's somewhat complex and very low level.
Was This Post Helpful? 0
  • +
  • -

#7 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 856
  • View blog
  • Posts: 2,620
  • Joined: 29-July 11

Re: Game camera

Posted 27 July 2012 - 04:15 PM

You won't need opengl for something like something Mario, as Java2d is already hardware accelerated on Windows, Mac, and Linux by default - well, recent versions of Java are. There are some game tutorials on youttube for writing a jave side scroller.
Was This Post Helpful? 1
  • +
  • -

#8 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 586
  • View blog
  • Posts: 1,306
  • Joined: 24-April 12

Re: Game camera

Posted 28 July 2012 - 05:54 AM

View Postnovakasss, on 27 July 2012 - 01:28 PM, said:

I'm looking for useful information about creating games, when user don't see all game window. Only part of it, and when it walks for example, only then, he can discover new places. It such as Mario, when you need to walk to right direction to see what is next. Thank you.


That's called a "side scroller". The way it works is that the game level is much larger than the screen in the game. You create "window" into that level and then move the window. It's kind of like if you had a picture that was 100 by 20 and picture frame that was 20 by 20. You could move the picture frame around to frame different parts of the picture.
Was This Post Helpful? 1
  • +
  • -

#9 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 365
  • Joined: 11-July 12

Re: Game camera

Posted 01 August 2012 - 02:02 PM

Where I can get information about side scrolling?
Was This Post Helpful? 0
  • +
  • -

#10 Tayacan  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 145
  • View blog
  • Posts: 275
  • Joined: 18-January 11

Re: Game camera

Posted 02 August 2012 - 01:20 AM

Right here;-)
Was This Post Helpful? 0
  • +
  • -

#11 novakasss  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 365
  • Joined: 11-July 12

Re: Game camera

Posted 02 August 2012 - 06:28 AM

View PostTayacan, on 02 August 2012 - 01:20 AM, said:

Right here;-)

LOL. I found those videos earlier, but that guy on youtube, I even can't understand what he is saying, and his coding habbits are awful. So, I tried to do it by myself, and I can do some stuff. But I want to ask something, Like in Mario games, with Mario, you can jump on the bricks, go upstairs and downstairs, does all that stuff(bricks, stairs, flower tunels) are part of background, or another objects?
Was This Post Helpful? 0
  • +
  • -

#12 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 586
  • View blog
  • Posts: 1,306
  • Joined: 24-April 12

Re: Game camera

Posted 02 August 2012 - 10:19 AM

I haven't ever put together that type of game, but here's how I would approach it.

I would setup a byte array (or int or whatever you want) but I'm going with byte. So, each element of the array has 256 possible values. I would make each of those values represent a square on a grid for the level. Some of the values might represent dirt, or rock. Some might represent objects.

Assuming that only one object can occupy a square on the screen, I might put everything into just the one array. So, one code might even represent the character.

The first thing though would be to assign solid objects that don't move. So, maybe all codes below 50 are solid objects. So, I could then just go to that array element for that square (when the character tries to move into it for example) and test if it's value is less than 51. A very quick test to determine if the character should be allowed to move into that square or not. Other values above 50 might be things like coins that when you collide with that square you take the coin. Or, you might have one code be a square that's a portal. And when you touch it it sends you to another level of the game.


So, that array would determine what gets drawn on the screen basically. In addition to that, I would maybe have a picture like a JPEG or something that's drawn behind these elements. I might have one of the array element values represent empty space where nothing is drawn and characters can move through (like 255 - the highest possible value - or maybe 0 if you make elements above a certain number collidable rather than below a certanin number).

So, the picture would show through on the squares where nothing was drawn there.

If I wanted to get really fancy I could do a paralax side scroller, where the background picture (maybe some clouds and moutains or something) would scroll at a different rate than the objects drawn from the game grid. This would make the background appear to be much further away.

Anyway, a big part of this is that my game grid would be much larger than the screen. So, I would make the game grid something like 10 or 20 times wider than the screen. That would mean that only 1/10th or 1/20th of the total game grid could be displayed at any one time.

So, my draw routine would only draw that section of the grid that would be on the screen at any one time. As the character moves, I would move that "frame" that gets drawn, so that the area drawn is always the part of the grid that the character is at.

You could also have elements, such as the character for example, that are not allowed to pass through solid objects, but are able to move as real numbers between grid squares. So, they are handled as seperate sprites from the grid. So, I character might be able to stand half way in two different grid squares at the same time rather than jumping completly from one grid square to the next.

You might have other game elements that also are handled seperately from the grid and allowed to move across grid squares in a fractional way rather than being 100% in one grid square and jumping 100% to the next grid square. You have to do more complicated collision testing for that.

For a character moving into grid squares that are solid in the game grid array, it might be an all or nothing where you're allowed to move into part of a square only if the value in the array at that location is not a solid object code, otherwise you're not allowed to move into any part of that grid square.

Where as, if you had a solid object that wasn't part of the grid, you would have to handle it with OBB (Oriented Bounding Box) collision tests or per pixel collision tests or something. But this gives you the freedom to break away from the grid with an object. I would use a combination of grid collision with some elements being handled seperately from the grid with other collision methods such as OBBs.




And basically that's it.

Like I said, I've never done a side scroller like that. So maybe someone with some actual experience doing such might give you some better ideas. But that's how I would start out thinking about it anyway.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1