Looking at the Doom 3 source code I found that id wrote some of their own libraries to handle data. Things like strings, lists, dictionaries, vectors, etc. And talking to a friend of mine he said that a lot of it was due to the fact that the standard template libraries, while they work as intended, are usually not well suited to tightly controlled resource management that games require.
This interested me, so I decided to write my own little library, one that wouldn't require STL at all (As much as I could get away with that is). So far it's been an interesting experience in C++. I've become so used to using regular features like lists and such in Python, but never considered using them in lower level languages. They were there, but for some reason STL's notation can be so difficult to understand.
Take strings for example, it's just a char array, but the function descriptions can be so confusing with so many namespaces and shorthand variable names. But thanks to id's source code, I now have my own personal STL free string library that mimics some Python's functionality. Not to mention some assembly optimized functions too :)
So where is this going, you may ask. I never did get to look at ray-tracing (yet), but it got me thinking about the star gen version 4 I've been planning. In the past month or so I've learned a lot more about classes, OOP, and functional programming, that it's making me realize just how I want to write the next iteration and make it even more modular than before.
As for assembly optimization, I know there are intrinsics I could use, but again that requires including external includes, and this whole exerciser is all about learning how things are done. Though MMX and SSE assembly seems much more finicky than simple scalar stuff, but it's a start :)
That's it for now! Oh and Mass Effect 3 is awesome! ;)
Tuesday, May 15, 2012
Learning libraries
Labels:
alternatives,
c++,
classes,
functional programming,
Math,
OOP,
projects,
Star fields
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment