Questions about Ray Casting
Moderator: Moderators
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Questions about Ray Casting
I want to make a demake of Wolfenstien 3d on the NES using CHR RAM. But I don't quite understand how the Ray Casting system works. How does it know what pattern of pixels to make? You probably have no idea what I'm talking about. What I'm trying to say is when you are looking at a cube from an angle, you have to have their be a slant in the edges to make it look 3-dimensional. How does it know what pattern to make? It doesn't have a physical camera, so I'm confused. I've never done anything related to rendering 3D.
Re: Questions about Ray Casting
I strongly urge you to make 3D on a PC before you attempt to make it on the NES.
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: Questions about Ray Casting
Okay, could you give an example of how I would do it on a PC?
Re: Questions about Ray Casting
I can give you a quick rundown on how raycasting works, but implementing it on the NES (at playable speeds) will require a lot of cleverness and optimization of the basic technique. How good are you with trigonometry? Raycasting basically involves a lot of triangles whose sides and hypotenuses you have to find.
Re: Questions about Ray Casting
Article on setting goals...
https://www.psychologytoday.com/blog/co ... al-setting
https://www.psychologytoday.com/blog/co ... al-setting
People are happiest when they set small, achievable (yet challenging) goals.Goals should not be so be so difficult that the [person] will fail to take them seriously or will experience failure and frustration.
nesdoug.com -- blog/tutorial on programming for the NES
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: Questions about Ray Casting
I don't know anything about Trigonometry, I'm only in middle school. I'll try learning it on my own, though.tokumaru wrote:I can give you a quick rundown on how raycasting works, but implementing it on the NES (at playable speeds) will require a lot of cleverness and optimization of the basic technique. How good are you with trigonometry? Raycasting basically involves a lot of triangles whose sides and hypotenuses you have to find.
Re: Questions about Ray Casting
Bisqwit has made some nice videos about programming.
This one is about creating a Doom-style 3D engine in C.
I hope it helps.
This one is about creating a Doom-style 3D engine in C.
I hope it helps.
Re: Questions about Ray Casting
Then I simply can't explain how raycasting works in detail, since I'd have to teach you trigonometry as well. You need to at least understand what sines, cosines and tangents are, how they relate to the unit circle and their basic formulas.DementedPurple wrote:I don't know anything about Trigonometry
I can still give you a basic overview of how things work, though. Like I said, raycasting is all about triangles:
Code: Select all
+----------------+----------------+----------------+----------------+
| | | |WWWWWWWWWWWWWWWW|
| | | |WWWWWWWWWWWWWWWW|
| | | |WWWWWWWWWWWWWWWW|
| | | X WWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
+----------------+----------------+------/---------+----------------+
| | | / |WWWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
| | |/ |WWWWWWWWWWWWWWWW|
| | HYP /| |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
| | / | OPP |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
+----------------+-----/----------+----------------+----------------+
| | / | |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
| / | |WWWWWWWWWWWWWWWW|
| +---+/ | A | |WWWWWWWWWWWWWWWW|
| | P |--+----------------+----------------+WWWWWWWWWWWWWWWW|
| +---+ | | ADJ |WWWWWWWWWWWWWWWW|
| | | |WWWWWWWWWWWWWWWW|
| | | |WWWWWWWWWWWWWWWW|
+----------------+----------------+----------------+----------------+
This is a very basic overview of the process, since each of these processes has to be broken down into smaller tasks. Casting the ray for example involves the use of smaller triangles, aligned to the grid:
Code: Select all
+----------------+----------------+----------------+----------------+
| | | |WWWWWWWWWWWWWWWW|
| | | |WWWWWWWWWWWWWWWW|
| | | |WWWWWWWWWWWWWWWW|
| | | X WWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
+----------------+----------------+------/---------+----------------+
| | | / |WWWWWWWWWWWWWWWW|
| | | / |WWWWWWWWWWWWWWWW|
| | |/---------------+WWWWWWWWWWWWWWWW|
| | /| |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
+----------------+-----/----------+----------------+----------------+
| | / | |WWWWWWWWWWWWWWWW|
| | / | |WWWWWWWWWWWWWWWW|
| /----------------+ |WWWWWWWWWWWWWWWW|
| +---+/ | | |WWWWWWWWWWWWWWWW|
| | P |--+ | |WWWWWWWWWWWWWWWW|
| +---+ | | |WWWWWWWWWWWWWWWW|
| | | |WWWWWWWWWWWWWWWW|
| | | |WWWWWWWWWWWWWWWW|
+----------------+----------------+----------------+----------------+
Re: Questions about Ray Casting
Christ dude, just make a pong game or something. You'll learn a lot more by actually doing things than posting questions on forums.
I'm cheering for you.
I'm cheering for you.
Re: Questions about Ray Casting
It's true, you do seem a little ambitious for someone who's so young and is just starting out with NES development. I'm an example of someone who has learned a lot of stuff over the years without releasing anything, but I wouldn't recommend that to anyone... I'd rather have released some simpler games! Try to set a simpler goal (not pong though, please, we have enough of those!) and go through with it.
Re: Questions about Ray Casting
In that case, you should learn C# and try to make a game in Unity. Or use GameMaker, which I think, has it's own language, similar to Java (?).I don't know anything about Trigonometry, I'm only in middle school. I'll try learning it on my own, though.
nesdoug.com -- blog/tutorial on programming for the NES
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: Questions about Ray Casting
12?!? I thought me being 15 when I signed up here was bad!tokumaru wrote:It's true, you do seem a little ambitious for someone who's so young and is just starting out with NES development.
Yeah though, I hate to be the bearer of bad news, but starting out programming by building a raycasting engine (which I have no clue how to do!) will only lead to frustration. I don't think this is something you can really cut into steps where you can see your progress, unlike with a traditional 2D engine.
Just because you probably shouldn't do this doesn't mean you shouldn't avoid the NES. My first programming experience was actually with the SNES, although I didn't understand memory modes for more than my whole first year... I can't say for sure, but I heard learning higher level programming languages will not help you very much for learning assembly, because they are completely different. I know anything other than assembly or machine code still looks like gibberish to me.
Re: Questions about Ray Casting
I think being young and ambitious is a good thing though. I wish I started real programming when I was 12 or even 15, but computers weren't as common back then as they are now so it can't be helped.
Failed projects also makes you stronger, haha! But yeah I'd also say do something simpler first, but still something that interests you.
Failed projects also makes you stronger, haha! But yeah I'd also say do something simpler first, but still something that interests you.
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: Questions about Ray Casting
I mean yeah, That does seem kind of complicated and hard to do, but I don't mean to brag, but I've learned Java when I was 7. I could probably learn a lot doing this, But to keep it simple, I'll start with a ray-casting engine in C++. I don't see any harm in at least trying.
Re: Questions about Ray Casting
I wrote my first game when I was 7. It was a silly little text-mode BASIC thing - no Java in those days! - but it had two players, an AI and win/loss conditions.DementedPurple wrote:I mean yeah, That does seem kind of complicated and hard to do, but I don't mean to brag, but I've learned Java when I was 7. I could probably learn a lot doing this, But to keep it simple, I'll start with a ray-casting engine in C++. I don't see any harm in at least trying.
I wrote my second game when I was 23 and a half. I spent the intervening time doing exactly what you're doing - aiming for the stars and falling short of the clouds. I'm trying not to sound judgemental, and if that's what you want to do then by all means go for it - but if you want to make games now, you're on the wrong trajectory. Trust me, I've been there.
My advice: whip up something easy, say a roguelike. Doesn't matter if it's awful, doesn't matter if nobody else ever sees it, doesn't matter if you throw the whole thing out and start over. You can learn much, much faster by doing than by reading, and nothing I've tried quite lives up to playing your own game, thinking "wouldn't it be cool if...", and two hours of furious coding and testing later, having found and implemented something even better.