Pseudo 3d?

Forum Home Forum Home > Construct 2 General > How do I....?
 Post Reply Post Reply Page  <123>
Author
1,485 Rep
Post Options Post Options   Quote darksteeldanger Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2012 at 1:14pm
thats an amazing effect, works really well

we need a more in depth tutorial to understand this...... pretty please?
Back to Top
4,319 Rep
Post Options Post Options   Quote chrisbrobs Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2012 at 4:57pm
Originally posted by aridale aridale wrote:

Like Wolfenstein 3d or the original DooM? It was raycasting back in those days. I was wondering if theres any way we could do that with c2? I know @Yann did somethin like that in his maze but I dunno how lol =D


Hers a pretty cool example I came across-



The code is not mine, I only made the textures!

Test

This was created by Ben Joffe.

Here's a link to his site-

Website
http://www.youtube.com/user/johnbrobs
Back to Top
3,012 Rep
Post Options Post Options   Quote aridale Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2012 at 7:07pm
Thanks again @r0j0hound! I figured out that 2nd example and updated my demo in the creations folder. I like the 2nd example a lot. Using lines to create the walls was a great idea
Back to Top
7,061 Rep
Post Options Post Options   Quote R0J0hound Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2012 at 7:40pm
@darksteeldanger
The first post I made in this topic has a link that explains it somewhat.

Basically what I did is make a top view game. Then I made a sprite for each vertical line across the screen. Then the player on the top view shoots a spread of bullets, one for each vertical line. When a bullet hits a wall then the corresponding vertical slice is made visible and it's height is set to 100*1/distance(bullet, player).

For the 2nd example I used the math here to find more precise wall intersections.
http://paulbourke.net/geometry/lineline2d/
For the texture I first split it into a frame per vertical slice. Then when the bullet(or ray) hits a wall I calc what texture slice to use by where on the line is hit.

New version with more fixes:
* multiple textures
* commented
* changed walls from lines to polygons.
http://dl.dropbox.com/u/5426011/examples11/raycast3.capx
Back to Top
3,012 Rep
Post Options Post Options   Quote aridale Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2012 at 8:02pm
oh nice that version is well done too! amazing!
Back to Top
19,033 Rep
Post Options Post Options   Quote sqiddster Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2012 at 1:44am
Stop this awesomeness! It is too much!
Back to Top
3,012 Rep
Post Options Post Options   Quote aridale Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2012 at 8:42pm
Im very tryin to figure out how to show walls behind other walls for things like half high walls and windows etc so far the only thing I can get to work is separatin the special walls from the other walls then rendering both sets but it KILLS performance makin it pretty much unplayable with any number of slices that looks decent

Any one got any ideas about how it could be done? I can post an example of how Im doin it currently if anyone wants to lag thru it to see what I mean lol
Back to Top
7,061 Rep
Post Options Post Options   Quote R0J0hound Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2012 at 9:02pm
I imagine it would kill the performance. Right now only the first wall hit per cast ray is used. It can be changed so that a order list of walls hit is used, which shouldn't affect performance too much.

The bottleneck will be the rendering. Right now one sprite is used for each vertical slice. With half walls more than one sprite will be needed per slice. I thought of using only 1 sprite and pasting it many times to a canvas object for the drawing, but I'm not sure if that would improve performance.
Back to Top
3,012 Rep
Post Options Post Options   Quote aridale Quote  Post ReplyReply Direct Link To This Post Posted: 27 May 2012 at 6:16pm
i cant think of any other way to do it. the only other thing to do would be have textures for each upper and lower wall combination but that doesnt take distance between the two into account
Back to Top
11,750 Rep
Post Options Post Options   Quote Yann Quote  Post ReplyReply Direct Link To This Post Posted: 27 May 2012 at 7:31pm
@aridale
I don't think that a combi texture would work, because you'd have to take into account all possible combinaison of height between the seethrough wall and the wall behind...
Back to Top
 Post Reply Post Reply Page  <123>

Forum Jump Forum Permissions View Drop Down