Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / moving room to room, the best way?

Author
Message
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 13th Jun 2011 23:30
Ok i am currently working on a first person "point & click" adventure game, similar to things like Myst and Amnesia : Dark descent and during the demo tests i was told it was best lo load up the rooms as players entered them, what would be the best way to do it?

Currently i have all of the rooms loaded and the procedure to go through is as such :-


now how would i go about knowing which room i was in? i'm pretty sure i couldn't use the above coding to do it and i probably can't have One object the covered ALL doors. would i have to make individual boxes for each door?

the only way i can think of doing it is very very long winded and would take MASSES of coding for just the 5-6 doors i have already made.

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 2.5 TB HDD
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 14th Jun 2011 08:41
There are a few ways you can deal with moving from room to room.
can you tell us more about the game layout?

for example,
will each area be a jpg image on the screen which you can interact with via mouse?
or will it be a purely 3d environment?
2d and 3d?

will it be an openly explorable world? or will it be a specific story path from beginning to end?

I just need a better idea of what your asking to give useful input.

you can use variable switches to know which room you are in.

here is an example of something you could use -this code is an expression of logic rather than working code.


something along those lines would work, maybe using a case select statement would be the go.
with more information I can be more specific.
kezzla

Sometimes I like to use words out of contents
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 14th Jun 2011 10:12 Edited at: 14th Jun 2011 10:30
it's a complete 3d world, it's like an fps... without the gun
at the moment it's fairly linear although i may open it up a bit more and make it more explorable

I get the general gist of what you are saying, and that was pretty much what i thought, each and every door will have to have it's own set of commands by the look of things, so say i was in room 1, i'd click on the door to go to room 2
now if room 2 has two doors, i'd have to make 1 door change my current room back to 1 and the other to 3.... yes?

that's pretty much how i figured it would be done, i was hoping there would be a less code intensive way, but that seems to be my only option thus far.

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 2.5 TB HDD
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 14th Jun 2011 11:29
hmmm, one other thing you could try is to have multiple rooms in one 3d model (or map), and have an invisible object in front of the door, so if there is collision and mouseclick, the camera is transported to the other room (maybe with small delay and doorsound) this may cut down some coding.

It depends on how system heavy the game is, Im guessing if your loading room by room it must have some pretty full on detail in it.

one other thing i've just found is
LIMB HIT
"This command will return a value of one if the limb of one object hits the limb of another."

im not real savvy with modeling so this may or may not work,

but I reckon if you make the door in your rooms a limb, and use that collision + mouse click that could work.
save having to place an invisible box in the scene.

kezzla

Sometimes I like to use words out of contents
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 14th Jun 2011 12:21
At the moment all of my rooms are seperate objects.... but i see your point in making them one big model... i might give that a go.

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 2.5 TB HDD
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 14th Jun 2011 20:39
I'd just model all your rooms to be approximately rectangular. It's easy to check if a point is in a rectangle (if it's x value is greater than the left wall of the rectangle, but less than the right wall etc.)

So, have an array looking something like:


(saying an array has (-1) size means that it has 0 elements. If you say dim arr(0), you're saying the array has a single element at index 0)
So, then check if your player is in the rectangle, and if none of the rectangles overlap severely, you'll get the ID of a single room.

I don't know how the rest of your system works, but presumably, once you know what room your player is in, you should know what rooms are attached to the room you're in. So only load the room the player is in and the rooms adjacent to the rooms the player is in (IE the ones attached to the current room with a door)


Why does blue text appear every time you are near?
Mychal B
14
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 24th Jul 2011 12:39
If I was I would just make a function that ran every 10 game loops or so that checked the distance to each door...



It may help to set a variable saying which door is opened up such as door_open = 3 or door_open = "bedroom" and then use the variables to decide which object to update and animate in the function/subroutine.

The fastfood zombie killer

Login to post a reply

Server time is: 2024-11-22 19:12:37
Your offset time is: 2024-11-22 19:12:37