DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

Understanding Wolf3D Source Code 101 Tutorial
Page 1 of 1
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Zach
DieHard Guard
DieHard Guard


Joined: 11 Mar 2003
Last Visit: 12 Dec 2015

Topics: 30
Posts: 257

blank.gif

PostPosted: Wed Sep 03, 2014 3:57 pm
   Subject: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Hi guys,

I'm taking a programming logic course right now, just introductory concepts, and as I learn I plan on trying to relate it to Wolf's source code, as an objective source of comparison to aid learning. But I've noticed as I'm learning I start having basic questions about the Wolf3D source code, and it makes me think 'there really needs to be a basic primer for this', meaning a resource that helps learners understanding exactly what they're working with, concerning the source code (or SDL's code).

For example, we're learning about modules, the concept of it. By the way this class teaches with pseudocode, which I think is inefficient but I think it keeps the instructor from being inundated with questions and errors. But anyway, I remember from my tiny bit of Wolf code tinkering, that the code is broken up into multiple files wl_play.h and all that. Stuff I've always seen but never understood. In this hypothetical tutorial, things like this, the basic structure (with reasons why), how different files and areas within files affect and work together to create the game, would be outlined in order to bring clarity.

The benefit of something like this would give coding newbies some confidence and some sense of the big picture, which, for anyone anything like me, that's a major step up when it comes to learning a skill/knowledge set.

So this post is both to ask, does it exist (and if so where?) and to state, if it does not exist, it should be done. And to sub-state, if nobody wants to do it, I'll keep it in mind as something to do, once I wrap my head around it.

Because for anyone who cares, I plan on doing some fun stuff with this old game, I just have to get what I need to do it myself first.
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 1:01 ago.

Topics: 161
Posts: 8030
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Sep 03, 2014 4:46 pm
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

The way the different functions are laid out and what they do - that's illustrated throughout numerous tutorials, rather than in one section alone.

What I haven't seen illustrated in detail is the raycaster itself; it still remains somewhat of a mystery to me. Sad I know that the floor/ceiling textures are drawn first, then the walls, and then the sprites. Add to that, the HUD display is drawn to the screen from left to right ... one vertical line at a time. The vertical lines start at the top and make their way to the bottom, and then the code goes to the next vertical line of code.
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 3:36 ago.

Topics: 37
Posts: 2411
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Wed Sep 03, 2014 5:16 pm
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
What I haven't seen illustrated in detail is the raycaster itself; it still remains somewhat of a mystery to me. Sad I know that the floor/ceiling textures are drawn first, then the walls, and then the sprites. Add to that, the HUD display is drawn to the screen from left to right ... one vertical line at a time. The vertical lines start at the top and make their way to the bottom, and then the code goes to the next vertical line of code.


Actually, it's walls first, then floor/ceiling textures, then sprites. And the HUD isn't drawn in vertical lines; I think theoretically speaking each individual element is drawn in horizontal lines purely because that's how the picture drawing routine works, and the elements are drawn one after another rather than the whole thing being drawn at the same time.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 22 Jan 2018

Topics: 46
Posts: 2296
Location: USA
usa.gif

PostPosted: Wed Sep 03, 2014 6:48 pm
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

AlumiuN wrote:
I think theoretically speaking each individual element is drawn in horizontal lines purely because that's how the picture drawing routine works, and the elements are drawn one after another rather than the whole thing being drawn at the same time.

Each element of the HUD or the entire screen? There's a specific reason why walls are drawn vertically.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Lozer_42
DieHard Wolfer
DieHard Wolfer


Joined: 09 Jun 2006
Last Visit: 0:41 ago.

Topics: 49
Posts: 1162
Location: Grand Rapids, Michigan
usa.gif

PostPosted: Wed Sep 03, 2014 9:02 pm
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'm just blowing hot air here, but it seems to me that in a game where the walls are always orientated (in relation to the player's pov) vertically perpendicular (because tilting up or down isn't possible) it would be extremely efficient to have all of your distance scaling, perspective, and all of that nonsense, done vertically because it is a constant that never changes (x and y angles change constantly because the player can horizontally pan aka turn any way he chooses) and that to just use those calculations that were down vertically and take them directly to a renderer that draws them vertically would be the simple and quick way to do it, saving on as much memory as they can since that is always a concern of developers.

If the reasons are other I would be eager for someone else to properly explain it, since though I believe that my reasoning is deduced logically, as I opened with, it's all just hot air. Drink

_________________
Team RayCast YouTube Let's Play Commentaries
View Team RayCast on Mod DB
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 3:36 ago.

Topics: 37
Posts: 2411
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Wed Sep 03, 2014 9:54 pm
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Adam Biser wrote:
AlumiuN wrote:
I think theoretically speaking each individual element is drawn in horizontal lines purely because that's how the picture drawing routine works, and the elements are drawn one after another rather than the whole thing being drawn at the same time.

Each element of the HUD or the entire screen? There's a specific reason why walls are drawn vertically.


Just the HUD, I know the walls are drawn vertically.

Lozer_42 wrote:
I'm just blowing hot air here, but it seems to me that in a game where the walls are always orientated (in relation to the player's pov) vertically perpendicular (because tilting up or down isn't possible) it would be extremely efficient to have all of your distance scaling, perspective, and all of that nonsense, done vertically because it is a constant that never changes (x and y angles change constantly because the player can horizontally pan aka turn any way he chooses) and that to just use those calculations that were down vertically and take them directly to a renderer that draws them vertically would be the simple and quick way to do it, saving on as much memory as they can since that is always a concern of developers.


If I'm interpreting what you're saying correctly, that's pretty much the case already. Wolfenstein's rendering only bothers with the vertical dimension in figuring out how tall a wall at a given distance should be; everything else is done in purely horizontal terms - that's what the wallheight table is for.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 13 Jan 2018

Topics: 55
Posts: 2118
Location: Canada
blank.gif

PostPosted: Wed Sep 03, 2014 11:36 pm
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Zach wrote:
In this hypothetical tutorial, things like this, the basic structure (with reasons why), how different files and areas within files affect and work together to create the game, would be outlined in order to bring clarity.

It all starts at main() in the bottom of WL_MAIN.C:

::: CODE :::
void main (void)
{
   int     i;
...
   CheckForEpisodes();

   Patch386 ();

   InitGame ();

   DemoLoop();

   Quit("Demo loop exited???");
}

Which opens CheckForEpisodes() at the bottom of WL_MENU.C. Then InitGame() and DemoLoop(), both in WL_MAIN.C.

If you look inside those functions, and inside their functions, you can follow the order and see what's going on every step of the way.

Zach wrote:
The benefit of something like this would give coding newbies some confidence and some sense of the big picture, which, for anyone anything like me, that's a major step up when it comes to learning a skill/knowledge set.

There's no rule against throwing all the C/H/ASM files from wolf3d into one giant 70000 line C file. It all gets compiled into the same EXE anyways! A scientific study on rats showed that file organization is a convenience to Humans only.
Zach
DieHard Guard
DieHard Guard


Joined: 11 Mar 2003
Last Visit: 12 Dec 2015

Topics: 30
Posts: 257

blank.gif

PostPosted: Thu Sep 04, 2014 7:45 am
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris, those rats are all clones of each other --- THERE IS ONLY ONE WHITE RAT.

Ok so they follow a clearly defined path starting with this module in WL_MAIN.C (thank you for this link, btw), that's gonna help a lot.

I'm also really curious what I've read about Carmack (at least) using some assembly language in areas, presumably to make the engine more accurate or 'lighter' somehow..
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 13 Jan 2018

Topics: 55
Posts: 2118
Location: Canada
blank.gif

PostPosted: Mon Sep 08, 2014 9:16 am
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Zach wrote:
I'm also really curious what I've read about Carmack (at least) using some assembly language in areas, presumably to make the engine more accurate or 'lighter' somehow..

ASM is awesome bro! You can save directly into CPU registers (reducing cycles/time) instead of always having to travel to RAM, and it gives you finer control because every instruction is directly translated into the Opcodes that go into the exe. If your library has any old (90s era) 500-page books on ASM I'd definitely recommend checking them out. Thumbs Up
Frenkel
Bring 'em On
Bring 'em On


Joined: 24 Apr 2004
Last Visit: 16 Apr 2017

Topics: 7
Posts: 76
Location: Netherlands
netherlands.gif

PostPosted: Mon Sep 08, 2014 11:53 am
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Fabian Sanglard is working on a book about the Wolfenstein 3D engine.

_________________
Groeten van Frenkel
Visit us as the Official S&F Prod. Homepage
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 1:01 ago.

Topics: 161
Posts: 8030
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Mon Sep 08, 2014 4:54 pm
   Subject: Re: Understanding Wolf3D Source Code 101 Tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

If you're interested in learning DOS-based ASM as a whole, you might try this. It won't teach you everything, but it does go over some basic rules as to how ASM works in MS-DOS.
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Sticky: [Info] Help for newbie coders! C++ Tutorial
Author: Dugtrio17
20 7997 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Info] Black & White Effect - Tutorial
Author: Guest
10 296 Thu Mar 17, 2005 6:24 pm
Dugtrio17 View latest post
This topic is locked: you cannot edit posts or make replies. [Info] Source code for Darkone's NewWolf Classic
Author: Raistlin
1 1499 Tue Feb 10, 2004 10:18 am
BrotherTank View latest post
No new posts [Info] Making Guards Always Face You - Rotating guards
Author: CoolMario
3 88 Wed Jul 30, 2003 9:31 am
Codetech84 View latest post
No new posts [Info] Alarm Sounding in game?? WSJ...??
Author: Guest
7 308 Tue Jun 17, 2003 10:04 pm
Reivax44 View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group