I recently released a minor update to the CDS Library. I fixed some bugs and provided more explicit casting. The major incentive for these changes was compatibility with C++. CDS is still very much grounded in ANSI C, which is deliberate for compatibility reasons, so it doesn't take advantage of C++ specific features (such as templates). However, in terms of compatibility, I'm proud to have made a data structures library that almost any C/C++ compiler can build.
Unfortunately I'm spread very thin so my time for side projects such as these is extremely limited. I was hoping to get more experience writing cache conscious code, and perhaps experiment with some cache oblivious algorithms too.
Consistently exploiting cache optimized code is something I'm more mindful of, but admittedly need to improve on. It would be nice to explore this more some other time, perhaps as an extension to this project.
I'm also working on a game project for school where I'm deliberately trying to tackle Component - Entity Models and get more experience with SIMD math and intrinsics. I'm admittedly sticking relatively close to the framework used in Unity for now. In another project I might look into more data driven representations that use component aggregation a bit more purely. I started a thread on GameDev which discusses implementing lighter RTTI and ended up exploring ways to avoid the "everything is a game object" system we see so frequently in these types of frameworks. While this model admittedly feels excessive for some simple things it does have its benefits. When certain operations are best applied to logical game objects, iterating over every component or deleting them is much easier if you have one central game object. Communication between connected components also becomes trivial.
Currently the big question at hand is message passing. A hash table of function names and their addresses sounds reasonable. But is passing a void pointer array the best way to pass arguments? Do "returns" from these functions need to be put back into arguments of this array? What about like method names in different components? Whatever is chosen, it will have significant pros and cons that weren't very clear when we decided to go with components in the first place. In practice, we're finding the component model actually hides a significant amount of abstraction from the user. I'm not saying inheritance trees are better, merely that Component-Entity models, like all game object models, is going to feel a bit quirky from time to time.
Speaking of quirky, intrinsics will definitely feel that way the first time you implement them. Forced alignment, unclear macros, pipeline flushes, and bit masks? Your standard vector/matrix types are no longer so routine. And don't even get me started on how much of a pain it is to write this in a cross platform manner. Altivec's SIMD functions are just different enough to warrant typedefs everywhere. However, as an engine developer, intrinsics are definetly pretty cool. They are blazing fast (if used appropriately) and make old problems new again. That quaternion, bounding sphere, AABB, and float packed color structure are all "new" again. Things like cosine functions and sorting algorithms also present exciting new ways to conquer some old problems. It takes a specific kind of developer to get truly excited about rewriting these sorts of facilities. However, for those that do, they should definitely look into intrinsics if they haven't already.
My third recent side project involved diving into Lua. I work with PHP in my job so interpreted languages are not completely foreign to me. While Lua is considered easy to learn its syntax does not resemble C and certain ways in which Lua is used (table lookup, metatables, etc) can actually get rather involved. Nonetheless, it's a fun language to use, it was made by some very smart people, and it never feels like it's trying to be something its not. Lua knows it's a scripting language, and as such, is more frequently adopted as one compared to languages that see this as some sort of insult.
I'd like to build an event system or somehow provide script level access to my component entity model. However, it is still in development and not exactly a rudimentary task. So I kept the scope small and just made a simple math library. If nothing else, it provided a nice introduction to the language.
Other current events:
I learn a lot from reading other people's code. So while a lot of people in the games industry despise Boost and Template Meta-programming in general, it doesn't hurt to familiarize myself with the subject matter. I did the same with design patterns a couple years ago. The possible misuse of a technique is not a good excuse to evade learning it altogether. Is a singleton a monstrosity? Does overuse of templates bloat and complicate code? Yes and yes, but every implementation has its share of pros and cons.
I got Jesse Schell's excellent book from the library over the break. I may not see myself as a designer, but it never hurts to have some sensible design ideas floating around in your head. And even in the absence of great ideas, it improves communication skills with talented game designers.
I also got Volume 1 of Knuth's book for Christmas. I simply don't have the time to muscle through something like this right now, but it's nice knowing that if I want to challenge myself, I merely need to reach over to my bookshelf. It's gonna take a while to get through this one.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment