Jump to content
  • Advertisement
Sign in to follow this  
absolute

STL and Boost used in game industry?

This topic is 3740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I read that Boost and usually the STL are not used in the gaming industry by most programmers, most teams instead develop their own. Is this true? If this is the case then is it still worth trying to learn about STL and Boost? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I can't say whether or not that is true. However, I can say that 1) learning something new is never a bad idea and 2) STL and Boost are amazing. They'll save you tons of time, more than likely be more efficient, and have a much more expansive set of classes than you'll want to develop.

HTH

~P16

Share this post


Link to post
Share on other sites
If a particular company doesn't use the standard library or boost, it's for one of two reasons.

1) A good reason. - Consoles are funky beasts with spotty support and unusual memory requirements; the libraries might not work there or suit your needs. A developer might need a specialized algorithm because they've tested the standard library versus their special problem and decided it was worth it. A developer might be working with existing C code or old C++ code and it might not be worth it to port forward.

2) A bad reason. - The developer might not know of boost. The developer might be scared of boost. The developer might have an antiquated build system that can't use boost (and is too lazy/inept to upgrade it). The developer might think the container classes/iterator algorithms are 'too slow' or 'too weird'. The developer might complain that boost increases build time too much. The developer might want to hand code their own stuff because they 'get more control'.


So why wouldn't you use the standard library or boost? If you've got a good reason, that's fine; making commercial software is full of unpleasant compromises. If all you've got are bad reasons...

Share this post


Link to post
Share on other sites
We use some STL containers and maps, boost smart pointers, signals, dynamic bitsets and probably a few other things where I work. Also delegates and some custom containers and smart pointers.

STL and boost are definitely worth learning about, but don't overdo it. They're not the holy grail that some people make them out to be, just handy collections of code that you don't have to write yourself.

Share this post


Link to post
Share on other sites
This is the spec for EA's version of the STL library that they use Link for internal projects.

Other companies are also known for the their own implementations but most that I have seen conform the basic principles of STL. Iit is most definitely worth learning.

Share this post


Link to post
Share on other sites
Quote:
Original post by absolute
I read that Boost and usually the STL are not used in the gaming industry by most programmers, most teams instead develop their own. Is this true?


Yes, for the most part. There are studios that make heavy use of the C++ standard library and boost, but they are the exception rather than the rule.

Quote:

If this is the case then is it still worth trying to learn about STL and Boost?


Yes.

Share this post


Link to post
Share on other sites
Quote:

The developer might complain that boost increases build time too much

Heh, not sure why this is a bad reason. Build times with boost and partially the STL can go through the roof with huge code bases.

Quote:

The developer might want to hand code their own stuff because they 'get more control'.

There's plenty of reasons for this as well, such as time and space guarantees. The STL doesn't have these types of guarantees in most cases afaik.


Quote:

The developer might have an antiquated build system that can't use boost (and is too lazy/inept to upgrade it)

There's plenty of platforms that boost can't target. It's a pretty abusive library, twisting and bending C++ to where it wasn't supposed to go. There's only 5 platforms supported officially afaik.

Share this post


Link to post
Share on other sites
Hi

Imho boost and stl are very usefull.

However, depending on what you are about to do, there might be better alternatives. My personal attitude is: Use what best fits the problem!

But how will you decide on what "fits best", if don't know the alternatives?
So learning STL and boost is definitly a good thing.

Btw - I have been working on on both and i think meanwhile, there is not too much difference between successfull game business and successfull "other" software development.

And also Imho success is very closely related to staying in touch with latest technologies.

Best Jochen

Share this post


Link to post
Share on other sites
Quote:
Original post by asp_
There's plenty of platforms that boost can't target. It's a pretty abusive library, twisting and bending C++ to where it wasn't supposed to go. There's only 5 platforms supported officially afaik.


Or is it? Boost is sometimes regarded as the playground for new C++ standard library developments.

For example, boost::shared_ptr<>, boost::regex, boost::fusion (tuples) have become part of the standard C++ library in C++ TR1 as std::tr1::shared_ptr<>, std::tr1::regex and so on. Even more of Boost will become part of the official C++ standard with C++09.

I'd go as far and say Boost is exactly were C++ is going. The most prominent members of the C++ standarss committee, including Bjarne Stroupstrup, are advocating this style of C++, generally referred to as "modern C++" (probably after Andrei Alexandrescu's book of the same name)

Share this post


Link to post
Share on other sites
I wish i could find the link, but EA had an article out a while ago where they discussed their changes to the STL
to make it behave better on consoles. The biggest points were crappy compiler support for templates and inline functions.
High overhead of virtual functions and instruction cache misses. Lack of thread safety. No usage of console specific
ASM instructions. And the fact that most STL containers are hard, if not imposible to debug through.
All that tied together to mean they wrapped up their own STL, since the standard ones that come with
their compilers don't work.

I can attest to the compilers at work not having the wonderful built in template/stl support that something like VS2008EE has.
And the compilers all have their own little quirks that make porting between platforms difficult, as code that works on one system
will break the compiler on the other. (not to be confused with the compiled code not working right on the other platform, as that is a different issue)

So it is no wonder that we wrap our own systems to do some of what stl provides, just for the sake of having something that
compiles and works without getting in the way of debugging.
Also note that we wrap our own stuff for items that have specific accessors on the platform. ie. fstream still works, but it doesn't support the platform
async-io rutines. and likewise
cout doesn't support any of the special text features.


Now that doesn't mean we don't use stl/boost libraries. But we only use them for tools and the like that will run on a windows box,
and use a compiler that acutally supports them well. And you SHOULD look into them as it saves a tone of time to not have to deal
with all the associated code that libraries save you. Doesn't matter if it isn't your code, or you can't see/understand the black box,
that black-box will save you hundreds of hours of work, and get you done with a project instead of stuck on stupid little things someone else already
solved.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!