Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To use or not to use STL in games 2

Status
Not open for further replies.

AtomicChip

Programmer
May 15, 2001
622
CA
Hi all,

I'm not entirely new to C++ programming, but I'm not entirely familiar with compiler processes 'n stuff either... I've been told that there are downfalls to using the STL in game programming - what are these downfalls? Memory overhead? Footprint size? Or do these only really apply when you're developing for a limited-memory device, such as a handheld console? Is there any reason _not_ to use the STL in game development (I really haven't been able to see any reason not to)? This seems to be a fairly big debate within the game developer community and I'm hoping somebody can make some sense of it. I really would rather not re-invent the wheel when it comes to containers, iterators and such...

Thanks in advance.

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
from what i understand the main downfalls in using STL is debugging (which shouldnt be a problem in STL code.. in theory) and as you say coding for limited memory.

if you have a few $ to spare or have a decently stocked library near by, the book C++ for Game Programmers - Noel Llopis has a decent discussion into use of STL in game development (chapters 8 and 9)

If somethings hard to do, its not worth doing - Homer Simpson
 
one of the biggest concerns when using the STL for game development(at least what i was tought in school) is the ammount of overhead that comes with the STL. the STL has a lot of great tools but how much of them do you really use. sure you may use a vector or two here and a few other containers and calls, but you get a really huge amount of "crap" that comes with it. figure, you add the STL, then you also load in OpenGL or DirectX, then you also have all of your project specific code, and all of that before you write any of the game play or helper files you yourself have written/need. it all depends on the size of your game and the amount of detail youre trying to push through every frame. i was tought to stray away from, not completely denounce the STL. i have written 2D games that have included each the STL as well as a DirectX and have gotten a decent frame rate. my suggestion would be to play around with each the STL and stuff you have written to get a feel of the clock cycles as well as the frame rate, because those are 2 of the most important thing when developing games. that and it BETTER BE FUN!!
good luck,
steve
 
sure you may use a vector or two here and a few other containers and calls, but you get a really huge amount of "crap" that comes with it.
I don't know anything about writing games, but I'm not sure what you mean by all the "crap" that comes with it? A vector has 0 space overhead.
The STL string has a lot of member functions that really should have been non-member non-friend functions, but it's still better than worrying about allocating/deallocating char arrays yourself.
 
i didnt litterally mean "crap." i was just talking about all of the overhead. i do agree with you when it comes to worrying about the allocation and deallocation of strings and stuff like that. it definitly takes care of that stuff well, as well as efficiently. the STL has been around for a while so they have a lot of stuff figured out that wont need to change for a while. it's just a matter of preference. i was just always taught to stay away from the STL when it comes to games.
good luck,
steve
 
i was just always taught to stay away from the STL when it comes to games.

That's a terrible reason to do something
The STL is fast, simple, and (in my experience) a STANDARD, of which most companies take advantage of, and probably expect you to know
I HIGHLY recommend using it. Games need fast frame rates, and (if you know how to use it) the STL is unbeatable in speed.
 
Thanks for the replies guys

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top