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.

DarkBASIC Professional Discussion / Has anyone tried making a "Portal" style game before?

Author
Message
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 21st May 2010 05:16
Hi Guys,

I have tried making a Portal game before (2 days ago actually), and it didn't quite work. What I did find, though, was that it would actually be quite possible to make Portal (for info on Portal search "steam portal" on Google). With multiple cameras and the "set camera to image" command it is possible. It is also possible to do (like in Half-Life) realtime "screens", such as a security camera in a multiplayer FPS. I just wondered if anyone had thought of this before.

Clonkex

Making games is easy.....finishing them is a different matter.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st May 2010 08:31
Kinda, ever since portal there have been a few experiments, in fact I found one recently, but can't remember who made it - works really well though. Have a search in the code snippets forum to see how most folk do it with and extra camera.

It would be a bit of a stretch to do it exactly like Portal, but a pretty good effect can be got, that's been proven.


Health, Ammo, and bacon and eggs!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st May 2010 08:53
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 21st May 2010 15:31
Quote: "but can't remember who made it"


Please say it was me, SAY IT!!!

Perfect Portals

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 21st May 2010 15:34
Quote: "Spherical Portals"

Yeah I rule.

My portal is a ball though. I'd like to see Portal style flat portals realised in DBP someday too. I'm pretty certain it's feasible, but there are only so many hours in the day. .

To do this the way i'd do it, "set camera clip" will be useful, as will the following function, adapted from code posted by Dmitry K in this thread, used to shift the centre of perspective of the camera matrix.



Good luck if you decide to have a bash at it. If you're patient i can move it up my to do list and have a play around maybe next week. It's actually quite and exciting prospect.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 21st May 2010 15:41
Quote: "I'd like to see Portal style flat portals realised in DBP someday too."


I wish that too, I'm pretty close, but still having issues because the way cameras work. But I'm still working at it and in time I will get it down, I hope.

Btw, I love your Spherical Portals. Great work.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 21st May 2010 15:43
Quote: "Perfect Portals"

It's been done! Well done.

You've got to put some portals in your portals though.
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 21st May 2010 15:53
Quote: "Btw, I love your Spherical Portals. Great work."

Thanks dude. Yours is sweet too.

Quote: "I wish that too, I'm pretty close, but still having issues because the way cameras work. But I'm still working at it and in time I will get it down, I hope."

Good to hear you're working on it. Perhaps we can bounce some ideas off eachother. I read your thread and for culling, i think you want to use "set camera clip". The way i want to do it should (I hope) completely avoid the problem of blurry portals in portals, but it's kind of lengthy to explain. I may as well just bash it out and post the code. Next week.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 21st May 2010 16:04
Quote: "You've got to put some portals in your portals though."


Yeah, that's the one thing I've got stuck on (camera issues), oh and trying to work out how to put the player camera in the centre of the portal like you can in Portal.

Quote: "Yours is sweet too."


Cheers

Quote: "I read your thread and for culling, i think you want to use "set camera clip""


Cheers for the advice, but I tried and it didn't end well. Though there's a method I'm working on now that uses "set camera clip", if I get it working I'll post it (somewhere).

I'll be watching your thread.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 22nd May 2010 04:42
I'm not surprised we got soooooo many people trying to re-make Portal with various programs, cause Portal was a really cool idea. No, a brilliant idea. The people at Valve really hit on something. I tried to do it with Blender's Game Engine (www.blender.org), but completely failed, because you can't output the camera's view to an image or bitmap. Simple with DBPro, though. I will attach the code and files I used, later, so you can see my experiements with portaling techniques. It really isn't that good, because I don't have the experience to use matrixes and such, but it a good basic example. Unfortunately someone is fixing a door in my house (he will remain nameless), and he had to unplug my computer to do so, so you will have to wait until he's finished to get the files. BTW you are probably thinking "But your chatting to us??". Simple. I have 2 computers, one for internet (a slow old one) and one for everything else. The reason I do this is because having the computer connected to the internet inherently makes it slow. I can't have my main computer being slowed down by the internet, now, can I?

Clonkex

Making games is easy.....finishing them is a different matter.
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 28th May 2010 02:44
I've been working on this.

Have managed to shift centre of perspective to render an arbitrary rectangular cutout of a standard camera view. It's clear and undistorted.

Currently writing code to find the smallest possible on screen rectangle to cover a portal on screen. This isn't as simple as it sounds.

Next step will be to demonstrate this technique with a simple plain mirror.

Basically my plan is to get the same result as using a full screen resolution camera render for each view through a portal/mirror, but use this culling to avoid rendering parts of the view not seen, drastically reducing the number of pixels rendered.

It's turning out to be a bit harder than I thought though.
Sepnon
16
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Brazil
Posted: 28th May 2010 02:48
lol

Quote: "I'm not surprised we got soooooo many people trying to re-make Portal with various programs, cause Portal was a really cool idea. No, a brilliant idea. The people at Valve really hit on something"


The 'portals' were a copy from Prey
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 28th May 2010 05:18
If you're talking about the game Prey, then no, because they came out the same year and portal was based on Narbacular Drop, which was already out. (valve hired the people making Narbacular Drop for portal)

I had a nice portal demo going, you couldn't go through portals but the views were perfect. Unfortunately my hard drive crashed so I lost all that code, but I might recode it...

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 28th May 2010 06:04
Quote: "If you're talking about the game Prey, then no, because they came out the same year and portal was based on Narbacular Drop, which was already out."


Incorrect. Prey has one of the longest developments in games history and was the first game to sport portals way back in '97 when it was shown. But the game was canned. Various companies picked it up, but none stuck until Human Head Studios grabbed it a started working on it from '01.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 31st May 2010 04:22
@Dr Tank
That's cool, maybe when you finish it you could show us the source code?

@thenerd
Yes, please do recode it! That would be cool!

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 31st May 2010 16:56
Quote: "Incorrect. Prey has one of the longest developments in games history and was the first game to sport portals way back in '97 when it was shown. But the game was canned. Various companies picked it up, but none stuck until Human Head Studios grabbed it a started working on it from '01."

I stand corrcted, then. I didn't know that...

I'm going to work a little on coding it today, maybe I could even finish it...

Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 1st Jun 2010 02:59
Quote: "@Dr Tank
That's cool, maybe when you finish it you could show us the source code?"

I always show my code. I just have to find the time to do it. Not much free time right now.

Quote: "I'm going to work a little on coding it today, maybe I could even finish it..."

Good luck dude.
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 22nd Jul 2010 02:50
Here's my Work In Progress post.

Portals can be translated and rotated and you can travel through.

No portals in portals yet.
Chris K
22
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 22nd Jul 2010 10:25
I made one of these ages ago that worked like Portal, and didn't need shaders.

I think that's the one that Van B is talking about, I emailed it to him to upload as my computer wasn't letting me upload at the time.

-= Out here in the fields, I fight for my meals =-
Dr Tank
17
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 22nd Jul 2010 13:01 Edited at: 22nd Jul 2010 13:02
Hey Chris, sounds sweet. Did I read somewhere that you used some kind of DBP rendering trick to do that? If it were possible, I'd prefer to draw the portal view to the screen, then draw over it with the main view, with the area of the portal not drawn, so you can see the view inside.

The shader is inefficient because instead of texturing the portal using screen coordinates, it projects the texture. In addition this makes it a bit shimmery without filtering turned on, presumably because of numerical error in the projection. With filtering it's a bit blurry. It works well enough, but if there's a better way, I'd be happy to hear about it.

I look forward to seeing your thing.

Login to post a reply

Server time is: 2026-07-25 05:32:50
Your offset time is: 2026-07-25 05:32:50