Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1] 2   Go Down

Author Topic: Really Really stupid question: Room Changing.  (Read 3825 times)

0 Members and 1 Guest are viewing this topic.

Dark-Hylian

Silence
Really Really stupid question: Room Changing.
« on: January 12, 2010, 04:40:17 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
I had been using my own engine for my Zelda Fan Game, but my computer got destroyed by some idiot brother of mine, and I lost all of my stuff. Anyways, I'm forced to resort to using Goodnight's engine, and I cannot, for the life of me, remember how to properly move between rooms. I'm pretty sure I used something on an object just outside the room, but even that didn't work entirely, because it would appear on the object in the other room, and get stuck in the loop. Anyways, if anyone has any suggestions or solutions, I would love to see them. (Note: I will be downloading the MC engine community project once the next version comes out.)

That will be all.
Logged
  • Dawning Hour

Mamoruanime

@Mamoruanime
Re: Really Really stupid question: Room Changing...
« Reply #1 on: January 12, 2010, 04:43:01 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
I'd just assume have your link object check if his position is beyond the room boundaries, and then transition
Logged

Dark-Hylian

Silence
Re: Really Really stupid question: Room Changing...
« Reply #2 on: January 12, 2010, 04:45:11 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
Then have a determination object to tell him which room to go to at each exit? I ran into that problem before, attempting  something like that. You would run out of anywhere in the room and go to the specified one. Any "Proper" way to prevent that?
Logged
  • Dawning Hour

Mamoruanime

@Mamoruanime
Re: Really Really stupid question: Room Changing...
« Reply #3 on: January 12, 2010, 04:48:01 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
I typically set up a faux-grid to let the player know where to transition to.

So for example, if the player is in room 3,3, and is traveling left, the next room will be 2,3. It's usually pretty easy to set up if you don't mind setting up standardized naming conventions for your rooms and such.
Logged

Dark-Hylian

Silence
Re: Really Really stupid question: Room Changing...
« Reply #4 on: January 12, 2010, 04:51:50 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
Ah, similar to OOA/S and LA? That system doesn't happen to be inconvenienced by many exits does it? Say...
                                                                 
If Link's Moving Left, Outside the Boundary, in room X, which has rooms to all sides, up, down, left and right, check which room comes to the Left of room X, and go it it?

Im feeling I might not be completely understanding.
Logged
  • Dawning Hour

Mamoruanime

@Mamoruanime
Re: Really Really stupid question: Room Changing...
« Reply #5 on: January 12, 2010, 04:54:28 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Well you just simply check to see if there's a room there, and if not you can either send it to a catch room (like the "N" room in OoA/S, or Chris Houllian room in lttp) or simply disallow a transition :P

But yes, it simply checks if a rooms available, and loads it :P
Logged

Dark-Hylian

Silence
Re: Really Really stupid question: Room Changing...
« Reply #6 on: January 12, 2010, 04:59:08 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
Should the specification be bound to an object which lines the exit, or on link and specify a "If x=? and y=? the go to RoomX?Y?" In other words, you have to draw up a map of all your rooms, and determine which exits lead to where, and then specify when you're at which exit, to go to which door?

(Edit): I think I got something to work... gonna mess around with it some.
« Last Edit: January 12, 2010, 05:05:05 am by Dark-Hylian »
Logged
  • Dawning Hour
Re: Really Really stupid question: Room Changing...
« Reply #7 on: January 12, 2010, 05:29:18 am »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
If you have an large area made up of a lot of little areas it works out well to have it so that if you go outside the view regions that it'll adjust the view so long as doing that won't put it out of the room's absolute boundaries. Basically you'd check to see where Link was in relation to the left, right, top, and bottom of the view (e.g. you just to see if Link's x is less than the view's left boundary or if it is greater than the view's right boundary). I'd code some of this but I have to figure out some school stuff first, my roommate is snoring, and I have a migraine.
Logged

Mamoruanime

@Mamoruanime
Re: Really Really stupid question: Room Changing...
« Reply #8 on: January 12, 2010, 09:30:25 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
I would almost never suggest having one large room for multiple little ones simply because Game Maker loads them like !@#$%, however the alternative is a bit more complex and requires a little more time devoted to it.

Alternative being having your rooms generated when needed, and having a controller for your view that moves whenever you need to scroll. The reason for this is to keep GM from trying to load the tile data for a huge room on the fly, because it lags from poor rendering code.

In various different incarnations, I've coded a system involving a room consisting of exactly 3x3 "view" sizes that dynamically loads the rooms when needed for scrolling. However again- this is an advanced subject, and pretty much should only be done when you feel completely comfortable in your coding skills and independence from GM to make your own map system. GMare is pretty useful for that stuff :P
Logged

Dark-Hylian

Silence
Re: Really Really stupid question: Room Changing...
« Reply #9 on: January 12, 2010, 12:25:01 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
I'm thinking Minish Cap style rooms, oddly shaped overworld peices, but roughly rectangular in total shape. I'm not dividing the areas like in LA, and the lagging of tile-loading doesn't matter to me much. I think I may have found a solution, using a room / area grid and X-Y room names. I'm going to put it into work sometime today, or at least test it, but I have school in half an hour, and I gotta get ready. Anyways, gentlemen, thanks for the help, I will get back on how my idea works.

(Edit):

What I set up was a grid type system. I don't really like it, but it almost worked. In a 3x3 set of rooms, all the same size(Square) (Which won't be how it is in the real thing) and all lined up, the bottom left room is ForestRoom_"X0Y0". Above it is ForestRoom_"X0Y1" and to it's left is ForestRoom_"X1Y0". When you intersect the upper boundery(If Link's Y is higher than his X in the room(Note, I know this wont work with non square rooms, but bear with me)), you will go to ForestRoom_"X0Y1". The grid continues till X3Y3. By determining Link's relation in terms of the bounderies of the room, then it can decide which room to go to. Several problems occured though.

A. The size. In the real game, I plan for the overworld rooms, IE, Kokiri Forest, Lake Hylia, etc, to be one room. Also, they will not all be square either, so the X-Y position factor will not work in the way it does here.

B. What happens when ForestRoom_"X3Y3"'s northern edge is MountainRoom_X2Y0? The whole system gets messed up.

C. When there are more than one exit on a side. It would have to determine Link's X and Y in relation to the boundary, but then, if Link's X(Going Up) was less than the X of the right door, then it would go left, and vice versa.

It seems to work in theory, I have yet to put it into code though. I see many flaws, but it's the only way I can see to start off.
« Last Edit: January 12, 2010, 12:57:41 pm by Dark-Hylian »
Logged
  • Dawning Hour
Re: Really Really stupid question: Room Changing...
« Reply #10 on: January 12, 2010, 01:17:14 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3374
use the room creation code to define teleport areas. Set a few variables with the room id's and where the teleport area is in the current room. Say if you want two rooms on the left side, set one area to cover the top half when link is outside the screen and one to cover the bottom half for the other room.
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.

Dark-Hylian

Silence
Re: Really Really stupid question: Room Changing...
« Reply #11 on: January 12, 2010, 10:17:10 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
I tried my method, by using a 3x3 grid on paper of Room_X0_Y0 to Room_X3_Y3. I set it so that, if Link went off the edge of the 320 by 240 room, and his X was higher than 160, and Y was lower than 240 and higher than 0, the room would change to Room_X1_Y0. That wasn't the case. Nothing happened. I don't know why, but the logic seems sound. Anyone care to help? If I can get this process to work, and since all rooms are rectangular, then I can work from there and set room specific X and Y points for multiple doors in the side, but this must be completed first. I honestly have no idea what to do. This has me stumped. Been attempting to figure it out for almost an Hour.

(Also, I'm using the ZFGC's latest release of the MC engine, the one without roll and bow.)
Logged
  • Dawning Hour
Re: Really Really stupid question: Room Changing...
« Reply #12 on: January 12, 2010, 11:16:35 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
I made an example of what I was talking about, although I rushed it and it needs to be configured so that it works more generally. Basically there is a viewing region that when you go outside of it, the view will be altered so long as it doesn't go outside the dimensions of the room. The example only works with a 240 x 160 viewing space but there are ways to make it work more generally such as doing a position_meeting check for an object which determines whether you're moving into a 240 x 160 room or you're moving into something with greater dimension (in that case it'd set the view_l/view_r or whatever according to the room's maximum limits rather than the view's).

If you want to do into specific houses, that's not to big of a deal either it just depends on how you want to do it. My best guess would be to create door objects in the creation event of the room and then put position values in them for where you want Link to warp to in the other room or something. I don't know, I'll look into it.

But yeah, see the attached file
Logged

Mamoruanime

@Mamoruanime
Re: Really Really stupid question: Room Changing...
« Reply #13 on: January 12, 2010, 11:50:15 pm »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
I'm thinking Minish Cap style rooms, oddly shaped overworld peices, but roughly rectangular in total shape. I'm not dividing the areas like in LA, and the lagging of tile-loading doesn't matter to me much. I think I may have found a solution, using a room / area grid and X-Y room names. I'm going to put it into work sometime today, or at least test it, but I have school in half an hour, and I gotta get ready. Anyways, gentlemen, thanks for the help, I will get back on how my idea works.

(Edit):

What I set up was a grid type system. I don't really like it, but it almost worked. In a 3x3 set of rooms, all the same size(Square) (Which won't be how it is in the real thing) and all lined up, the bottom left room is ForestRoom_"X0Y0". Above it is ForestRoom_"X0Y1" and to it's left is ForestRoom_"X1Y0". When you intersect the upper boundery(If Link's Y is higher than his X in the room(Note, I know this wont work with non square rooms, but bear with me)), you will go to ForestRoom_"X0Y1". The grid continues till X3Y3. By determining Link's relation in terms of the bounderies of the room, then it can decide which room to go to. Several problems occured though.

A. The size. In the real game, I plan for the overworld rooms, IE, Kokiri Forest, Lake Hylia, etc, to be one room. Also, they will not all be square either, so the X-Y position factor will not work in the way it does here.

B. What happens when ForestRoom_"X3Y3"'s northern edge is MountainRoom_X2Y0? The whole system gets messed up.

C. When there are more than one exit on a side. It would have to determine Link's X and Y in relation to the boundary, but then, if Link's X(Going Up) was less than the X of the right door, then it would go left, and vice versa.

It seems to work in theory, I have yet to put it into code though. I see many flaws, but it's the only way I can see to start off.

Ah so doing tetris style room blocks- that's a little more complex in itself since instead of standardizing your rooms on a grid, you actually have to break that particular room up into a grid of standard room sizes.

For example, if 1 game room is 256x224, and your room is set up with three rooms on the top, and one room in the middle at the bottom (T) shape, the room would have a grid of 3 rooms by 2 rooms (3 horizontal, 2 vertical). You then have to make checks of what part of the room the player is in when walking through it. If the player is in the upper left most part of the room, he'd be in 1,1. If the players in the lower part of the T, it'd be 2,2.

You'll have to write a lock routine for the view based on the coord of the player in the room so it doesn't scroll into null areas (1,2 does not exist, neither does 3,2 in a T shaped room), and you'll also have to write a control script for which rooms to transition to when the player is out of the view.

It's a pain, and it's more of an advanced topic, but it works beautifully once you get it going :P
Logged

Dark-Hylian

Silence
Re: Really Really stupid question: Room Changing...
« Reply #14 on: January 13, 2010, 12:02:19 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
Just saying, but this is something that would be really helpful to have put into the future MC Engine community project. As far as I've seen, Hookshot, Rolling and Room Changing are the most commonly asked for engines or explanations. Anyways, I'll keep at it, see if I come up with something. I'm sure that implementing this into the open source engine would greatly benifit people, because then they could take it and modify it, say, if they decided to make a Lost Woods, the code could easily be changed to make a Warp Point in the exits, reverting to the first room.

On the note of the T shape, it would still be X0Y0, etc. but the X0Y0 wouldnt exist, it would be imaginary. That's where the if room_exists would probably come into play. But, my game wouldn't end up using the small, standerdized rooms like LA did(That was a LA example), instead using large overworld chunks like in Minish Cap.

Anywho, thanks for the help as of now, and undoubtedly help in the future.
Logged
  • Dawning Hour

Mamoruanime

@Mamoruanime
Re: Really Really stupid question: Room Changing...
« Reply #15 on: January 13, 2010, 12:18:43 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Well, for T shaped rooms and other odd setups like that, the overall standardized room name system wouldn't work because the rooms are no longer equal size. You'd have to individually specify where you're supposed to transition given a specific coordinate in an individual room, instead of dynamically changing rooms.

I started with 1,1 being the upper left in my previous post, but lets say upper corner is 0,0 (which is actually more correct), then your room would be the following- (Red are rooms you walk in)

0 1 2
0 1 2

Your total room size would be your standard room size * 3 along the X and Y axis, so 256x224 as a standard room size would leave your actual Game Maker room being 768x672.  If you move into room 2,0, then the actual room you will transition to if you step outside of view would have to be different than the rooms you'd change to from 0,0.

It's somewhat confusing to explain, but the general idea is that you have to check to see what portion of the room Link's in to set up both your view and your transitions.

The overall grid system (where your rooms are named Room_X0_Y0, etc) can't apply to the tetris shaped room system, because they're no longer evenly laid out on a grid.
Logged
Re: Really Really stupid question: Room Changing...
« Reply #16 on: January 13, 2010, 12:24:16 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 5213
Well, for T shaped rooms and other odd setups like that, the overall standardized room name system wouldn't work because the rooms are no longer equal size. You'd have to individually specify where you're supposed to transition given a specific coordinate in an individual room, instead of dynamically changing rooms.

I started with 1,1 being the upper left in my previous post, but lets say upper corner is 0,0 (which is actually more correct), then your room would be the following- (Red are rooms you walk in)

0 1 2
0 1 2

Your total room size would be your standard room size * 3 along the X and Y axis, so 256x224 as a standard room size would leave your actual Game Maker room being 768x672.  If you move into room 2,0, then the actual room you will transition to if you step outside of view would have to be different than the rooms you'd change to from 0,0.

It's somewhat confusing to explain, but the general idea is that you have to check to see what portion of the room Link's in to set up both your view and your transitions.

The overall grid system (where your rooms are named Room_X0_Y0, etc) can't apply to the tetris shaped room system, because they're no longer evenly laid out on a grid.



Aaaaaaand that is why I never got on with game design.
:P
Logged

Dark-Hylian

Silence
Re: Really Really stupid question: Room Changing...
« Reply #17 on: January 13, 2010, 12:27:52 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
T shaped room? How so? Wouldn't it simply be rectangular with some space taken up by, eg, trees? Anyways, I get it. I just don't know how to do it.  XD
Logged
  • Dawning Hour

Mamoruanime

@Mamoruanime
Re: Really Really stupid question: Room Changing...
« Reply #18 on: January 13, 2010, 12:39:53 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Lol well that's the problem with explaining both technical aspects with faux aspects XD

If you have a T shaped room, it's still a square room according to Game Maker. You need to make the player think the room isn't square by locking your view to move in only certain directions according to the players position.
Logged

Dark-Hylian

Silence
Re: Really Really stupid question: Room Changing...
« Reply #19 on: January 13, 2010, 12:54:56 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
Room Size - X 480(example) Y 640 (Example
View Size - 320 by 240 (GBA screen size)
View centered around objLink.
View border 9999
:

Now, when link moves, he's in the middle, and the only time that the view stays put when he moves, is when he's running up against the edge of a room, ie, the view has collided with the edge of the room, and therefore, cannot move.

:
There is, or was, a way to determine something via View x and View y, required to make a HuD follow a view. If that's the case, then just set a border. It's hard to explain, but I can try.

If the room's a rectangle, but the open area is shaped like a +, with a door on each side, then you should be able to determine if:

Heading for the North Door: Link's Y is above the "Center Point" of the view, in this case 160 by 120.
Left the Room: if he's outside the room's boundery.
and just in case, If he's not going out the side instead, ie,
       (Door)
Door)   |   (Door

as in, Link's x is greater than 0, but lower than 320, and his Y is greater than 120, meaning that:

The view is at the edge of the room, meaning that link can move past the center point, Link's NOT colliding with the left or right of the view, and Link's "Outside" of the room.

Much easier to explain with pictures, but that's what I've been basing my work off of. Tell me if there's anything I was doing terribly wrong. Because of the way Views work, this should always be the same, even if you switch it to the other way around, for the left and right doors.
Logged
  • Dawning Hour
Pages: [1] 2   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.047 seconds with 75 queries.