forked from id-Software/DOOM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,70 @@ | ||
# 03-20-2023 - it begins! | ||
# 03-22-2023 - it continues! | ||
|
||
### Q0: What are we doing today? | ||
### A: We're going to take a shallow dive into the `ipx` folder. | ||
I have _absolutely zero_ intentions at this early stage to dive into any part of the game code: I just want to understand what everything does at a high level, _then_ start working my way into the details once I've got the big picture and am comfortable with the codebase. | ||
|
||
The research here will likely fit within chunk #5 as outlined in my [README](../README.md), `Network Play'. | ||
|
||
As you might have read in [Masters of Doom](https://www.amazon.com/Masters-Doom-Created-Transformed-Culture/dp/0812972155), the idea for multiplayer came about when inspiration struck John Romero, him having seen two enemy NPCs fight each other, and realizing how awesome it would be if those were _players_ instead: that idea spawned an online game made known and revered as, in Romero's own words, **"Deathmatch"**. | ||
Today, I just found [this great page](https://doom.fandom.com/wiki/Doom_source_code) describing the legend for the source code of DOOM. | ||
|
||
A generation was born. LAN parties became a thing. And I'm pretty sure the code I'm about to look into is what made all of that happen. | ||
> If the source code is in `linuxdoom-1.10`, then I have to wonder if I'm studying the wrong folders like `ipx` and `sndserv` here. Time will tell! | ||
I'm super excited to start looking into this. 🤩 | ||
|
||
--- | ||
### Q1: What is the `ipx` folder? | ||
### A: According to the folder's [README](../ipx/README), it contains code supporting DOOM's IPX network driver. | ||
### Q0: What are we doing today? | ||
### A: We're going to take a shallow dive into the `sndserv` folder. | ||
|
||
--- | ||
### Q2: What is _IPX_ anyway? | ||
### A: [Internetwork Packet Exchange.](https://en.wikipedia.org/wiki/Internetwork_Packet_Exchange) I'd not heard of it until now. | ||
It was apparently quite popular at the time, and had a small memory footprint, making it a great fit for OS's which obviously didn't have quite the memory we have today. Unfortunately, IPX didn't scale well on large networks, and was eventually phased out and replaced by TCP/IP when the Internet really began to take off. | ||
### Q1: What's the `sndserv` folder all about? | ||
### A: It very much looks like it contains files related to handling audio. | ||
|
||
--- | ||
### Q3: What's in `DOOMNET.C`? | ||
### A: The `launchDOOM` function—likely, used to launch DOOM. | ||
This function seems to be called in two places: | ||
* `IPXSETUP.C` | ||
* `SERSETUP.C` | ||
[Per the folder's README](../sndserv/README.sndserv), | ||
|
||
(Dunno what's in either of those files yet.) | ||
> This is the soundserver as used by the original Linuxdoom release. | ||
At a high level, `launchDOOM` does some setup to launch DOOM or DOOM2 as appropriate. | ||
The file mentions things like `doomcom` (and setting its `id`), hooking in an "interrupt vector", and handling CLI arguments. | ||
Looks like these investigations will fit within chunk #4, `Audio', as outlined in my [README](../README.md). | ||
|
||
A lot of this is over my head right now, and that's okay, I'll dedicate more time to the finer details later. | ||
|
||
--- | ||
### Q4: What's in `DOOMNET.H`? | ||
### A: Various function and constant declarations, plus the declaration of the `doomcom` struct. | ||
I don't want to spend too long with this one right now, but I see some interesting things like `MAXNETNODES` and `MAXPLAYERS`, set to `8` and `4` respectively. | ||
|
||
Man... It's so hard to believe how far technology has come since then. I can just see Carmack in his office now, typing out those humble little numbers some 30 years ago, dreaming of the days we're in now. 🙂 | ||
### Q2: What's in `linux.c`? | ||
### A: ...A lot of functions related to the game's audio, seemingly. | ||
|
||
In the `doomcom` struct, I see some members that catch my eye: `episode`, `map`, `skill`, and `deathmatch`. Others like `extratics` and `ticdup`, I'll need to revisit on a deeper dive. | ||
|
||
--- | ||
### Q5: What's in `IPXSTR.H`? | ||
### A: Various string constants used throughout other files in the `ipx` folder. | ||
There are two interestings bit in here, `rcsid` and `#include <linux/soundcard.h>`. | ||
[I read here](https://stackoverflow.com/a/66286749/5374137) that the former is apparently a form of version control, and the latter just seems to be for handling audio on Linux machines. | ||
|
||
Not gonna spend much time here until I need to dig in to the code that uses it. | ||
Also in here are some functions worth nothing: | ||
|
||
--- | ||
### Q6: What's in `IPX_FRCH.H`? | ||
### A: French versions of the constants in `IPXSTR.H`. | ||
- `myioctl` | ||
- Probably means "my [ioctl](https://en.wikipedia.org/wiki/Ioctl)". | ||
- `I_InitMusic` | ||
- `I_InitSound` | ||
- `I_SubmitOutputBuffer` | ||
- `I_ShutdownSound` | ||
- `I_ShutdownMusic` | ||
|
||
I'm not immediately sure why there's just two versions, one for English and one for French, but I can always find out later. | ||
Not gonna lie, I am not slightly prepared to take on a high-level description of any of the code yet. ¯\\\_(ツ)_/¯ Moving on... | ||
|
||
--- | ||
### Q7: What's in `IPXNET.C`? | ||
### A: The IPX packet driver, and Many functions for handling various IPX network communications. | ||
|
||
A little overwhelming right now, but here's the functions inside: | ||
|
||
- `OpenSocket` | ||
- `CloseSocket` | ||
- `ListenForPacket` | ||
- `GetLocalAddress` | ||
- `InitNetwork` | ||
- `ShutdownNetwork` | ||
- `SendPacket` | ||
- `ShortSwap` | ||
- `GetPacket` | ||
|
||
Sounds like an exciting file to explore! | ||
|
||
Will continue this file tomorrow. | ||
### Q3: What's in `Makefile`? | ||
### A: Everything needed to tell the compiler how to make... whatever it is the files in this folder makes. | ||
|
||
--- | ||
### 03-21-2023 | ||
...Aaaaaaand resuming. | ||
### Q4: What's in `sounds.c`? | ||
### A: Information about all of the music and sounds, it seems. | ||
|
||
### Q8: What's in `IPXNET.H`? | ||
### A: Various declarations that I don't know really what to make of. | ||
|
||
Some interesting stuff in here: there's a `packet_t` struct which contains instances of other structs, viz. `IPXPacket` and `EBC`. The former is no doubt for storing information about IPX packets; the latter, I'm assuming, has something to do with IBM's "Event (or perhaps "Entry") Control Block", a.k.a "ECB", used to represent the status of an event. | ||
|
||
Again, it's a little over my head for now. | ||
Line `:107` in the code is `{ "ampie", 0 },`, which stands for 'Bye Bye American Pie', used in [DOOM II, MAP 23](https://doom.fandom.com/wiki/MAP23:_Barrels_o%27_Fun_(Doom_II)). The song riffs very, very heavily on 'Them Bones' by Alice in Chains, though arguably without the same heft, coming through MIDI. But as someone as obsessed with early Alice in Chains as with the 90's DOOMs, I felt obliged to point that out here. 🙃 | ||
|
||
--- | ||
### Q9: What's in `IPXSETUP.C`? | ||
### A: Various functions for IPX setup... just a guess. | ||
|
||
There's an `Error` function for handling "abnormal program terminations", a `LookForNodes` function which seems to have and a very curious `void interrupt NetISR` function. | ||
|
||
I'd never heard of `interrupt` before. If I had to guess, I think it was an extension of the compiler they were using at the time. Either way, [this comment on StackOverflow](https://stackoverflow.com/a/12353679/5374137) may suggest that Carmack had to combat an issue with serial port character drops on DOS at the time. The `interrupt` function isn't so commonly needed nowadays, I gather, but it's just so interesting to me to see problems programmers used to face back then and what they did to solve them. | ||
### Q5: What's in `sounds.h`? | ||
### A: Type definitions for the aforementioned `sounds.c`, created if said definitions DNE. | ||
|
||
--- | ||
### Q10: What's in `IPXSTR.H`? | ||
### A: Various definitions for messages to be printed out to the console. | ||
### Q6: What's in `soundsrv.c`? | ||
### A: The code for a Unix soundserver, according to the file header comment. | ||
|
||
Some very interesting stuff in here. | ||
|
||
--- | ||
- There's use of a `register` keyword: I'd never seen it before, but it's apparently what I suspected it would be: [placing values directly into a CPU register](https://en.wikipedia.org/wiki/Register_(keyword)). This was likely to access speeds RAM couldn't provide at that time. It's now deprecated and ignored in C++. | ||
|
||
And for now, that's it for the `ipx` folder! 🥳 | ||
- The `mix` function, which, IIUC, mixes the audio from 8 different available audio channels. Beyond that, I won't pretend I know what's going on here. | ||
|
||
I'm so excited to dive into another part of the code and document my findings, if still only at this high level. Again, I plan on coming back to understanding to finer details, but only after I've investigated more of the code. | ||
- The `grabdata` function, which I'm pretty sure from looking at the code tries to open DOOM WAD files if they are present and loads in the sounds defined within them. | ||
|
||
- A cheeky `whocares` timezone. ¯\\\_(ツ)_/¯ | ||
|
||
**See you in the next journal!** | ||
- The `updatesounds` function, which calls the `mix` and `I_SubmitOutputBuffer` functions in order to write out the sounds to the audio buffer, no doubt. | ||
|
||
*JonOfOz* | ||
- ...Some more I will document tomorrow! |