Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: esper on Fri 06/01/2006 07:09:17

Title: panorama
Post by: esper on Fri 06/01/2006 07:09:17
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...
Title: Re: panorama
Post by: Gilbert on Fri 06/01/2006 08:23:38
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.
Title: Re: panorama
Post by: ManicMatt on Fri 06/01/2006 09:50:36
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?
Title: Re: panorama
Post by: esper on Fri 06/01/2006 10:36:35
I don't exactly follow... Example?
Title: Re: panorama
Post by: ManicMatt on Fri 06/01/2006 10:48:32
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.
Title: Re: panorama
Post by: Candle on Fri 06/01/2006 11:10:34
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=24058.msg298608#msg298608
:o
Title: Re: panorama
Post by: esper on Fri 06/01/2006 11:26:56
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?
Title: Re: panorama
Post by: Candle on Fri 06/01/2006 11:33:59
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?
Title: Re: panorama
Post by: esper on Fri 06/01/2006 11:39:20
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...
Title: Re: panorama
Post by: ManicMatt on Fri 06/01/2006 11:40:56
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.
Title: Re: panorama
Post by: Candle on Fri 06/01/2006 11:43:13
The new Adventure Maker does real panorama now.
And what part of the demo ManicMatt?
I have a full AM license .
Title: Re: panorama
Post by: esper on Fri 06/01/2006 11:50:08
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!!!
Title: Re: panorama
Post by: Ashen on Fri 06/01/2006 11:52:09
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:

  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.
Title: Re: panorama
Post by: esper on Fri 06/01/2006 12:11:33
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...
Title: Re: panorama
Post by: ManicMatt on Fri 06/01/2006 12:11:54
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
Title: Re: panorama
Post by: Ashen on Fri 06/01/2006 12:52:45
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 (http://www.geocities.com/whoismonkey/ScrollBG.png) (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 (http://www.geocities.com/whoismonkey/ScrollBG2.png)) - 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?)
Title: Re: panorama
Post by: Candle on Fri 06/01/2006 13:06:33

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..
Title: Re: panorama
Post by: esper on Fri 06/01/2006 14:51:30
I would say so...
Title: Re: panorama
Post by: Ashen on Fri 06/01/2006 16:40:29
OK, this should be it (http://www.geocities.com/whoismonkey/Panorama1.zip). 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.
Title: Re: panorama
Post by: Candle on Fri 06/01/2006 19:03:53
Thank you very much for this . going to come in handy .
Title: Re: panorama
Post by: Barbarian on Fri 06/01/2006 19:25:43
Cool, thanks Ashen. I'll soon play around with it.
   This gives me some ideas about how to better implement some certain actions to within my game currently in production.
   
Title: Re: panorama
Post by: Candle on Fri 06/01/2006 21:09:31
I'm still trying to understand how to do the picture but I'll get it. lol
Title: Re: panorama
Post by: Elliott Hird on Sat 07/01/2006 08:55:57
say 1-9 is your picture, 1 being the left edge 9 being the right. make it as a panorama, and it'll be
123456789

you must change it to

8912345678912

see?
Title: Re: panorama
Post by: esper on Sat 07/01/2006 10:48:40
Nice'n, Ashen. Are you going to put it in the tech archives now or what?
Title: Re: panorama
Post by: Play_Pretend on Tue 10/01/2006 03:45:55
I'd been thinking about something like this myself, in Myst-style, only without the really good 3-D animation of movement between different screens/rooms.  If you can get it to do side-to-side panorama viewing, and didn't care if it could panorama vertically, couldn't you just set it so when the mouse goes into a long hotspot all around the top of the room's screen, the pointer shifts to an up arrow (a la Myst) and then when you click in that hotspot, it just player.Changeroom's you to another room whose background looks exactly as if you were just looking up in the original room?
Title: Re: panorama
Post by: Candle on Wed 11/01/2006 07:40:34
Quote from: Ashen on Fri 06/01/2006 16:40:29
OK, this should be it (http://www.geocities.com/whoismonkey/Panorama1.zip). 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 just love this Module you did for the  panorama .
It is my fav one, going to use this a lot. thanks so much.
Title: help with panorama
Post by: esper on Tue 24/01/2006 17:27:45
I had a question... Thanks, Ashen, by the way, for setting up my background for me. The only thing i don't quite understand is exactly how much space to put in the extra edges, and since I don't quite understand how it works in the first place, I don't get how you're supposed to know exactly where to cut the image off so it goes seamlessly into the loop. BUT that isn't my question...

I set it up like this:

Panorama.Start (eDragProportion, true, 2);
Panorama.Scroll (true, 20, 2, -1, -1);

However, it isn't dragging proportionately... It moves at uniform speed no matter where the cursor is... and it doesn't seem to matter how far the cursor is from the edge of the screen, it drags based on where the cursor is in relation to here it was when you pressed in the right mouse button. What is going on?
Title: Re: panorama
Post by: Ashen on Tue 24/01/2006 17:42:14
OK, it's because those two weren't really meant to be used together. Panorama.Start(...) sets up the 'Scroll while mouse button is held' function, while Panorama.Scroll(...) is for when you want it to scroll when the mouse is near the edge of the screen, and is always by a fixed amount (overriding the proportional setting from Panorama.Start(...)). Could've made the documentation clearer on that point (in fact, I thought I had, but looking at it, I didn't), sorry.

You either need to choose one over the other, or re-write the module slightly to allow both (since I re-use variables, making them mutually exclusive). Or, wait for me to re-write the module which I can do later, if you really need it.
Title: Re: panorama
Post by: esper on Tue 24/01/2006 18:33:06
Ah.

I've got it. It would be a useful thing to have the scrolling be proportionate to the distance from the edge of the screen, but that is not necessary at this time. Thanks for the reply. I only hope I don't wind up being too bothersome in here while I work on getting the game finished!
Title: Re: panorama
Post by: ShadeJackrabbit on Mon 13/03/2006 22:18:40
Pardon me for asking, but will this work like the Journeyman Project 3? And I'm not sure wheather I got this right. You have to add the code for every room you want to have a panoramma in right? And the image has to be tall too right? Example:

HIABCDEFGHIAB
8912345678912

So you can look up and down... right? (And sorry for aking all these questions.)
Title: Re: panorama
Post by: Ashen on Mon 13/03/2006 22:29:37
You'll need to call either Panorama.Start(...) or Panorama.Scroll(...) in every room you want to be panoramic. If you want EVERY room to be panoramic, and want the same settings for every one, you can just call it once at the beginning of the game.

If the room is taller than the screen, you can scroll up and down as well. It doesn't include looping for vertical scrolling though (so, you can't tilt up to the ceiling, then do a backflip 'till you're looking at the floor).
Title: Re: panorama
Post by: ShadeJackrabbit on Mon 13/03/2006 22:32:31
Okay. Thanks. Glad I now know how to use this.
Title: Re: panorama
Post by: td on Fri 07/07/2006 21:00:15
I wonder when appear panorama-plugin like in Aadventure Maker (background will roll in cylinder or sphere) ? It's will be hit!! Or it's exists already?
Title: Re: panorama
Post by: Ashen on Fri 07/07/2006 21:14:25
Well, the Panorama Module is like a Plugin. Possibly better, due to cross-platform compatability. I never did get round to posting it in the Tech Forum, though. And I've made a few changes since - I should dig it out again. I doubt adding that functionallity to AGS is a priority, as it's so easy to code for yourself.

The problem is the 'sphere' scrolling - I think you'd basically have to have the room background twice the normal height (more than, allowing for the overlap), and including an 'upsidedown' version of itself. And again, this is do-able with the Module, and a little re-coding. (EDIT: Actually, it might be more that a 'little' re-coding, but I still think it'd be do-able.)
To make real 3D panoramic scroll, you could use the AGS 3D plugin - I think adding it to the engine iteself would require a great deal of work, for a function that probably has limited usefulness

Title: Re: panorama
Post by: td on Sat 08/07/2006 18:19:21
I'm sorry Ashen. Many words is difficult for understand for not english speaker... U has mention words "to make real 3D panoramic scroll, you could use the AGS 3D plugin".
Is that plugin that i already can download???
If not, exists some way to realize "sphere" panorma?

Thanks.
Title: Re: panorama
Post by: Ashen on Sat 08/07/2006 18:39:51
AGS 3D Module & Plugin (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=22615)

Go read that thread for more detals, but basically it'll allow you to create a 3D envirnoment to move around in (like a First Person Shooter) - as opposed to the pre-drawn, 2D backgrounds usually used in AGS (and by the Panorama module). It's not the easiest thing to use, but with some work you can do it.

It's not easily do-able because it's really of limited use in the traditional adventure games that AGS is geared towards. That's not to say it's impossible, though. There may be a way to reailise it (I still think it can be done with the Panorama module, eventually), but the 3D plugin/module might be your best bet, if you don't want to stop using AGS.
Title: Re: panorama
Post by: td on Sat 15/07/2006 13:43:46
Ashen:
>To make real 3D panoramic scroll, you could use the AGS 3D plugin<


No... This is not it.
My understand of "Myst" structure: used flat images, but program "twist flat image into cylinder". Therefore this give effect of 3D. I hope this Plugin appear someday...
Title: Re: panorama
Post by: Ali on Sat 15/07/2006 14:11:23
Myst is a poor example because it uses still 2D images.
As I understand it, games like Zork Nemesis, Black Dahlia and Post Mortem work like Quicktime VR. A panaromic 2d image distorted with a sort of fish-eye so that when you pan and tilt it creates the illusion of a three-dimensional environment. I'm not sure whether AGS 3d would be suited to this kind of thing currently.

A distorting panorama would be a great feature, but would require AGSers to master panoramic rendering/photgraphy before it would be very useful. I something like this was developed though I think it would encourage people experiment, though I can't say I have any idea of how real-time distortion would work.
Title: Re: panorama
Post by: Kweepa on Sat 15/07/2006 16:55:54
Ags3d can do this easily. I put together a demo a while ago:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=25492.msg327790#msg327790
Title: Re: panorama
Post by: Ali on Sat 15/07/2006 17:20:31
My apologies Steve, I'd seen those images but I'd misunderstood what I was looking at. I was also under the impression that Quicktime VR used a cylinder or a sphere rather than a cube. 

Now I understand I wish I had the time to play around with this.
Title: Re: panorama
Post by: Kweepa on Sat 15/07/2006 17:33:03
Hey, no problem :)
Hmm, a 2d panorama (rotating but not tilting) would be pretty easy work for a module. Unfortunately I won't be able to work on it for a week.