Pseudo 3d?

Get help using Construct 2

Post » Sat May 19, 2012 1:14 pm

thats an amazing effect, works really well

we need a more in depth tutorial to understand this...... pretty please?
B
10
S
1
G
1
Posts: 74
Reputation: 1,637

Post » Sat May 19, 2012 4:57 pm

[QUOTE=aridale] 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[/QUOTE]

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
B
19
S
6
G
7
Posts: 1,205
Reputation: 7,298

Post » Sat May 19, 2012 7:07 pm

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
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sat May 19, 2012 7:40 pm

@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
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sat May 19, 2012 8:02 pm

oh nice that version is well done too! amazing!
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sun May 20, 2012 1:44 am

Stop this awesomeness! It is too much!
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri May 25, 2012 8:42 pm

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
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sat May 26, 2012 9:02 pm

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.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sun May 27, 2012 6:16 pm

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
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sun May 27, 2012 7:31 pm

@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...
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Sotir31 and 27 guests