Adventure Game Studio | Forums

AGS Support => Beginners' Technical Questions => Topic started by: jamesreg on Wed 13/03/2019 21:53:18

Title: Setviewport issue
Post by: jamesreg on Wed 13/03/2019 21:53:18
I am having an issue with setviewport command.

I have a background which is larger then my regular room background.
However I do not want the room to scroll. I have it set up so basically there are multiple rooms on one background.
Base game is 480x270.   the background I have is 1440x540 which consist of 6 480x270 rooms on that background.

The issue I am having is if I use setviewport to change another room on that background while still in the same game room It sets the viewport correctly.
However if I do a cChar.changeroom command and setviewport during that change. It does not set the viewport correctly it sets it halfway between the background.
what do I have to do to make sure it sets it at exactly where I want it?

setviewport(960,0);
Is what I am tryng to get it to set to if I am already in that room it works like a charm but If I do same command while changing rooms it does not work and offsets the background.

it seems as if i start the character in that room it acts fine and switches viewports fine but if i change character from one room to that room it tries to be a scrolling room
Title: Re: Setviewport issue
Post by: Jack on Wed 13/03/2019 22:18:35
Quote from: jamesreg on Wed 13/03/2019 21:53:18
However if I do a cChar.changeroom command and setviewport during that change.

Where does this setviewport go, exactly? You might have to do the viewport change in the before or after -load event of the room you're changing to, rather than in the one you're changing from.
Title: Re: Setviewport issue
Post by: Crimson Wizard on Wed 13/03/2019 22:59:31
ChangeRoom does not happen immediately, instead it queues room transition and only goes after current function ends and process returns back the the engine.
Calling SetViewport literally after the ChangeRoom will make it set camera in the old room, and if that room is smaller than the next one the final result will be wrong.
I think best way is to remember the section you want to change to in a variable and call SetViewport in "on load" event, as Jack suggested.
Title: Re: Setviewport issue
Post by: jamesreg on Wed 13/03/2019 23:11:20
That works will have to do an if/else thing depending on where I am entering from to handle more then one viewport. But setting the viewport from the room load thing worked.
Title: Re: Setviewport issue
Post by: ManicMatt on Wed 13/03/2019 23:42:10
I am curious, what is the advantages of having multiple room backgrounds in one room? That sounds like a lot of hard work.
Title: Re: Setviewport issue
Post by: jamesreg on Thu 14/03/2019 00:10:34
Because I am trying to avoid the limit of 300 save able rooms.

I am making a Star Trek game which one of the parts of the game is recreating the entire Enterprise which is 24 decks and hundreds of room locations and hallways etc.
So for that part I am laying out the decks as one actual room with with large background with multiple rooms on that deck on it. then all the coding for an entire deck can be done in just one room script and reduce the number of actual rooms to a min. This is a large project just doing the ship and Ill also have missions and planets to goto which ill be doing simular thing with for those locations.
Title: Re: Setviewport issue
Post by: Jack on Thu 14/03/2019 00:18:51
Sounds amazing. Got an approximate release date?
Title: Re: Setviewport issue
Post by: jamesreg on Thu 14/03/2019 00:45:47
Way to early to even speculate right now.

7 years ago I attempted the project which has been a dream of mine for a long time.
But things did not work with the team I had back then life issues got in the way before we got to far.

I spent the last 7 years off and on designing the concept and refining it much deeper on paper and notebooks.

Finally sit down and officially picked it back up a couple months ago and this time the attempt is going much much better.

I am using a 3D model of the Enterprise to render out my rooms and decks backgrounds which are being used as concept and filler art and allowing me to full script the exploration of the ship right now. This is gone amazingly well and I almost have a full Star ship that can be explored with fully working Turbolift, Transporters, Intercom system, library computer,  and just about everything else on the ship. The ship can be fully explored even the turbolift shafts and jeffeies tubes are present to explore. I am also filling the decks with crewmen that appear to have schedules and move around on the ship. All concentration right now is being put into making the most Interactive ship to explore as I can.

Khris designed an 3D mock up engine within AGS that is a mock up of Wing Commander. I asked Crimson Wizard to assist converting it for use with this game even though the base game will be traditional point and click adventure game format when exploring the ship and planets and away team missions and such the space part of the game exploring space sectors and space combat and all this will be done in 3D. 

So it is going to be awhile the first demo I plan to release is a Ship exploration mode which will allow you to explore the entire ship it will be done as Captain Kirk's first day aboard and as an Inspection of the ship/Tutorial kinda thing. But just the exploration of the ship alone will be larger then most full games are so it should be an enjoyable Demo and pump people up for more.

I am looking for other Artist I only have one right now and the project is a bit much for one person so anyone who wants to participate we are doing it in Pixel art.
The artist will have 3d renders of the backgrounds and basically just need to recreate in pixel art.

Im not planning on announcing anything official until I have got more done but the progress is positive and even though it is a large project it is moving at a fairly fast rate of progress daily right now.
Title: Re: Setviewport issue
Post by: Jack on Thu 14/03/2019 00:53:53
Cool. I have seen almost all the TOS episodes now. Was surprised that it was a much different and deeper experience than TNG in some ways, and TNG was an excellent show.

Some 3D apps can do some pretty good-looking pixel art with the right settings. There are a few tutorials on how to do this on youtube for blender, probably other apps too.
Title: Re: Setviewport issue
Post by: ManicMatt on Thu 14/03/2019 09:35:43
Woah! Super ambitious! I would enjoy exploring the ship alone! I hope one day I will be able to do that. :)
Title: Re: Setviewport issue
Post by: Snarky on Thu 14/03/2019 09:51:23
Just FYI, the way many games get around the room limit is to reuse the same room, just with different "decoration" depending on what room it's meant to represent. If several rooms have the same general layout (walkable area), you can vary the appearance and interaction using objects that you set to different sprites (and respond to based on logic that takes the "virtual room number" into account).
Title: Re: Setviewport issue
Post by: Slasher on Thu 14/03/2019 12:17:24
Yarr.... I have rooms that serve as other rooms... saves time and space... Just a few tweaks like backgrounds, objects and variables...
Title: Re: Setviewport issue
Post by: jamesreg on Thu 14/03/2019 12:33:56
Quote from: Snarky on Thu 14/03/2019 09:51:23
Just FYI, the way many games get around the room limit is to reuse the same room, just with different "decoration" depending on what room it's meant to represent. If several rooms have the same general layout (walkable area), you can vary the appearance and interaction using objects that you set to different sprites (and respond to based on logic that takes the "virtual room number" into account).

Yes I am doing that trick as well as multiple rooms on one background. For Example I have one deck that is a Cargo Deck. There are 6 Cargo bays on that deck, A Cargo Transporter room, as well as two rooms associated with the Tractor beam plus the hallways. in total 12 rooms in game. But I have it all on one background with 6 "rooms" on one background and 6 of one of the rooms is the same cargo bay. I simply turn on off objects and characters and set bools so it looks like I entered 6 separate cargo bays yet it is only one background used for all 6 rooms. Ill do similar when I get to ship quarters and such.  All these tricks are allowing me to only use 24 rooms for what will appear to be 100s of rooms ultimatly.
Title: Re: Setviewport issue
Post by: Khris on Fri 15/03/2019 09:58:52
Quote from: jamesreg on Thu 14/03/2019 00:10:34Because I am trying to avoid the limit of 300 save able rooms.

Might just be how you phrased this, but you can have way more than just 300 rooms. It's just that room objects and the like won't save their state in rooms above 300.