MODULE: Panorama3d v1.3

Started by Kweepa, Sat 08/08/2009 21:30:46

Previous topic - Next topic

Kweepa

Panorama3d module
for AGS v2.72+

Creates a 3d rotatable room from a sky box texture.

This:                                                                           From this:

(Image courtesy of LimpingFish)

Instructions in the script header.
Download:
http://www.kweepa.com/step/ags/tech/Panorama3d13.zip
Demo:
http://www.kweepa.com/step/ags/tech/Panorama3dDemo2.zip
Video on youtube:
http://www.youtube.com/watch?v=d1I3UDLyyrY

Version history:
1.0 Initial version
1.1 High quality rendering when not looking around
1.2 Added support for AGS 2.72
1.3 Alternate control scheme for laptops - click and drag to look around

Enjoy!
Steve
Still waiting for Purity of the Surf II

Ryan Timothy B

Wow, that is super impressive!  It's relatively fast too considering what it's doing.
The big question though, is how would someone go about making a rotatable room image?

Great work anyway! Hopefully someone puts it to good use.

monkey0506

So if I understand the difference between this and the Panorama module is that this would support looking up and down as well, right?

LimpingFish

Yay! This is the bees knees!

Quote from: monkey_05_06 on Sat 08/08/2009 21:52:01
So if I understand the difference between this and the Panorama module is that this would support looking up and down as well, right?

Yep. Your characters can now sport workable necks! I can picture lots of excursions into lofts and basements. Or up/down stairs!

Quote from: Ryan Timothy on Sat 08/08/2009 21:45:56
The big question though, is how would someone go about making a rotatable room image?

Any good 3D package, and the correct output settings when rendering (position your camera - with a FOV of 90 degrees and an aspect ratio of 1:1 - in the center of your room, and render a 320x320 image for each of the six required views), will do. It's then just a case of stitching the images together in Photoshop (or Gimp, etc) and importing the resulting 1280x920 image into AGS.

I've only been playing with the module for half an hour, and I can tell you it's just as simple to use as the old one.

Great work, Steve.
Steam: LimpingFish
PSN: LFishRoller
XB: TheActualLimpingFish
Spotify: LimpingFish

Kweepa

Updated first post with super-exciting youtube video link!
http://www.youtube.com/watch?v=d1I3UDLyyrY
Still waiting for Purity of the Surf II

monkey0506

Does this support repositioning the camera or just panning it? I presume the latter.

Kweepa

Quote from: monkey_05_06 on Sun 09/08/2009 22:44:50
Does this support repositioning the camera or just panning it? I presume the latter.
Yes, you can only turn and pitch the camera.

New version uploaded (and new demo) with high quality rendering when you stop looking around. :=
Still waiting for Purity of the Surf II

Brad Newsom

#7
Quote from: SteveMcCrea on Sun 09/08/2009 23:46:21
Quote from: monkey_05_06 on Sun 09/08/2009 22:44:50
Does this support repositioning the camera or just panning it? I presume the latter.
Yes, you can only turn and pitch the camera.

New version uploaded (and new demo) with high quality rendering when you stop looking around. :=

Sweet. I wanted to make a prototype of sorts which required a spherical Panoramic environment with the ability to reposition the camera when clicking on a hotspot (movement) then play a movement video.

All in High Resolution goodness.

Thanks again for this module. It did everything I needed it to do for my small project.

Dataflashsabot

#8
Any chance of a 2.72 version? (module is awesome, tested it in 3.whatever and it was brilliant, but I prefer 2.whatever for actually making games in.)

Kweepa

Quote from: Dataflashsabot on Wed 12/08/2009 17:43:01
Any chance of a 2.72 version? (module is awesome, tested it in 3.whatever and it was brilliant, but I prefer 2.whatever for actually making games in.)
I'd rather not have to keep two versions in sync and supported.
I've used 3.x scripting extensively in this module.
If you want to use it I'm afraid you'll have to convert it yourself, or upgrade to 3.x for the project! Don't be scared, it's well worth it!
Still waiting for Purity of the Surf II

Kweepa

Quote from: Dataflashsabot on Wed 12/08/2009 17:43:01
Any chance of a 2.72 version? (module is awesome, tested it in 3.whatever and it was brilliant, but I prefer 2.whatever for actually making games in.)
2.72 support added. Enjoy!
Still waiting for Purity of the Surf II

Kweepa

Version 1.3 up.
Added a click and drag to turn control scheme, similar to browser based Panorama viewers. Good for touch pad control on laptops.
Still waiting for Purity of the Surf II

Brad Newsom

Is it possibe for you to supply the demo in editable format?

Kweepa

Quote from: Brad Newsom on Mon 24/08/2009 11:33:05
Is it possible for you to supply the demo in editable format?

Sure, try this:
http://www.kweepa.com/step/ags/tech/Panorama3dDemoSrc.zip

Can I ask why you need the source to the game? Is there something hard to follow (or missing) in the instructions?
Still waiting for Purity of the Surf II

Brad Newsom

#14
Well, I need a point of reference. The last time I programmed in AGS was back in version 1.3.

My confusion was the whole room_Load function. I have no idea where it is, and anything that came close to it gave me errors. So, i'm going to disassemble the source and see how things work.

*Facepalm* Okay. I'm stupid. I forgot to open and close at the end of the function calls. >_<

Edit: Okay, thats the least of the problems. I do as told in both  basic and empty projects. When you run the project, the game starts but you can't drag around or move. It also starts in a blank spot of the background image. I noticed a lot of code within the global variables of your example. Also I noticed how the project is set to 320x240, yet the window is much larger. Why is that?

Kweepa

I'm going to assume you're using AGS 3.

Did you follow these instructions (from the header?)
Code: ags

// Import this script module

I assume you did this :)
But for someone else following along at home, just open a new project using the default template (not the empty template) and in the top right pane, right click on Scripts, select Import Script... and then select the Panorama3d.scm file. I recommend also double clicking on General Settings and selecting colour depth of 16 or 32 bit and resolution of 320x240 on the left hand side.

Code: ags

// Set the player coordinates to 0,0

This is important because the room background is larger than the screen. If the player is left at the default position, the viewport on the background is scrolled to try to center the player, whereas the code draws the 3d view at the top left of the room background. To set the player position, open the Characters section on the right and double click on cEgo. In the property section below, in the Design sub section, set StartX and StartY to 0.

Code: ags

// Import the cube map for the background
// Create a new background frame in the room and import the cube map again

Open the Rooms section on the right, and then the 1: sub section. Double click on Edit Room. In the panel on the left, click the "Change..." button next to the "Main background" button and select your cube map. Then press the "Main background" button and select <Import new background...>, then select the cube map again.

Code: ags

// Set the background animation delay to 0 (to stop animating)
// Set ShowPlayerCharacter to false

Go to the properties pane in the bottom right, and in the Settings section, set the BackgroundAnimationDelay to 0. Then double click on ShowPlayerCharacter to toggle it to False.
This is to stop the 2d player being drawn on top of the 3d view.

Code: ags

// From the room_Load function, call Panorama3d.CreateFromBackground and Panorama3d.Enable
// From the room_repExec function, call Panorama3d.StandardLookAround()
//                                   or Panorama3d.TurnRelativeToOrigin(Mouse.IsButtonPressed(eButtonLeft), 2060)
//                                                                                    sprite drawn at origin ^

Click the little lightning bolt underneath the "(Room; number 1)" button, and in the Events section below, click on the "Enters room before fade-in" line. Then click on the "..." button on the right. This pops up the room_Load function in the editor window on the left. Paste this code into the function:
Code: ags

  Panorama3d.CreateFromBackground();
  Panorama3d.Enable();

Double click on "Edit room" in the top right pane again.
Click on the "Repeatedly execute" event line in the bottom left pane, then click on the "..." button to bring up the code editor. Paste this code where the cursor is placed, in the room_RepExec function:
Code: ags

  Panorama3d.TurnRelativeToOrigin(Mouse.IsButtonDown(eMouseLeft),  2060);


Now press F5 to compile and test the game!

Quote from: Brad Newsom on Mon 24/08/2009 23:02:53
My confusion was the whole room_Load function. I have no idea where it is, and anything that came close to it gave me errors. So, i'm going to disassemble the source and see how things work.
This is probably where things went wrong. You need to create these functions through the editor (by pressing the "..." button in the event section) before you can use them in the room script.

Quote
Also I noticed how the project is set to 320x240, yet the window is much larger. Why is that?
This is because the image needed to create the 320x240 is much larger - it needs to include the details all around, not just in the direction you're currently facing.

Hope this helps!
Steve
Still waiting for Purity of the Surf II

m0ds

Quote from: SteveMcCrea on Fri 14/08/2009 19:28:12
Quote from: Dataflashsabot on Wed 12/08/2009 17:43:01
Any chance of a 2.72 version? (module is awesome, tested it in 3.whatever and it was brilliant, but I prefer 2.whatever for actually making games in.)
2.72 support added. Enjoy!

LOL and after saying you wouldn't... Good, I'll check this out now, looks like it could be useful! :)

Dualnames

Steve, the module is perfect don;t get me wrong okay? But the "refresh rate" when you turn the camera strikes a little odd, you know when the pixels get shaped up. Is there any way to "fix" this? or it's just AGS doing it? It's not bad or anything but when you stop moving the screen two lines appear and go from the left to the right like google earth.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Kweepa

Quote from: Dualnames on Tue 25/08/2009 14:45:33
It's not bad or anything but when you stop moving the screen two lines appear and go from the left to the right like google earth.
Yes, that's the high quality rendering being done in stages. AGS scripting isn't quite fast enough to visit every pixel every frame, so when looking around I render 16 pixels at a time in 4x4 blocks. Then when you stop, I paint in the pixels one at a time. There's not a lot I can do about it.
Still waiting for Purity of the Surf II

Dualnames

Quote from: SteveMcCrea on Tue 25/08/2009 15:15:40
Quote from: Dualnames on Tue 25/08/2009 14:45:33
It's not bad or anything but when you stop moving the screen two lines appear and go from the left to the right like google earth.
Yes, that's the high quality rendering being done in stages. AGS scripting isn't quite fast enough to visit every pixel every frame, so when looking around I render 16 pixels at a time in 4x4 blocks. Then when you stop, I paint in the pixels one at a time. There's not a lot I can do about it.

Okay, that's what I wanted to know. It's really cool, I'm not complaining. :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk