panorama

Started by esper, Fri 06/01/2006 07:09:17

Previous topic - Next topic

esper

Hmmm. This might be difficult...

I am trying to figure out if there is a way to make a panoramic view of a room, where I make a room that is very long and very tall, and the edges on the left and right sides are connected so the character can actually TURN AROUND, look up, look down.... Almost like first person, with the ability to rotate the camera on its x and y axes, but not actually move through the world.

I am trying to come up with a way to have a "second-person" game, where the character is visible onscreen and you look over his shoulder. When you click "use" on a door, the character would walk away from the camera toward the door and enter it.

I'm not sure what type of control scheme I'm going to be using yet. This might be impossible, especially the part about having the background picture loop once you've looked too far to one side. If that's the case, I'll scrap this idea and come up with some other way to do it. However, as it will be a horror game, I think this would really add to the experience...
This Space Left Blank Intentionally.

Gilbert

Use SetViewport() mainly, there was a demo about making this effect, and I'm quite sure that it's included in the Demo Quest now. Just fetch a copy of the most recent beta of Demo Quest and look at its source code on how to do that.

ManicMatt

Dunno if that previous thing just mentioned works, but I was thinking, what if you had a character that's on screen, but is invisible. (Not the hide character option, just an invisible one) and then is it possible to have the character follow wherever the mouse cursor goes? And make the entire location walkable? Would that work?

esper

I don't exactly follow... Example?
This Space Left Blank Intentionally.

ManicMatt

I have no examples, I just thought of it now...

Let me try again! (And I still don't even know if this would work)

You have your big background, yes? Place a main character in there who has no pixels or anything. make the whole area walkable via the settings. now wherever you click the mouse pointer to walk, your invisible character will go over to that spot and thus the screen will scroll if the character goes close to the edge. Make him walk real fast too. Now, if there is a script somewhere for getting the character to constantly follow the mouse pointer, it might hopefully give the impression that the player is just moving the screen movement.


esper

Thanks all. I think I might not have been able to come up with that on my own, especially since I'm not a coder by nature. However, there is one thing still unanswered.

How would I make it to where, if I scrolled all the way to one side, the room would LOOP, as though I were spinning my view in circles? Is it even possible?
This Space Left Blank Intentionally.

Candle

I don't know but it would be cool to do if we can .
If we had a slide transition you could maybe slide it to that side know what I mean?

esper

Yes. The earlier versions of Adventure Maker (for making Myst-style games) had this option (until they actually came out with panorama support), and I was able to program a simple engine in Game Maker that allowed the same thing (but in which I couldn't add other objects to the foreground). I think AM is open source; I wonder if someone could get the source from that and figure out how they did it...
This Space Left Blank Intentionally.

ManicMatt

If you just mean a normal background loop when you reach the side, then the AGS demo game actually has that feature in one of the locations.

Candle

The new Adventure Maker does real panorama now.
And what part of the demo ManicMatt?
I have a full AM license .

esper

Seriously.... I need a walkthrough for the damn demo game! I would have found it already and tried to interpret the code myself, but I don't know which room does it since I can't go anywhere but the friggin' street! I've beaten every King's Quest, every Quest For Glory, Police Quest 1, Space Quest 2 and 3, Maniac Mansion, all the Zorks, Wishbringer, Enchanter, Hitchhiker's Guide... And I can't bloody well pass the first screen in DEMO QUEST!!!
This Space Left Blank Intentionally.

Ashen

#12
Damn, 4 posts as I typed this. Popular thread.

It's quite simple, actually.
Firstly, you need to modify your background image. You need to add half a screens width from the left side to the right, and half a screen from the right to the left, like this:
89|123456789|12
Where '123456789' is the actual image, and the extra '89|' and '|12' are the copied portions. (It'd make much more sense as an image - if you don't understand, liet me know & I'll knock one up.)

Then the code for looping would be something like:
Code: ags

  if (mouse.x < 20) {
   if (GetViewportX() > 0) SetViewport (GetViewportX() - 5, GetViewportY()); // Normal scroll left
   if (GetViewportX() == 0) SetViewport ((game.room_width - system.viewport_width)-5, GetViewportY()); // Loop left
}
 
if (mouse.x > (system.viewport_width - 20)) { 
  if (GetViewportX() < game.room_width - system.viewport_width) SetViewport (GetViewportX() + 5, GetViewportY()); // Normal scroll right
  if (GetViewportX() == game.room_width - system.viewport_width) SetViewport (5, GetViewportY()); // Loop right
  //The extra 5 here and on the 'if (GetViewportX() == 5)' line are for smoother scrolling.
  // Without them, there's a noticable 'stutter' as the room loops.
}


NOTE: This assumes you want the camera to move based on mouse position, rather than the 'click & drag' method in Candle's thread, but it's be easy enough to combine the two.
NOTE 2: You might have to add some code to move characters/objects when it loops back. Otherwise, anything visible immediately before will disappear when the rooms shifts.

I've used the game.room_width and system.viewport_width variables to make it more generic (i.e. you don't have to work out exact value for every room you want to use this in).

I'm not sure if vertical looping would work - suddenly jumping from floor to ceiling would be a bit odd, and I don't know how you could invert the room to do the proper 360.
I know what you're thinking ... Don't think that.

esper

A knock up would be quite nice, actually....

And, if my idea holds up, it wouldn't actually need to LOOP vertically, just be able to look at the ceiling and floor. You couldn't do somersaults...
This Space Left Blank Intentionally.

ManicMatt

Nice one Ashen!

If you still want to see the looping room in demo quest 3-1, the room in the editor is called Factorylooping

Ashen

With all due respect to the DemoQuest guys, I found that room a little hard to decipher - I ended up figuring this out myself, through trial and error. So very much error. (Actually, that's true of a lot of my experience with DemoQuest - the earlier version at least. Haven't tried the newest unfinished one.)

Example BG (OK, so art isn't my forte.)
Now, obviously you don't want the big dumb pink lines there - they're just to make it clearer what's been pasted where. Basically, you need overlap at each side of the screen or there'll be a nasty jump when it hits the 'loop' point.  Now it could just as easily be a whole screen from one side stuck on the other (like this) - I  prefer the symmetry, others might find it easier to use the whole screen (it would've probably been easier to explain it that way, at least). The same code works either way.

Quote
it wouldn't actually need to LOOP vertically, just be able to look at the ceiling and floor.
Excellent. I haven't included the up/down scrolling code, but you should be able to figure it out for yourself.

As Candle/GBC suggested in that other thread - would a module be of use to anyone? 'Click & Drag' panorama, or just put the mouse to the edge of the screen to move? (Or both?)
I know what you're thinking ... Don't think that.

Candle


As Candle/GBC suggested in that other thread - would a module be of use to anyone? 'Click & Drag' panorama, or just put the mouse to the edge of the screen to move? (Or both?)

Yes.. both..

esper

I would say so...
This Space Left Blank Intentionally.

Ashen

OK, this should be it. Documentation included. PM me if you need something explaining better, or if there's something that doesn't work/you'd like it to do that it doesn't.
I know what you're thinking ... Don't think that.

Candle

Thank you very much for this . going to come in handy .

SMF spam blocked by CleanTalk