I also really wish templates were in the language. This pattern is totally 100% possible to roll yourself in C, but requires a bunch of boilerplate each time and I found that every time the implementation came out slightly differently, or that I had to go back and rewrite a bunch of code because I needed one more layer of flexibility than I anticipated. I found that when my project grew to a certain size, I started running into many cases where I needed many implementations of some base type, the kind of pattern that lends itself well to classes and simple inheritance. I have some recent experience with doing game programming in C and while I think the experience was overall positive, I'm not sure that I would do it again unless my aim was portability. Otherwise, I think C++ contains any number of "better C"'s within it, and it's mostly a matter of choosing which better C you want. Even so, I generally only use straight C if I'm writing a library that I want C users to be able to consume. I've written a successful open source project in it and am writing a book that uses C as one of the implementation languages. I like C and enjoy programming in it, which I've done for over 20 years. (Fun fact: the first version of C++ did not have virtual methods!) Going farther, even if you don't like "object-oriented programming", I think classes offer modularity and encapsulation features that make them worth using, even if you never once write the keyword "virtual" or use subclassing. Those alone make it a sufficiently "better C" to be worth using in my book. C++ has saner rules for implicit type conversions, namespaces, overloading, and a cleaner notation for dynamic allocation. As long as you don't have too many cooks arguing about which C++ features to throw into the pot, you can pick a subset of C++ that isn't much more complex than C (which is already more complex than most realize) and you'll get a much cleaner, safer language. As a tutorial series, I think using plain C is a cool approach and will help illuminate what's going on under the hood and what parts of the engine are really essential.īut if you yourself want to write your own game with just you or a small team of like-minded people, I would highly encourage using C++.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |