How do PWADs affect memory consumption in SRB2?

Status
Not open for further replies.

ÐeltaResero

A.K.A DeltaLink
More specifically, I'm inquiring in regards to how additions (such as PWADs) are handled in RAM subsequent to their loading. Hypothetically, if a wad file (PWAD) was previously added had contained replacements for a ring animation sequence composed of the same variables as the ones in the IWAD, would the original of the duplicates remain loaded despite being 'replaced' by their counterparts in the PWAD? Also does it tax the CPU to have PWADs in use during gameplay?

Normally I'd trace the source code, but unfortunately for me it appears to be written in "C". As my knowledge of is quite limited in this area, I'm unable to determine what exactly happens and would appreciate any insights that anyone with experience with "C" can give on this.
 
C is probably the most important language to computing today. It'd probably be a good idea if you learned it.

Or as SSN calls it, it's the "language of good little boys and girls."

Everything in a PWAD, when loaded, replaces the defaults in memory. This remains after you load subsequent wads as well, except if they are re-replaced.

Let's say I have three wads: wad 1 contains replacements for MAP01 and BUS1A0, wad 2 contains a different replacement for BUS1A0, and wad 3 contains MAP02 and the freeslot sprite F102A0. When I load any of them individually, meaning in different runs of SRB2, their contents only replace the defaults of what they contain and the rest remain unchanged. However, if I load them in order, we'd end up with a replaced MAP01 and MAP02, the second BUS1A0, and the one freeslot sprite all in memory, with the originals--or old versions, like the first BUS1A0--no longer in memory.

Hope this helps.
 
Actually, to my understanding, what happens is that pointers to all the WADs are loaded into memory, as well as specific assets (textures, notably, have data about how to reconstruct them - that is, their overall size, what patches are used and where - stored for later lookup). When you load a map, the engine checks what assets are necessary for that map to run and caches only that much, using the pointers to the loaded WADs to fetch the data. When you load another map, all that memory is marked to be freed up (ideally; Doom has a rather interesting memory management setup, where you can mark pointers as non-essential but keep them around for reference unless you run out of memory, or mark them as only relevant to a given level, etc.; you can read more about that here) and the assets for the new level are loaded anew. Lather, rinse, repeat.
 
I guess this explains how the addition of my graphics pack appeared to be causing minor FPS output increases on both my Wii and Pentium Pro machienes. Although this isn't what I was attempting to accomplish, maybe this concept could be applied to my autoexec configuration file. A pack containing lower quality replacements could be added for low end systems in the form of a PWAD, therefore wouldn't require any source manipulation and netplay would still be practical to a point (unless music was replaced by that of a different frequency).

Prior to posting this question, I was trying to figure if it was possible to remove added content during gameplay without having to restart. If I understand you two correctly, than in most circumstances it should be possible to revert changes by adding the IWAD with the "addfile" command in a similar way that PWADs are normally added (for example: addfile srb2.srb).

I agree with you Metal96, SSNTails, and probably what would be the greater majority of active programmers: "C is probably the most important language to computing today". Within the last few days, I start learning "C++" outside of school using online tutorials. It seems C++ and Java are quite similar in syntax, so I've been learning it quickly, but learning "C" is still going to be a while away for me. Also, both your explanations and the link you provided Shadow Hog were quite useful, thanks.
 
Speaking from experience, I'd wager C++ is closer in syntax to C than it is to Java, even if in terms of functionality, the whole "classes" thing makes it closer to Java.
 
It's a mix of both, you can definitely see the C in it, but it's also quite close to Java with the dot-syntax, OOP, etc.

In the real world, unless you're working with embedded systems, C++ is generally far more important. You can develop applications and games much faster than in C, and it's generally more manageable code-wise. C++ is the game developer's language of choice in the larger companies, with C# taking quite a stand in the indie development world due to XNA.

Saying that, it's also very good to use it, it teaches you a lot of things you may otherwise look over such as memory management. C++ still has some memory management but it also does a fair amount itself, and in higher level languages such as Java and C# you barely need to give a damn about them.
 
Last edited:
It appears there's quite an excess of tutorials on the internet of varying quality for most programming languages nowadays. For those who may be attempting to learn "C++"; of the tutorials I've seen hitherto, it appears the most complete is the tutorial on XoaX.net (which can also be found "here" on Youtube). I've yet to find one as complete as this on Youtube for "Java" and "C", but there's definitely plenty of relevant videos there. Aside from Youtube, I found the site "http://www.cprogramming.com/" to be of the most help overall.

I can recommend from experience to start with Eclipse as the IDE for any of these three languages and Microsoft Visual Studio Express as an alternative for all except Java for Windows users. It seems that Microsoft Visual Studio Express would be better for compiling SRB2, but it's quite temperamental. Hopefully the 2.1 source code will be less prone to errors. If anyone knows of a better IDE for compiling the SRB2 source code I definitely would like to hear about it.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top